diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java index eb3c65438ea9..1467060a88be 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java @@ -643,6 +643,11 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty p) { // fix ListContainers p.complexType = getPythonClassName(p.mostInnerItems.complexType); } + // if a model has a property that is of type self, remove the module name from the dataType + if (p.complexType != null && p.dataType.contains(model.classname)) { + String classNameNoModule = getPythonClassName(model.classname); + p.dataType = p.dataType.replace(model.classname, classNameNoModule); + } } @Override @@ -753,6 +758,10 @@ public CodegenModel fromModel(String name, Schema schema) { result.imports.add(modelName); } } + // if a class has a property of type self, remove the self import from imports + if (result.imports.contains(result.classname)) { + result.imports.remove(result.classname); + } return result; } diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache index fcd8a71fd124..60fff484ef40 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache @@ -29,15 +29,6 @@ {{/optionalVars}} } - openapi_types = { -{{#requiredVars}} - '{{name}}': ({{{dataType}}},), # noqa: E501 -{{/requiredVars}} -{{#optionalVars}} - '{{name}}': ({{{dataType}}},), # noqa: E501 -{{/optionalVars}} - } - validations = { {{#requiredVars}} {{#hasValidation}} @@ -103,6 +94,25 @@ additional_properties_type = {{#additionalPropertiesType}}({{{additionalPropertiesType}}},) # noqa: E501{{/additionalPropertiesType}}{{^additionalPropertiesType}}None{{/additionalPropertiesType}} + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { +{{#requiredVars}} + '{{name}}': ({{{dataType}}},), # noqa: E501 +{{/requiredVars}} +{{#optionalVars}} + '{{name}}': ({{{dataType}}},), # noqa: E501 +{{/optionalVars}} + } + @staticmethod def discriminator(): return {{^discriminator}}None{{/discriminator}}{{#discriminator}}{ diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/docstring_openapi_validations.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/docstring_openapi_validations.mustache index 03eec953f378..f933b86c5b9d 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/docstring_openapi_validations.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/docstring_openapi_validations.mustache @@ -1,5 +1,3 @@ - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache index f4a36e42f25b..bcafb71368f1 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache @@ -6,8 +6,9 @@ path_to_item.extend(self._path_to_item) path_to_item.append(name) - if name in self.openapi_types: - required_types_mixed = self.openapi_types[name] + openapi_types = self.openapi_types() + if name in openapi_types: + required_types_mixed = openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache index dbd592c37e8f..c3d9e7d53629 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache @@ -928,7 +928,7 @@ def get_allof_instances(self, model_args, constant_args): # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(allof_class.openapi_types.keys()) + var_names = set(allof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -963,7 +963,7 @@ def get_oneof_instance(self, model_args, constant_args): # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(oneof_class.openapi_types.keys()) + var_names = set(oneof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1006,7 +1006,7 @@ def get_anyof_instances(self, model_args, constant_args): # extract a dict of only required keys from these_model_vars kwargs = {} - var_names = set(anyof_class.openapi_types.keys()) + var_names = set(anyof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1043,7 +1043,7 @@ def get_var_name_to_model_instances(self, composed_instances): all_instances = [self] all_instances.extend(composed_instances) for instance in all_instances: - for var_name in instance.openapi_types: + for var_name in instance.openapi_types(): if var_name not in var_name_to_model_instances: var_name_to_model_instances[var_name] = [instance] else: diff --git a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml index fa1bdfe009c6..ee41ff46ba87 100644 --- a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1341,6 +1341,16 @@ definitions: properties: _class: type: string + Player: + type: object + required: + - name + properties: + name: + type: string + enemyPlayer: + type: object + $ref: '#/components/schemas/Player' Dog: allOf: - $ref: '#/definitions/Animal' diff --git a/samples/client/petstore/python-experimental/README.md b/samples/client/petstore/python-experimental/README.md index ffffbf80eb0e..b1d65b496d6a 100644 --- a/samples/client/petstore/python-experimental/README.md +++ b/samples/client/petstore/python-experimental/README.md @@ -167,6 +167,7 @@ Class | Method | HTTP request | Description - [parent_all_of.ParentAllOf](docs/ParentAllOf.md) - [parent_pet.ParentPet](docs/ParentPet.md) - [pet.Pet](docs/Pet.md) + - [player.Player](docs/Player.md) - [read_only_first.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [special_model_name.SpecialModelName](docs/SpecialModelName.md) - [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md) diff --git a/samples/client/petstore/python-experimental/docs/Player.md b/samples/client/petstore/python-experimental/docs/Player.md new file mode 100644 index 000000000000..34adf5302a00 --- /dev/null +++ b/samples/client/petstore/python-experimental/docs/Player.md @@ -0,0 +1,11 @@ +# player.Player + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**enemy_player** | [**Player**](Player.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-experimental/petstore_api/__init__.py b/samples/client/petstore/python-experimental/petstore_api/__init__.py index 4b47774e2fd8..445bf2409aee 100644 --- a/samples/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/__init__.py @@ -91,6 +91,7 @@ from petstore_api.models.parent_all_of import ParentAllOf from petstore_api.models.parent_pet import ParentPet from petstore_api.models.pet import Pet +from petstore_api.models.player import Player from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName from petstore_api.models.string_boolean_map import StringBooleanMap diff --git a/samples/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/client/petstore/python-experimental/petstore_api/model_utils.py index 5deb24585396..6d6a88edb7eb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -54,8 +54,9 @@ def set_attribute(self, name, value): path_to_item.extend(self._path_to_item) path_to_item.append(name) - if name in self.openapi_types: - required_types_mixed = self.openapi_types[name] + openapi_types = self.openapi_types() + if name in openapi_types: + required_types_mixed = openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), @@ -1181,7 +1182,7 @@ def get_allof_instances(self, model_args, constant_args): # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(allof_class.openapi_types.keys()) + var_names = set(allof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1216,7 +1217,7 @@ def get_oneof_instance(self, model_args, constant_args): # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(oneof_class.openapi_types.keys()) + var_names = set(oneof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1259,7 +1260,7 @@ def get_anyof_instances(self, model_args, constant_args): # extract a dict of only required keys from these_model_vars kwargs = {} - var_names = set(anyof_class.openapi_types.keys()) + var_names = set(anyof_class.openapi_types().keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1296,7 +1297,7 @@ def get_var_name_to_model_instances(self, composed_instances): all_instances = [self] all_instances.extend(composed_instances) for instance in all_instances: - for var_name in instance.openapi_types: + for var_name in instance.openapi_types(): if var_name not in var_name_to_model_instances: var_name_to_model_instances[var_name] = [instance] else: diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py index e3bdd37fcc98..c9e1d7389dd0 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py @@ -45,8 +45,6 @@ class AdditionalPropertiesAnyType(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesAnyType(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = (bool, date, datetime, dict, float, int, list, str,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py index 12f228e9ba9d..340e63892700 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py @@ -45,8 +45,6 @@ class AdditionalPropertiesArray(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesArray(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = ([bool, date, datetime, dict, float, int, list, str],) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py index ed37ef90c4f6..78f9ac1bb6dc 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py @@ -45,8 +45,6 @@ class AdditionalPropertiesBoolean(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesBoolean(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = (bool,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index 3f34d95684b1..2f0d79a79936 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -45,8 +45,6 @@ class AdditionalPropertiesClass(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,25 +57,35 @@ class AdditionalPropertiesClass(ModelNormal): allowed_values = { } - openapi_types = { - 'map_string': ({str: (str,)},), # noqa: E501 - 'map_number': ({str: (float,)},), # noqa: E501 - 'map_integer': ({str: (int,)},), # noqa: E501 - 'map_boolean': ({str: (bool,)},), # noqa: E501 - 'map_array_integer': ({str: ([int],)},), # noqa: E501 - 'map_array_anytype': ({str: ([bool, date, datetime, dict, float, int, list, str],)},), # noqa: E501 - 'map_map_string': ({str: ({str: (str,)},)},), # noqa: E501 - 'map_map_anytype': ({str: ({str: (bool, date, datetime, dict, float, int, list, str,)},)},), # noqa: E501 - 'anytype_1': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 - 'anytype_2': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 - 'anytype_3': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'map_string': ({str: (str,)},), # noqa: E501 + 'map_number': ({str: (float,)},), # noqa: E501 + 'map_integer': ({str: (int,)},), # noqa: E501 + 'map_boolean': ({str: (bool,)},), # noqa: E501 + 'map_array_integer': ({str: ([int],)},), # noqa: E501 + 'map_array_anytype': ({str: ([bool, date, datetime, dict, float, int, list, str],)},), # noqa: E501 + 'map_map_string': ({str: ({str: (str,)},)},), # noqa: E501 + 'map_map_anytype': ({str: ({str: (bool, date, datetime, dict, float, int, list, str,)},)},), # noqa: E501 + 'anytype_1': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 + 'anytype_2': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 + 'anytype_3': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py index 653350f6b55d..b716a6ec6cd3 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py @@ -45,8 +45,6 @@ class AdditionalPropertiesInteger(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesInteger(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = (int,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py index e6d75b406361..17b717ebf0bb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py @@ -45,8 +45,6 @@ class AdditionalPropertiesNumber(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesNumber(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = (float,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py index a3cb690eb769..8bd9c9e0853e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py @@ -45,8 +45,6 @@ class AdditionalPropertiesObject(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesObject(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = ({str: (bool, date, datetime, dict, float, int, list, str,)},) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py index 1611d7c64081..20180ba810d8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py @@ -45,8 +45,6 @@ class AdditionalPropertiesString(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class AdditionalPropertiesString(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = (str,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/models/animal.py index 106bf5e7649e..2da7a5923a5b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -53,8 +53,6 @@ class Animal(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class Animal(ModelNormal): allowed_values = { } - openapi_types = { - 'class_name': (str,), # noqa: E501 - 'color': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'class_name': (str,), # noqa: E501 + 'color': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return { diff --git a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py index e7516d6c7590..cc3d2cea4424 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -45,8 +45,6 @@ class ApiResponse(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,17 +57,27 @@ class ApiResponse(ModelNormal): allowed_values = { } - openapi_types = { - 'code': (int,), # noqa: E501 - 'type': (str,), # noqa: E501 - 'message': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'code': (int,), # noqa: E501 + 'type': (str,), # noqa: E501 + 'message': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index 76165622532e..3c0175acdd81 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -45,8 +45,6 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): allowed_values = { } - openapi_types = { - 'array_array_number': ([[float]],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'array_array_number': ([[float]],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index 165e0eed8192..28bacd7021d8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -45,8 +45,6 @@ class ArrayOfNumberOnly(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ArrayOfNumberOnly(ModelNormal): allowed_values = { } - openapi_types = { - 'array_number': ([float],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'array_number': ([float],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py index 72418960f571..3c15d79a3d01 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -49,8 +49,6 @@ class ArrayTest(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -63,17 +61,27 @@ class ArrayTest(ModelNormal): allowed_values = { } - openapi_types = { - 'array_of_string': ([str],), # noqa: E501 - 'array_array_of_integer': ([[int]],), # noqa: E501 - 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'array_of_string': ([str],), # noqa: E501 + 'array_array_of_integer': ([[int]],), # noqa: E501 + 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py index a25472b19da3..8311ed65ba20 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -45,8 +45,6 @@ class Capitalization(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,20 +57,30 @@ class Capitalization(ModelNormal): allowed_values = { } - openapi_types = { - 'small_camel': (str,), # noqa: E501 - 'capital_camel': (str,), # noqa: E501 - 'small_snake': (str,), # noqa: E501 - 'capital_snake': (str,), # noqa: E501 - 'sca_eth_flow_points': (str,), # noqa: E501 - 'att_name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'small_camel': (str,), # noqa: E501 + 'capital_camel': (str,), # noqa: E501 + 'small_snake': (str,), # noqa: E501 + 'capital_snake': (str,), # noqa: E501 + 'sca_eth_flow_points': (str,), # noqa: E501 + 'att_name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/models/cat.py index fc9ab76fbfda..6b4985dc4a9b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -53,8 +53,6 @@ class Cat(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,17 +65,27 @@ class Cat(ModelComposed): allowed_values = { } - openapi_types = { - 'class_name': (str,), # noqa: E501 - 'declawed': (bool,), # noqa: E501 - 'color': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'class_name': (str,), # noqa: E501 + 'declawed': (bool,), # noqa: E501 + 'color': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 4e4c87e90d42..00b0cfae654b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -45,8 +45,6 @@ class CatAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class CatAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'declawed': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'declawed': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/category.py b/samples/client/petstore/python-experimental/petstore_api/models/category.py index 08c3e8aad969..2530a19b2f32 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/category.py @@ -45,8 +45,6 @@ class Category(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,16 +57,26 @@ class Category(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - 'id': (int,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + 'id': (int,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child.py b/samples/client/petstore/python-experimental/petstore_api/models/child.py index 7e5e332f0088..8a61f35ba14b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child.py @@ -53,8 +53,6 @@ class Child(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,17 +65,27 @@ class Child(ModelComposed): allowed_values = { } - openapi_types = { - 'radio_waves': (bool,), # noqa: E501 - 'tele_vision': (bool,), # noqa: E501 - 'inter_net': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'radio_waves': (bool,), # noqa: E501 + 'tele_vision': (bool,), # noqa: E501 + 'inter_net': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py index 3cb28139b174..f52720359c05 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py @@ -45,8 +45,6 @@ class ChildAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ChildAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'inter_net': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'inter_net': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py index 58c0318faf0f..b329281e9c25 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py @@ -53,8 +53,6 @@ class ChildCat(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class ChildCat(ModelComposed): allowed_values = { } - openapi_types = { - 'pet_type': (str,), # noqa: E501 - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'pet_type': (str,), # noqa: E501 + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py index de70d839cf28..1870b3ff31fe 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py @@ -45,8 +45,6 @@ class ChildCatAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ChildCatAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py index 450e6983fca5..eaea5cba93c8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py @@ -53,8 +53,6 @@ class ChildDog(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class ChildDog(ModelComposed): allowed_values = { } - openapi_types = { - 'pet_type': (str,), # noqa: E501 - 'bark': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'pet_type': (str,), # noqa: E501 + 'bark': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py index 37d900f2c2be..edc47f75b49e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py @@ -45,8 +45,6 @@ class ChildDogAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ChildDogAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'bark': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'bark': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py index 169d05b51364..a038974bb543 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py @@ -53,8 +53,6 @@ class ChildLizard(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class ChildLizard(ModelComposed): allowed_values = { } - openapi_types = { - 'pet_type': (str,), # noqa: E501 - 'loves_rocks': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'pet_type': (str,), # noqa: E501 + 'loves_rocks': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py index 6b6f8d99279d..00eb13609317 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py @@ -45,8 +45,6 @@ class ChildLizardAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ChildLizardAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'loves_rocks': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'loves_rocks': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py index 4f6fd3bca5e5..f268d8576d59 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -45,8 +45,6 @@ class ClassModel(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ClassModel(ModelNormal): allowed_values = { } - openapi_types = { - '_class': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + '_class': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/client.py b/samples/client/petstore/python-experimental/petstore_api/models/client.py index 398d1b7ce0d6..1097c624d729 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/client.py @@ -45,8 +45,6 @@ class Client(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class Client(ModelNormal): allowed_values = { } - openapi_types = { - 'client': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'client': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/models/dog.py index f27e858b4c14..54ccf0e390ab 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -53,8 +53,6 @@ class Dog(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,17 +65,27 @@ class Dog(ModelComposed): allowed_values = { } - openapi_types = { - 'class_name': (str,), # noqa: E501 - 'breed': (str,), # noqa: E501 - 'color': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'class_name': (str,), # noqa: E501 + 'breed': (str,), # noqa: E501 + 'color': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index 18e9270a4c6b..316ec102b91d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -45,8 +45,6 @@ class DogAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class DogAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'breed': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'breed': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index 167f573d4521..d997d53fac7a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -45,8 +45,6 @@ class EnumArrays(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class EnumArrays(ModelNormal): }, } - openapi_types = { - 'just_symbol': (str,), # noqa: E501 - 'array_enum': ([str],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'just_symbol': (str,), # noqa: E501 + 'array_enum': ([str],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py index b80116abce16..bda8183ce786 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -41,8 +41,6 @@ class EnumClass(ModelSimple): and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -60,15 +58,25 @@ class EnumClass(ModelSimple): }, } - openapi_types = { - 'value': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py index c7bef7cc3200..5df1bcbc2e7d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -49,8 +49,6 @@ class EnumTest(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -81,19 +79,29 @@ class EnumTest(ModelNormal): }, } - openapi_types = { - 'enum_string_required': (str,), # noqa: E501 - 'enum_string': (str,), # noqa: E501 - 'enum_integer': (int,), # noqa: E501 - 'enum_number': (float,), # noqa: E501 - 'outer_enum': (outer_enum.OuterEnum,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'enum_string_required': (str,), # noqa: E501 + 'enum_string': (str,), # noqa: E501 + 'enum_integer': (int,), # noqa: E501 + 'enum_number': (float,), # noqa: E501 + 'outer_enum': (outer_enum.OuterEnum,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file.py b/samples/client/petstore/python-experimental/petstore_api/models/file.py index eb71f20abb36..ecc56b0cd005 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file.py @@ -45,8 +45,6 @@ class File(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class File(ModelNormal): allowed_values = { } - openapi_types = { - 'source_uri': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'source_uri': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index b612ecf317c8..62a9a4194a18 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -49,8 +49,6 @@ class FileSchemaTestClass(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -63,16 +61,26 @@ class FileSchemaTestClass(ModelNormal): allowed_values = { } - openapi_types = { - 'file': (file.File,), # noqa: E501 - 'files': ([file.File],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'file': (file.File,), # noqa: E501 + 'files': ([file.File],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py index 7b455ece510c..7646127e37ac 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -45,8 +45,6 @@ class FormatTest(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,22 +57,6 @@ class FormatTest(ModelNormal): allowed_values = { } - openapi_types = { - 'number': (float,), # noqa: E501 - 'byte': (str,), # noqa: E501 - 'date': (date,), # noqa: E501 - 'password': (str,), # noqa: E501 - 'integer': (int,), # noqa: E501 - 'int32': (int,), # noqa: E501 - 'int64': (int,), # noqa: E501 - 'float': (float,), # noqa: E501 - 'double': (float,), # noqa: E501 - 'string': (str,), # noqa: E501 - 'binary': (file_type,), # noqa: E501 - 'date_time': (datetime,), # noqa: E501 - 'uuid': (str,), # noqa: E501 - } - validations = { ('number',): { 'inclusive_maximum': 543.2, @@ -115,6 +97,32 @@ class FormatTest(ModelNormal): additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'number': (float,), # noqa: E501 + 'byte': (str,), # noqa: E501 + 'date': (date,), # noqa: E501 + 'password': (str,), # noqa: E501 + 'integer': (int,), # noqa: E501 + 'int32': (int,), # noqa: E501 + 'int64': (int,), # noqa: E501 + 'float': (float,), # noqa: E501 + 'double': (float,), # noqa: E501 + 'string': (str,), # noqa: E501 + 'binary': (file_type,), # noqa: E501 + 'date_time': (datetime,), # noqa: E501 + 'uuid': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py index 26bae108ad1e..36ec14bf408a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py @@ -45,8 +45,6 @@ class Grandparent(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class Grandparent(ModelNormal): allowed_values = { } - openapi_types = { - 'radio_waves': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'radio_waves': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py index 5d99b80c162c..c089ebf9bc05 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py @@ -45,8 +45,6 @@ class GrandparentAnimal(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class GrandparentAnimal(ModelNormal): allowed_values = { } - openapi_types = { - 'pet_type': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'pet_type': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index 593a6280d3db..90c4908aa898 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -45,8 +45,6 @@ class HasOnlyReadOnly(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,16 +57,26 @@ class HasOnlyReadOnly(ModelNormal): allowed_values = { } - openapi_types = { - 'bar': (str,), # noqa: E501 - 'foo': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'bar': (str,), # noqa: E501 + 'foo': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/list.py b/samples/client/petstore/python-experimental/petstore_api/models/list.py index 362ac90e2c92..e6816fb51a0d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/list.py @@ -45,8 +45,6 @@ class List(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class List(ModelNormal): allowed_values = { } - openapi_types = { - '_123_list': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + '_123_list': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py index 475332634ab2..e6680cc73493 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -49,8 +49,6 @@ class MapTest(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,18 +65,28 @@ class MapTest(ModelNormal): }, } - openapi_types = { - 'map_map_of_string': ({str: ({str: (str,)},)},), # noqa: E501 - 'map_of_enum_string': ({str: (str,)},), # noqa: E501 - 'direct_map': ({str: (bool,)},), # noqa: E501 - 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'map_map_of_string': ({str: ({str: (str,)},)},), # noqa: E501 + 'map_of_enum_string': ({str: (str,)},), # noqa: E501 + 'direct_map': ({str: (bool,)},), # noqa: E501 + 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index a88a56b5cf55..52969b942bfa 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -49,8 +49,6 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -63,17 +61,27 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): allowed_values = { } - openapi_types = { - 'uuid': (str,), # noqa: E501 - 'date_time': (datetime,), # noqa: E501 - 'map': ({str: (animal.Animal,)},), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'uuid': (str,), # noqa: E501 + 'date_time': (datetime,), # noqa: E501 + 'map': ({str: (animal.Animal,)},), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py index 1fabb5e9b50a..cdfb0db9d60a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -45,8 +45,6 @@ class Model200Response(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,16 +57,26 @@ class Model200Response(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (int,), # noqa: E501 - '_class': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (int,), # noqa: E501 + '_class': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py index 3466f9d2e691..a145f8e706cc 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -45,8 +45,6 @@ class ModelReturn(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ModelReturn(ModelNormal): allowed_values = { } - openapi_types = { - '_return': (int,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + '_return': (int,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/name.py b/samples/client/petstore/python-experimental/petstore_api/models/name.py index 39f9a4719daf..e3b0378bab68 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/name.py @@ -45,8 +45,6 @@ class Name(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,18 +57,28 @@ class Name(ModelNormal): allowed_values = { } - openapi_types = { - 'name': (int,), # noqa: E501 - 'snake_case': (int,), # noqa: E501 - '_property': (str,), # noqa: E501 - '_123_number': (int,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (int,), # noqa: E501 + 'snake_case': (int,), # noqa: E501 + '_property': (str,), # noqa: E501 + '_123_number': (int,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py index 96c03cef11dc..6a30356c5e92 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -45,8 +45,6 @@ class NumberOnly(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class NumberOnly(ModelNormal): allowed_values = { } - openapi_types = { - 'just_number': (float,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'just_number': (float,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/order.py b/samples/client/petstore/python-experimental/petstore_api/models/order.py index ad4e10f0b042..6e4e8af79faf 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/order.py @@ -45,8 +45,6 @@ class Order(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -64,20 +62,30 @@ class Order(ModelNormal): }, } - openapi_types = { - 'id': (int,), # noqa: E501 - 'pet_id': (int,), # noqa: E501 - 'quantity': (int,), # noqa: E501 - 'ship_date': (datetime,), # noqa: E501 - 'status': (str,), # noqa: E501 - 'complete': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'id': (int,), # noqa: E501 + 'pet_id': (int,), # noqa: E501 + 'quantity': (int,), # noqa: E501 + 'ship_date': (datetime,), # noqa: E501 + 'status': (str,), # noqa: E501 + 'complete': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py index 6ad00966eae6..013e386adff8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -49,8 +49,6 @@ class OuterComposite(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -63,17 +61,27 @@ class OuterComposite(ModelNormal): allowed_values = { } - openapi_types = { - 'my_number': (outer_number.OuterNumber,), # noqa: E501 - 'my_string': (str,), # noqa: E501 - 'my_boolean': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'my_number': (outer_number.OuterNumber,), # noqa: E501 + 'my_string': (str,), # noqa: E501 + 'my_boolean': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py index 39b104f64271..fb040a6785a9 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -41,8 +41,6 @@ class OuterEnum(ModelSimple): and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -60,15 +58,25 @@ class OuterEnum(ModelSimple): }, } - openapi_types = { - 'value': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py index 362a3cf1fc51..1ff253f826dd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py @@ -41,8 +41,6 @@ class OuterNumber(ModelSimple): and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -55,10 +53,6 @@ class OuterNumber(ModelSimple): allowed_values = { } - openapi_types = { - 'value': (float,), # noqa: E501 - } - validations = { ('value',): { 'inclusive_maximum': 2E+1, @@ -68,6 +62,20 @@ class OuterNumber(ModelSimple): additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (float,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent.py b/samples/client/petstore/python-experimental/petstore_api/models/parent.py index d07ca49d4de1..4175d7792f63 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent.py @@ -53,8 +53,6 @@ class Parent(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -67,16 +65,26 @@ class Parent(ModelComposed): allowed_values = { } - openapi_types = { - 'radio_waves': (bool,), # noqa: E501 - 'tele_vision': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'radio_waves': (bool,), # noqa: E501 + 'tele_vision': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py index 0cfcbda855d5..1842c83edb29 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py @@ -45,8 +45,6 @@ class ParentAllOf(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class ParentAllOf(ModelNormal): allowed_values = { } - openapi_types = { - 'tele_vision': (bool,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'tele_vision': (bool,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py index 59b890e89142..d98bdc6f6570 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py @@ -61,8 +61,6 @@ class ParentPet(ModelComposed): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -75,15 +73,25 @@ class ParentPet(ModelComposed): allowed_values = { } - openapi_types = { - 'pet_type': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'pet_type': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return { diff --git a/samples/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/client/petstore/python-experimental/petstore_api/models/pet.py index 081be0210e60..83b4679eb7a3 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/pet.py @@ -53,8 +53,6 @@ class Pet(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -72,20 +70,30 @@ class Pet(ModelNormal): }, } - openapi_types = { - 'name': (str,), # noqa: E501 - 'photo_urls': ([str],), # noqa: E501 - 'id': (int,), # noqa: E501 - 'category': (category.Category,), # noqa: E501 - 'tags': ([tag.Tag],), # noqa: E501 - 'status': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + 'photo_urls': ([str],), # noqa: E501 + 'id': (int,), # noqa: E501 + 'category': (category.Category,), # noqa: E501 + 'tags': ([tag.Tag],), # noqa: E501 + 'status': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/models/player.py new file mode 100644 index 000000000000..75b3ca337674 --- /dev/null +++ b/samples/client/petstore/python-experimental/petstore_api/models/player.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class Player(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str,), # noqa: E501 + 'enemy_player': (Player,), # noqa: E501 + } + + @staticmethod + def discriminator(): + return None + + attribute_map = { + 'name': 'name', # noqa: E501 + 'enemy_player': 'enemyPlayer', # noqa: E501 + } + + @staticmethod + def _composed_schemas(): + return None + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + ]) + + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + """player.Player - a model defined in OpenAPI + + Args: + name (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + enemy_player (Player): [optional] # noqa: E501 + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + + self.name = name + for var_name, var_value in six.iteritems(kwargs): + setattr(self, var_name, var_value) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 71ca20529129..d2239f91920d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -45,8 +45,6 @@ class ReadOnlyFirst(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,16 +57,26 @@ class ReadOnlyFirst(ModelNormal): allowed_values = { } - openapi_types = { - 'bar': (str,), # noqa: E501 - 'baz': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'bar': (str,), # noqa: E501 + 'baz': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py index 574c3817d786..607ddacbc056 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -45,8 +45,6 @@ class SpecialModelName(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,15 +57,25 @@ class SpecialModelName(ModelNormal): allowed_values = { } - openapi_types = { - 'special_property_name': (int,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'special_property_name': (int,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py index 19b3cd131c08..a5425b412aca 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py @@ -45,8 +45,6 @@ class StringBooleanMap(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,14 +57,24 @@ class StringBooleanMap(ModelNormal): allowed_values = { } - openapi_types = { - } - validations = { } additional_properties_type = (bool,) # noqa: E501 + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/client/petstore/python-experimental/petstore_api/models/tag.py index 590b234d4d42..fe8f0cc3540c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/tag.py @@ -45,8 +45,6 @@ class Tag(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,17 +57,27 @@ class Tag(ModelNormal): allowed_values = { } - openapi_types = { - 'id': (int,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'full_name': (str,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'id': (int,), # noqa: E501 + 'name': (str,), # noqa: E501 + 'full_name': (str,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py index 71b4719f5dd0..da0ca9ea9869 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py @@ -45,8 +45,6 @@ class TypeHolderDefault(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,21 +57,31 @@ class TypeHolderDefault(ModelNormal): allowed_values = { } - openapi_types = { - 'string_item': (str,), # noqa: E501 - 'number_item': (float,), # noqa: E501 - 'integer_item': (int,), # noqa: E501 - 'bool_item': (bool,), # noqa: E501 - 'array_item': ([int],), # noqa: E501 - 'date_item': (date,), # noqa: E501 - 'datetime_item': (datetime,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'string_item': (str,), # noqa: E501 + 'number_item': (float,), # noqa: E501 + 'integer_item': (int,), # noqa: E501 + 'bool_item': (bool,), # noqa: E501 + 'array_item': ([int],), # noqa: E501 + 'date_item': (date,), # noqa: E501 + 'datetime_item': (datetime,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py index 96b8551dd1a5..1b8c16398677 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py @@ -45,8 +45,6 @@ class TypeHolderExample(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -68,19 +66,29 @@ class TypeHolderExample(ModelNormal): }, } - openapi_types = { - 'string_item': (str,), # noqa: E501 - 'number_item': (float,), # noqa: E501 - 'integer_item': (int,), # noqa: E501 - 'bool_item': (bool,), # noqa: E501 - 'array_item': ([int],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'string_item': (str,), # noqa: E501 + 'number_item': (float,), # noqa: E501 + 'integer_item': (int,), # noqa: E501 + 'bool_item': (bool,), # noqa: E501 + 'array_item': ([int],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/user.py b/samples/client/petstore/python-experimental/petstore_api/models/user.py index 03b3ef6a5e69..62c3bd48a16a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/user.py @@ -45,8 +45,6 @@ class User(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,22 +57,32 @@ class User(ModelNormal): allowed_values = { } - openapi_types = { - 'id': (int,), # noqa: E501 - 'username': (str,), # noqa: E501 - 'first_name': (str,), # noqa: E501 - 'last_name': (str,), # noqa: E501 - 'email': (str,), # noqa: E501 - 'password': (str,), # noqa: E501 - 'phone': (str,), # noqa: E501 - 'user_status': (int,), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'id': (int,), # noqa: E501 + 'username': (str,), # noqa: E501 + 'first_name': (str,), # noqa: E501 + 'last_name': (str,), # noqa: E501 + 'email': (str,), # noqa: E501 + 'password': (str,), # noqa: E501 + 'phone': (str,), # noqa: E501 + 'user_status': (int,), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py index a38afa9cfbec..8b5096a4bd9b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py @@ -45,8 +45,6 @@ class XmlItem(ModelNormal): and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. - openapi_types (dict): The key is attribute name - and the value is attribute type. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, @@ -59,43 +57,53 @@ class XmlItem(ModelNormal): allowed_values = { } - openapi_types = { - 'attribute_string': (str,), # noqa: E501 - 'attribute_number': (float,), # noqa: E501 - 'attribute_integer': (int,), # noqa: E501 - 'attribute_boolean': (bool,), # noqa: E501 - 'wrapped_array': ([int],), # noqa: E501 - 'name_string': (str,), # noqa: E501 - 'name_number': (float,), # noqa: E501 - 'name_integer': (int,), # noqa: E501 - 'name_boolean': (bool,), # noqa: E501 - 'name_array': ([int],), # noqa: E501 - 'name_wrapped_array': ([int],), # noqa: E501 - 'prefix_string': (str,), # noqa: E501 - 'prefix_number': (float,), # noqa: E501 - 'prefix_integer': (int,), # noqa: E501 - 'prefix_boolean': (bool,), # noqa: E501 - 'prefix_array': ([int],), # noqa: E501 - 'prefix_wrapped_array': ([int],), # noqa: E501 - 'namespace_string': (str,), # noqa: E501 - 'namespace_number': (float,), # noqa: E501 - 'namespace_integer': (int,), # noqa: E501 - 'namespace_boolean': (bool,), # noqa: E501 - 'namespace_array': ([int],), # noqa: E501 - 'namespace_wrapped_array': ([int],), # noqa: E501 - 'prefix_ns_string': (str,), # noqa: E501 - 'prefix_ns_number': (float,), # noqa: E501 - 'prefix_ns_integer': (int,), # noqa: E501 - 'prefix_ns_boolean': (bool,), # noqa: E501 - 'prefix_ns_array': ([int],), # noqa: E501 - 'prefix_ns_wrapped_array': ([int],), # noqa: E501 - } - validations = { } additional_properties_type = None + @staticmethod + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'attribute_string': (str,), # noqa: E501 + 'attribute_number': (float,), # noqa: E501 + 'attribute_integer': (int,), # noqa: E501 + 'attribute_boolean': (bool,), # noqa: E501 + 'wrapped_array': ([int],), # noqa: E501 + 'name_string': (str,), # noqa: E501 + 'name_number': (float,), # noqa: E501 + 'name_integer': (int,), # noqa: E501 + 'name_boolean': (bool,), # noqa: E501 + 'name_array': ([int],), # noqa: E501 + 'name_wrapped_array': ([int],), # noqa: E501 + 'prefix_string': (str,), # noqa: E501 + 'prefix_number': (float,), # noqa: E501 + 'prefix_integer': (int,), # noqa: E501 + 'prefix_boolean': (bool,), # noqa: E501 + 'prefix_array': ([int],), # noqa: E501 + 'prefix_wrapped_array': ([int],), # noqa: E501 + 'namespace_string': (str,), # noqa: E501 + 'namespace_number': (float,), # noqa: E501 + 'namespace_integer': (int,), # noqa: E501 + 'namespace_boolean': (bool,), # noqa: E501 + 'namespace_array': ([int],), # noqa: E501 + 'namespace_wrapped_array': ([int],), # noqa: E501 + 'prefix_ns_string': (str,), # noqa: E501 + 'prefix_ns_number': (float,), # noqa: E501 + 'prefix_ns_integer': (int,), # noqa: E501 + 'prefix_ns_boolean': (bool,), # noqa: E501 + 'prefix_ns_array': ([int],), # noqa: E501 + 'prefix_ns_wrapped_array': ([int],), # noqa: E501 + } + @staticmethod def discriminator(): return None diff --git a/samples/client/petstore/python-experimental/test/test_player.py b/samples/client/petstore/python-experimental/test/test_player.py new file mode 100644 index 000000000000..b100dd798943 --- /dev/null +++ b/samples/client/petstore/python-experimental/test/test_player.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestPlayer(unittest.TestCase): + """Player unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPlayer(self): + """Test Player""" + # we can make a player without an enemy_player property + jane = petstore_api.Player(name="Jane") + # we can make a player with an enemy_player + sally = petstore_api.Player(name="Sally", enemy_player=jane) + # we can make a player with an inline enemy_player + jim = petstore_api.Player( + name="Jim", + enemy_player=petstore_api.Player(name="Sam") + ) + + +if __name__ == '__main__': + unittest.main()