diff --git a/sanic_openapi/swagger.py b/sanic_openapi/swagger.py index b3de865..12dd176 100644 --- a/sanic_openapi/swagger.py +++ b/sanic_openapi/swagger.py @@ -213,6 +213,9 @@ def build_spec(app, loop): if "$ref" in route_param: route_param["schema"] = {"$ref": route_param["$ref"]} del route_param["$ref"] + if 'type' in route_param: + route_param["schema"]['type'] = route_param['type'] + del route_param['type'] route_parameters.append(route_param) diff --git a/tests/test_decorators.py b/tests/test_decorators.py index e04112e..1422002 100644 --- a/tests/test_decorators.py +++ b/tests/test_decorators.py @@ -95,11 +95,11 @@ class TestSchema: {"location": "body", "required": True, "content_type": "application/json"}, [ { - "type": "object", "required": True, "in": "body", "name": "body", - "schema": {"$ref": "#/definitions/TestSchema"}, + "schema": {"$ref": "#/definitions/TestSchema", + "type": "object"}, } ], ),