From f2cb334bc4ee3e451c7307ff7bb8eee5eab152af Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Sun, 25 Mar 2018 22:21:05 +0200 Subject: [PATCH 1/6] fix: remove imports from models to avoid circular dependencies --- .../swagger-codegen/src/main/resources/python/model.mustache | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 5668793b3f6..b9e0d124074 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -6,10 +6,6 @@ import pprint import re # noqa: F401 import six -{{#imports}}{{#-first}} -{{/-first}} -{{import}} # noqa: F401,E501 -{{/imports}} {{#models}} From a0798158c3d060d50f5ed4c043b99bbafbd7a7ea Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Sun, 25 Mar 2018 22:22:06 +0200 Subject: [PATCH 2/6] chore: regenerate sample client (python*) --- .../python-asyncio/.swagger-codegen/VERSION | 2 +- .../petstore/python-asyncio/docs/EnumTest.md | 1 + .../petstore/python-asyncio/docs/FakeApi.md | 4 +- .../python-asyncio/petstore_api/__init__.py | 2 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/animal_farm.py | 2 - .../petstore_api/models/array_test.py | 2 - .../python-asyncio/petstore_api/models/cat.py | 2 - .../python-asyncio/petstore_api/models/dog.py | 2 - .../petstore_api/models/enum_test.py | 37 +++++++++++++++++-- ...perties_and_additional_properties_class.py | 2 - .../petstore_api/models/outer_composite.py | 4 -- .../python-asyncio/petstore_api/models/pet.py | 3 -- .../python-tornado/.swagger-codegen/VERSION | 2 +- .../petstore/python-tornado/docs/EnumTest.md | 1 + .../petstore/python-tornado/docs/FakeApi.md | 4 +- .../python-tornado/petstore_api/__init__.py | 2 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/animal_farm.py | 2 - .../petstore_api/models/array_test.py | 2 - .../python-tornado/petstore_api/models/cat.py | 2 - .../python-tornado/petstore_api/models/dog.py | 2 - .../petstore_api/models/enum_test.py | 37 +++++++++++++++++-- ...perties_and_additional_properties_class.py | 2 - .../petstore_api/models/outer_composite.py | 4 -- .../python-tornado/petstore_api/models/pet.py | 3 -- .../client/petstore/python/docs/EnumTest.md | 1 + .../client/petstore/python/docs/FakeApi.md | 4 +- .../petstore/python/petstore_api/__init__.py | 2 +- .../python/petstore_api/models/__init__.py | 2 +- .../python/petstore_api/models/animal_farm.py | 2 - .../python/petstore_api/models/array_test.py | 2 - .../python/petstore_api/models/cat.py | 2 - .../python/petstore_api/models/dog.py | 2 - .../python/petstore_api/models/enum_test.py | 37 +++++++++++++++++-- ...perties_and_additional_properties_class.py | 2 - .../petstore_api/models/outer_composite.py | 4 -- .../python/petstore_api/models/pet.py | 3 -- 38 files changed, 119 insertions(+), 74 deletions(-) diff --git a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION index 855ff9501eb..f9f7450d135 100644 --- a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/docs/EnumTest.md b/samples/client/petstore/python-asyncio/docs/EnumTest.md index 94dd4864629..c4c1630250f 100644 --- a/samples/client/petstore/python-asyncio/docs/EnumTest.md +++ b/samples/client/petstore/python-asyncio/docs/EnumTest.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enum_string** | **str** | | [optional] +**enum_string_required** | **str** | | **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index 1da84500bfe..b910ba2b464 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 8.14 # float | None +number = 3.4 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'B' # str | None +byte = 'byte_example' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py index 8bf367cc5b8..c368867dd11 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py index c5ae381c40f..7b339102f9b 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py b/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py index 6371257286e..3a2352422fe 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class AnimalFarm(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py index c5cd6bfe159..f638f9f4624 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: F401,E501 - class ArrayTest(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/cat.py b/samples/client/petstore/python-asyncio/petstore_api/models/cat.py index 526d3e2aaf5..3c53b2d6dc8 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/cat.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/cat.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Cat(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/dog.py b/samples/client/petstore/python-asyncio/petstore_api/models/dog.py index 34aac6aaad4..4c7bde0c8ef 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/dog.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/dog.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Dog(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py index 1bb234764ab..16271c85afc 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.outer_enum import OuterEnum # noqa: F401,E501 - class EnumTest(object): """NOTE: This class is auto generated by the swagger code generator program. @@ -34,6 +32,7 @@ class EnumTest(object): """ swagger_types = { 'enum_string': 'str', + 'enum_string_required': 'str', 'enum_integer': 'int', 'enum_number': 'float', 'outer_enum': 'OuterEnum' @@ -41,15 +40,17 @@ class EnumTest(object): attribute_map = { 'enum_string': 'enum_string', + 'enum_string_required': 'enum_string_required', 'enum_integer': 'enum_integer', 'enum_number': 'enum_number', 'outer_enum': 'outerEnum' } - def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 + def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 """EnumTest - a model defined in Swagger""" # noqa: E501 self._enum_string = None + self._enum_string_required = None self._enum_integer = None self._enum_number = None self._outer_enum = None @@ -57,6 +58,7 @@ def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_ if enum_string is not None: self.enum_string = enum_string + self.enum_string_required = enum_string_required if enum_integer is not None: self.enum_integer = enum_integer if enum_number is not None: @@ -91,6 +93,35 @@ def enum_string(self, enum_string): self._enum_string = enum_string + @property + def enum_string_required(self): + """Gets the enum_string_required of this EnumTest. # noqa: E501 + + + :return: The enum_string_required of this EnumTest. # noqa: E501 + :rtype: str + """ + return self._enum_string_required + + @enum_string_required.setter + def enum_string_required(self, enum_string_required): + """Sets the enum_string_required of this EnumTest. + + + :param enum_string_required: The enum_string_required of this EnumTest. # noqa: E501 + :type: str + """ + if enum_string_required is None: + raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501 + allowed_values = ["UPPER", "lower", ""] # noqa: E501 + if enum_string_required not in allowed_values: + raise ValueError( + "Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501 + .format(enum_string_required, allowed_values) + ) + + self._enum_string_required = enum_string_required + @property def enum_integer(self): """Gets the enum_integer of this EnumTest. # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py index dba1f261352..ec6c659416e 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class MixedPropertiesAndAdditionalPropertiesClass(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py index 19775255e4e..4d2fa8d50ff 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py @@ -16,10 +16,6 @@ import six -from petstore_api.models.outer_boolean import OuterBoolean # noqa: F401,E501 -from petstore_api.models.outer_number import OuterNumber # noqa: F401,E501 -from petstore_api.models.outer_string import OuterString # noqa: F401,E501 - class OuterComposite(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/pet.py b/samples/client/petstore/python-asyncio/petstore_api/models/pet.py index 81b2bb617f9..4c8355b1f53 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/pet.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/pet.py @@ -16,9 +16,6 @@ import six -from petstore_api.models.category import Category # noqa: F401,E501 -from petstore_api.models.tag import Tag # noqa: F401,E501 - class Pet(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION index 855ff9501eb..f9f7450d135 100644 --- a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/docs/EnumTest.md b/samples/client/petstore/python-tornado/docs/EnumTest.md index 94dd4864629..c4c1630250f 100644 --- a/samples/client/petstore/python-tornado/docs/EnumTest.md +++ b/samples/client/petstore/python-tornado/docs/EnumTest.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enum_string** | **str** | | [optional] +**enum_string_required** | **str** | | **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index 1da84500bfe..b910ba2b464 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 8.14 # float | None +number = 3.4 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'B' # str | None +byte = 'byte_example' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index 8bf367cc5b8..c368867dd11 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py index c5ae381c40f..7b339102f9b 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py b/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py index 6371257286e..3a2352422fe 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class AnimalFarm(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/array_test.py b/samples/client/petstore/python-tornado/petstore_api/models/array_test.py index c5cd6bfe159..f638f9f4624 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/array_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: F401,E501 - class ArrayTest(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/cat.py b/samples/client/petstore/python-tornado/petstore_api/models/cat.py index 526d3e2aaf5..3c53b2d6dc8 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/cat.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/cat.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Cat(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/dog.py b/samples/client/petstore/python-tornado/petstore_api/models/dog.py index 34aac6aaad4..4c7bde0c8ef 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/dog.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/dog.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Dog(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py b/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py index 1bb234764ab..16271c85afc 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.outer_enum import OuterEnum # noqa: F401,E501 - class EnumTest(object): """NOTE: This class is auto generated by the swagger code generator program. @@ -34,6 +32,7 @@ class EnumTest(object): """ swagger_types = { 'enum_string': 'str', + 'enum_string_required': 'str', 'enum_integer': 'int', 'enum_number': 'float', 'outer_enum': 'OuterEnum' @@ -41,15 +40,17 @@ class EnumTest(object): attribute_map = { 'enum_string': 'enum_string', + 'enum_string_required': 'enum_string_required', 'enum_integer': 'enum_integer', 'enum_number': 'enum_number', 'outer_enum': 'outerEnum' } - def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 + def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 """EnumTest - a model defined in Swagger""" # noqa: E501 self._enum_string = None + self._enum_string_required = None self._enum_integer = None self._enum_number = None self._outer_enum = None @@ -57,6 +58,7 @@ def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_ if enum_string is not None: self.enum_string = enum_string + self.enum_string_required = enum_string_required if enum_integer is not None: self.enum_integer = enum_integer if enum_number is not None: @@ -91,6 +93,35 @@ def enum_string(self, enum_string): self._enum_string = enum_string + @property + def enum_string_required(self): + """Gets the enum_string_required of this EnumTest. # noqa: E501 + + + :return: The enum_string_required of this EnumTest. # noqa: E501 + :rtype: str + """ + return self._enum_string_required + + @enum_string_required.setter + def enum_string_required(self, enum_string_required): + """Sets the enum_string_required of this EnumTest. + + + :param enum_string_required: The enum_string_required of this EnumTest. # noqa: E501 + :type: str + """ + if enum_string_required is None: + raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501 + allowed_values = ["UPPER", "lower", ""] # noqa: E501 + if enum_string_required not in allowed_values: + raise ValueError( + "Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501 + .format(enum_string_required, allowed_values) + ) + + self._enum_string_required = enum_string_required + @property def enum_integer(self): """Gets the enum_integer of this EnumTest. # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py index dba1f261352..ec6c659416e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class MixedPropertiesAndAdditionalPropertiesClass(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py index 19775255e4e..4d2fa8d50ff 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py @@ -16,10 +16,6 @@ import six -from petstore_api.models.outer_boolean import OuterBoolean # noqa: F401,E501 -from petstore_api.models.outer_number import OuterNumber # noqa: F401,E501 -from petstore_api.models.outer_string import OuterString # noqa: F401,E501 - class OuterComposite(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/pet.py b/samples/client/petstore/python-tornado/petstore_api/models/pet.py index 81b2bb617f9..4c8355b1f53 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/pet.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/pet.py @@ -16,9 +16,6 @@ import six -from petstore_api.models.category import Category # noqa: F401,E501 -from petstore_api.models.tag import Tag # noqa: F401,E501 - class Pet(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/docs/EnumTest.md b/samples/client/petstore/python/docs/EnumTest.md index 94dd4864629..c4c1630250f 100644 --- a/samples/client/petstore/python/docs/EnumTest.md +++ b/samples/client/petstore/python/docs/EnumTest.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enum_string** | **str** | | [optional] +**enum_string_required** | **str** | | **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index 1da84500bfe..b910ba2b464 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 8.14 # float | None +number = 3.4 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'B' # str | None +byte = 'byte_example' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index 8bf367cc5b8..c368867dd11 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index c5ae381c40f..7b339102f9b 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/petstore_api/models/animal_farm.py b/samples/client/petstore/python/petstore_api/models/animal_farm.py index 6371257286e..3a2352422fe 100644 --- a/samples/client/petstore/python/petstore_api/models/animal_farm.py +++ b/samples/client/petstore/python/petstore_api/models/animal_farm.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class AnimalFarm(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/array_test.py b/samples/client/petstore/python/petstore_api/models/array_test.py index c5cd6bfe159..f638f9f4624 100644 --- a/samples/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/client/petstore/python/petstore_api/models/array_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: F401,E501 - class ArrayTest(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/cat.py b/samples/client/petstore/python/petstore_api/models/cat.py index 526d3e2aaf5..3c53b2d6dc8 100644 --- a/samples/client/petstore/python/petstore_api/models/cat.py +++ b/samples/client/petstore/python/petstore_api/models/cat.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Cat(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/dog.py b/samples/client/petstore/python/petstore_api/models/dog.py index 34aac6aaad4..4c7bde0c8ef 100644 --- a/samples/client/petstore/python/petstore_api/models/dog.py +++ b/samples/client/petstore/python/petstore_api/models/dog.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class Dog(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/enum_test.py b/samples/client/petstore/python/petstore_api/models/enum_test.py index 1bb234764ab..16271c85afc 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python/petstore_api/models/enum_test.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.outer_enum import OuterEnum # noqa: F401,E501 - class EnumTest(object): """NOTE: This class is auto generated by the swagger code generator program. @@ -34,6 +32,7 @@ class EnumTest(object): """ swagger_types = { 'enum_string': 'str', + 'enum_string_required': 'str', 'enum_integer': 'int', 'enum_number': 'float', 'outer_enum': 'OuterEnum' @@ -41,15 +40,17 @@ class EnumTest(object): attribute_map = { 'enum_string': 'enum_string', + 'enum_string_required': 'enum_string_required', 'enum_integer': 'enum_integer', 'enum_number': 'enum_number', 'outer_enum': 'outerEnum' } - def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 + def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 """EnumTest - a model defined in Swagger""" # noqa: E501 self._enum_string = None + self._enum_string_required = None self._enum_integer = None self._enum_number = None self._outer_enum = None @@ -57,6 +58,7 @@ def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_ if enum_string is not None: self.enum_string = enum_string + self.enum_string_required = enum_string_required if enum_integer is not None: self.enum_integer = enum_integer if enum_number is not None: @@ -91,6 +93,35 @@ def enum_string(self, enum_string): self._enum_string = enum_string + @property + def enum_string_required(self): + """Gets the enum_string_required of this EnumTest. # noqa: E501 + + + :return: The enum_string_required of this EnumTest. # noqa: E501 + :rtype: str + """ + return self._enum_string_required + + @enum_string_required.setter + def enum_string_required(self, enum_string_required): + """Sets the enum_string_required of this EnumTest. + + + :param enum_string_required: The enum_string_required of this EnumTest. # noqa: E501 + :type: str + """ + if enum_string_required is None: + raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501 + allowed_values = ["UPPER", "lower", ""] # noqa: E501 + if enum_string_required not in allowed_values: + raise ValueError( + "Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501 + .format(enum_string_required, allowed_values) + ) + + self._enum_string_required = enum_string_required + @property def enum_integer(self): """Gets the enum_integer of this EnumTest. # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index dba1f261352..ec6c659416e 100644 --- a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -16,8 +16,6 @@ import six -from petstore_api.models.animal import Animal # noqa: F401,E501 - class MixedPropertiesAndAdditionalPropertiesClass(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/outer_composite.py b/samples/client/petstore/python/petstore_api/models/outer_composite.py index 19775255e4e..4d2fa8d50ff 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python/petstore_api/models/outer_composite.py @@ -16,10 +16,6 @@ import six -from petstore_api.models.outer_boolean import OuterBoolean # noqa: F401,E501 -from petstore_api.models.outer_number import OuterNumber # noqa: F401,E501 -from petstore_api.models.outer_string import OuterString # noqa: F401,E501 - class OuterComposite(object): """NOTE: This class is auto generated by the swagger code generator program. diff --git a/samples/client/petstore/python/petstore_api/models/pet.py b/samples/client/petstore/python/petstore_api/models/pet.py index 81b2bb617f9..4c8355b1f53 100644 --- a/samples/client/petstore/python/petstore_api/models/pet.py +++ b/samples/client/petstore/python/petstore_api/models/pet.py @@ -16,9 +16,6 @@ import six -from petstore_api.models.category import Category # noqa: F401,E501 -from petstore_api.models.tag import Tag # noqa: F401,E501 - class Pet(object): """NOTE: This class is auto generated by the swagger code generator program. From efdb1dd402156ed2a084e3a536dd3cd02785f3bc Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Sun, 25 Mar 2018 22:26:00 +0200 Subject: [PATCH 3/6] fix: tests --- samples/client/petstore/python/tests/test_deserialization.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/client/petstore/python/tests/test_deserialization.py b/samples/client/petstore/python/tests/test_deserialization.py index 97d047563df..d7429dea416 100644 --- a/samples/client/petstore/python/tests/test_deserialization.py +++ b/samples/client/petstore/python/tests/test_deserialization.py @@ -27,6 +27,7 @@ def test_enum_test(self): data = { 'enum_test': { "enum_string": "UPPER", + "enum_string_required": "lower", "enum_integer": 1, "enum_number": 1.1, "outerEnum": "placed" @@ -38,6 +39,7 @@ def test_enum_test(self): self.assertTrue(isinstance(deserialized['enum_test'], petstore_api.EnumTest)) self.assertEqual(deserialized['enum_test'], petstore_api.EnumTest(enum_string="UPPER", + enum_string_required="lower", enum_integer=1, enum_number=1.1, outer_enum=petstore_api.OuterEnum.PLACED)) From 62c5e994410072ce0d165b41eb827c1403c320b0 Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Mon, 26 Mar 2018 14:19:51 +0200 Subject: [PATCH 4/6] fix: regenerate samples --- .../client/petstore/python-asyncio/.swagger-codegen/VERSION | 2 +- samples/client/petstore/python-asyncio/docs/FakeApi.md | 4 ++-- .../client/petstore/python-asyncio/petstore_api/__init__.py | 2 +- .../petstore/python-asyncio/petstore_api/models/__init__.py | 2 +- .../client/petstore/python-tornado/.swagger-codegen/VERSION | 2 +- samples/client/petstore/python-tornado/docs/FakeApi.md | 4 ++-- .../client/petstore/python-tornado/petstore_api/__init__.py | 2 +- .../petstore/python-tornado/petstore_api/models/__init__.py | 2 +- samples/client/petstore/python/docs/FakeApi.md | 4 ++-- samples/client/petstore/python/petstore_api/__init__.py | 2 +- .../client/petstore/python/petstore_api/models/__init__.py | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly From d5eb69e371cbea7758b950c902a0fa5a548adb82 Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Fri, 20 Apr 2018 23:17:20 +0200 Subject: [PATCH 5/6] fix: tornado >= 5 is not supported yet --- .../swagger-codegen/src/main/resources/python/setup.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/python/setup.mustache b/modules/swagger-codegen/src/main/resources/python/setup.mustache index e7107e9be94..597136a8d15 100644 --- a/modules/swagger-codegen/src/main/resources/python/setup.mustache +++ b/modules/swagger-codegen/src/main/resources/python/setup.mustache @@ -21,7 +21,7 @@ REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] REQUIRES.append("aiohttp") {{/asyncio}} {{#tornado}} -REQUIRES.append("tornado") +REQUIRES.append("tornado>=4.2,<5") {{/tornado}} setup( From da360ac3dbdd049ab7e4cab5967994b76eed637a Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Sat, 21 Apr 2018 00:04:24 +0200 Subject: [PATCH 6/6] fix: python discriminator, add test --- .../src/main/resources/python/model.mustache | 2 +- .../python-asyncio/petstore_api/models/animal.py | 2 +- .../python-tornado/petstore_api/models/animal.py | 2 +- samples/client/petstore/python-tornado/setup.py | 2 +- .../petstore/python/petstore_api/models/animal.py | 2 +- .../petstore/python/tests/test_deserialization.py | 15 +++++++++++++++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index b9e0d124074..a1f084760e0 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -165,7 +165,7 @@ class {{classname}}(object): {{#discriminator}} def get_real_child_model(self, data): """Returns the real base class specified by the discriminator""" - discriminator_value = data[self.discriminator].lower() + discriminator_value = data[self.discriminator] return self.discriminator_value_class_map.get(discriminator_value) {{/discriminator}} diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/animal.py b/samples/client/petstore/python-asyncio/petstore_api/models/animal.py index 390ac83905e..f511021780a 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/animal.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/animal.py @@ -102,7 +102,7 @@ def color(self, color): def get_real_child_model(self, data): """Returns the real base class specified by the discriminator""" - discriminator_value = data[self.discriminator].lower() + discriminator_value = data[self.discriminator] return self.discriminator_value_class_map.get(discriminator_value) def to_dict(self): diff --git a/samples/client/petstore/python-tornado/petstore_api/models/animal.py b/samples/client/petstore/python-tornado/petstore_api/models/animal.py index 390ac83905e..f511021780a 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/animal.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/animal.py @@ -102,7 +102,7 @@ def color(self, color): def get_real_child_model(self, data): """Returns the real base class specified by the discriminator""" - discriminator_value = data[self.discriminator].lower() + discriminator_value = data[self.discriminator] return self.discriminator_value_class_map.get(discriminator_value) def to_dict(self): diff --git a/samples/client/petstore/python-tornado/setup.py b/samples/client/petstore/python-tornado/setup.py index ea0a40a1b06..2ee1fc71513 100644 --- a/samples/client/petstore/python-tornado/setup.py +++ b/samples/client/petstore/python-tornado/setup.py @@ -23,7 +23,7 @@ # http://pypi.python.org/pypi/setuptools REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] -REQUIRES.append("tornado") +REQUIRES.append("tornado>=4.2,<5") setup( name=NAME, diff --git a/samples/client/petstore/python/petstore_api/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py index 390ac83905e..f511021780a 100644 --- a/samples/client/petstore/python/petstore_api/models/animal.py +++ b/samples/client/petstore/python/petstore_api/models/animal.py @@ -102,7 +102,7 @@ def color(self, color): def get_real_child_model(self, data): """Returns the real base class specified by the discriminator""" - discriminator_value = data[self.discriminator].lower() + discriminator_value = data[self.discriminator] return self.discriminator_value_class_map.get(discriminator_value) def to_dict(self): diff --git a/samples/client/petstore/python/tests/test_deserialization.py b/samples/client/petstore/python/tests/test_deserialization.py index d7429dea416..2f4adeeb968 100644 --- a/samples/client/petstore/python/tests/test_deserialization.py +++ b/samples/client/petstore/python/tests/test_deserialization.py @@ -71,6 +71,21 @@ def test_deserialize_dict_str_pet(self): self.assertTrue(isinstance(deserialized, dict)) self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet)) + def test_deserialize_dict_str_dog(self): + """ deserialize dict(str, Dog) """ + data = { + 'dog': { + "id": 0, + "className": "Dog", + "color": "white", + "bread": "Jack Russel Terrier" + } + } + + deserialized = self.deserialize(data, 'dict(str, Animal)') + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized['dog'], petstore_api.Dog)) + def test_deserialize_dict_str_int(self): """ deserialize dict(str, int) """ data = {