diff --git a/tests/schema/test_type_inspection.py b/tests/schema/test_type_inspection.py index 24b8147a..35554fe1 100644 --- a/tests/schema/test_type_inspection.py +++ b/tests/schema/test_type_inspection.py @@ -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 diff --git a/winter/__version__.py b/winter/__version__.py index e5102d30..35424e87 100644 --- a/winter/__version__.py +++ b/winter/__version__.py @@ -1 +1 @@ -__version__ = '1.9.0' +__version__ = '1.9.1' diff --git a/winter/schema/type_inspection.py b/winter/schema/type_inspection.py index c95bfe8d..bdfb39fe 100644 --- a/winter/schema/type_inspection.py +++ b/winter/schema/type_inspection.py @@ -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