Skip to content

Commit

Permalink
Fix x nullabe in inspectors (#103)
Browse files Browse the repository at this point in the history
* Changed x_nullable to x-nullable

* Changed version to 1.9.1
  • Loading branch information
andrey-berenda authored Jun 6, 2019
1 parent 92736d1 commit 3a32dc8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions tests/schema/test_type_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,25 @@ def test_compare_type_info(first, second, is_same):
))
def test_inspect_enum_class(enum_cls, expected_value):
assert inspect_enum_class(enum_cls) == expected_value


@pytest.mark.parametrize(('type_info', 'expected_data'), (
(
TypeInfo(openapi.TYPE_STRING, openapi.FORMAT_URI, nullable=True),
{'format': 'uri', 'type': 'string', 'x-nullable': True},
),
(
TypeInfo(openapi.TYPE_INTEGER, enum=[1, 2]),
{'enum': [1, 2], 'type': 'integer'},
),
(
TypeInfo(openapi.TYPE_OBJECT, properties={'nested_number': TypeInfo(openapi.TYPE_INTEGER)}),
{'properties': {'nested_number': {'type': 'integer'}}, 'type': 'object'},
),
(
TypeInfo(openapi.TYPE_ARRAY, child=TypeInfo(openapi.TYPE_INTEGER)),
{'items': {'type': 'integer'}, 'type': 'array'},
),
))
def test_as_dict_in_type_info(type_info, expected_data):
assert type_info.as_dict() == expected_data
2 changes: 1 addition & 1 deletion winter/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.9.0'
__version__ = '1.9.1'
2 changes: 1 addition & 1 deletion winter/schema/type_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def as_dict(self):
data['items'] = self.child.as_dict()

if self.nullable:
data['x_nullable'] = True
data['x-nullable'] = True

if self.enum is not None:
data['enum'] = self.enum
Expand Down

0 comments on commit 3a32dc8

Please sign in to comment.