Skip to content

Commit

Permalink
Merge pull request #149 from AHBaber/object_fix_2
Browse files Browse the repository at this point in the history
removed field 'type': 'object' from swagger json when using doc.Object()
  • Loading branch information
chenjr0719 committed Dec 16, 2019
2 parents 3cdf880 + eb62442 commit 60605ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion sanic_openapi/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def definition(self):

def serialize(self):
return {
"type": "object",
"$ref": "#/definitions/{}".format(self.object_name),
**super().serialize(),
}
Expand Down
3 changes: 1 addition & 2 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class TestSchema:
{"location": "body", "required": True, "content_type": "application/json"},
[
{
"type": "object",
"required": True,
"in": "body",
"name": "body",
Expand Down Expand Up @@ -127,7 +126,7 @@ def test(request):
(
[TestSchema],
{"content_type": "application/json"},
{"200": {"schema": {"$ref": "#/definitions/TestSchema", "type": "object"}}},
{"200": {"schema": {"$ref": "#/definitions/TestSchema"}}},
),
],
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class TestSchema:
(datetime, {"type": "string", "format": "date-time"}),
(doc.DateTime, {"type": "string", "format": "date-time"}),
(doc.DateTime(), {"type": "string", "format": "date-time"}),
(TestSchema, {"$ref": "#/definitions/TestSchema", "type": "object"}),
(TestSchema, {"$ref": "#/definitions/TestSchema"}),
(dict, {"type": "object", "properties": {}}),
({"foo": "bar"}, {"type": "object", "properties": {"foo": {}}}),
(list, {"type": "array", "items": []}),
Expand Down

0 comments on commit 60605ce

Please sign in to comment.