@@ -307,6 +307,65 @@ def func(document, query_args):
307307            "query_args" : {"arg1" : "test" },
308308        }
309309
310+     @pytest .mark .parametrize ("openapi_version" , ("2.0" , "3.0.2" )) 
311+     def  test_blueprint_dict_argument_schema (self , app , schemas , openapi_version ):
312+         app .config ["OPENAPI_VERSION" ] =  openapi_version 
313+         api  =  Api (app )
314+         blp  =  Blueprint ("test" , __name__ , url_prefix = "/test" )
315+         client  =  app .test_client ()
316+ 
317+         @blp .route ("/" , methods = ("POST" ,)) 
318+         @blp .arguments (schemas .DictSchema ) 
319+         def  func (document ):
320+             return  {"document" : document }
321+ 
322+         api .register_blueprint (blp )
323+         spec  =  api .spec .to_dict ()
324+ 
325+         # Check parameters are documented 
326+         if  openapi_version  ==  "2.0" :
327+             parameters  =  spec ["paths" ]["/test/" ]["post" ]["parameters" ]
328+             assert  len (parameters ) ==  1 
329+             assert  parameters [0 ]["in" ] ==  "body" 
330+             assert  "schema"  in  parameters [0 ]
331+         else :
332+             assert  (
333+                 "schema" 
334+                 in  spec ["paths" ]["/test/" ]["post" ]["requestBody" ]["content" ][
335+                     "application/json" 
336+                 ]
337+             )
338+ 
339+         # Check parameters are passed as arguments to view function 
340+         item_data  =  {"field" : 12 }
341+         response  =  client .post (
342+             "/test/" ,
343+             data = json .dumps (item_data ),
344+             content_type = "application/json" ,
345+         )
346+         assert  response .status_code  ==  200 
347+         assert  response .json  ==  {
348+             "document" : {"db_field" : 12 },
349+         }
350+ 
351+     @pytest .mark .parametrize ("openapi_version" , ["2.0" , "3.0.2" ]) 
352+     def  test_blueprint_dict_response_schema (self , app , schemas , openapi_version ):
353+         """Check alt_response passes response transparently""" 
354+         app .config ["OPENAPI_VERSION" ] =  openapi_version 
355+         api  =  Api (app )
356+         blp  =  Blueprint ("test" , "test" , url_prefix = "/test" )
357+         client  =  app .test_client ()
358+ 
359+         @blp .route ("/" ) 
360+         @blp .response (200 , schema = schemas .DictSchema ) 
361+         def  func ():
362+             return  {"item_id" : 12 }
363+ 
364+         api .register_blueprint (blp )
365+ 
366+         resp  =  client .get ("/test/" )
367+         assert  resp .json  ==  {"item_id" : 12 }
368+ 
310369    @pytest .mark .parametrize ("openapi_version" , ("2.0" , "3.0.2" )) 
311370    def  test_blueprint_arguments_files_multipart (self , app , schemas , openapi_version ):
312371        app .config ["OPENAPI_VERSION" ] =  openapi_version 
0 commit comments