Skip to content

Commit 566d037

Browse files
committed
Fixes test NestedField tests
1 parent cb000f7 commit 566d037

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/test_fields.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,12 +756,18 @@ def test_with_required(self, api):
756756
def test_with_description(self, api):
757757
nested_fields = api.model('NestedModel', {'name': fields.String})
758758
field = fields.Nested(nested_fields, description='A description')
759-
assert field.__schema__ == {'$ref': '#/definitions/NestedModel', 'description': 'A description'}
759+
assert field.__schema__ == {
760+
'description': 'A description',
761+
'allOf': [{'$ref': '#/definitions/NestedModel'}]
762+
}
760763

761764
def test_with_title(self, api):
762765
nested_fields = api.model('NestedModel', {'name': fields.String})
763766
field = fields.Nested(nested_fields, title='A title')
764-
assert field.__schema__ == {'$ref': '#/definitions/NestedModel', 'title': 'A title'}
767+
assert field.__schema__ == {
768+
'title': 'A title',
769+
'allOf': [{'$ref': '#/definitions/NestedModel'}]
770+
}
765771

766772
def test_with_allow_null(self, api):
767773
nested_fields = api.model('NestedModel', {'name': fields.String})
@@ -781,7 +787,10 @@ def test_with_readonly(self, app):
781787
api = Api(app)
782788
nested_fields = api.model('NestedModel', {'name': fields.String})
783789
field = fields.Nested(nested_fields, readonly=True)
784-
assert field.__schema__ == {'$ref': '#/definitions/NestedModel', 'readOnly': True}
790+
assert field.__schema__ == {
791+
'readOnly': True,
792+
'allOf': [{'$ref': '#/definitions/NestedModel'}]
793+
}
785794

786795
def test_as_list(self, api):
787796
nested_fields = api.model('NestedModel', {'name': fields.String})

0 commit comments

Comments
 (0)