From 326524d7e1cdd2999590d73b21504b3c22dd6de4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sat, 4 Apr 2020 19:43:51 -0700 Subject: [PATCH 1/8] Adds cached_property decorator, adds feature to move through n discriminators --- .../python/python-experimental/model.mustache | 3 + .../model_templates/classvars.mustache | 4 +- .../method_discriminator.mustache | 6 +- .../method_init_composed.mustache | 2 + .../method_init_normal.mustache | 1 + .../method_init_shared.mustache | 21 ++- .../method_set_attribute.mustache | 5 +- .../model_templates/model_composed.mustache | 2 +- .../model_templates/model_normal.mustache | 4 +- .../model_templates/model_simple.mustache | 4 +- .../python-experimental/model_utils.mustache | 153 +++++++++++------ .../petstore_api/model_utils.py | 158 +++++++++++------- .../models/additional_properties_any_type.py | 31 +++- .../models/additional_properties_array.py | 31 +++- .../models/additional_properties_boolean.py | 31 +++- .../models/additional_properties_class.py | 31 +++- .../models/additional_properties_integer.py | 31 +++- .../models/additional_properties_number.py | 31 +++- .../models/additional_properties_object.py | 31 +++- .../models/additional_properties_string.py | 31 +++- .../petstore_api/models/animal.py | 37 +++- .../petstore_api/models/api_response.py | 31 +++- .../models/array_of_array_of_number_only.py | 31 +++- .../models/array_of_number_only.py | 31 +++- .../petstore_api/models/array_test.py | 31 +++- .../petstore_api/models/capitalization.py | 31 +++- .../petstore_api/models/cat.py | 36 +++- .../petstore_api/models/cat_all_of.py | 31 +++- .../petstore_api/models/category.py | 31 +++- .../petstore_api/models/child.py | 30 +++- .../petstore_api/models/child_all_of.py | 31 +++- .../petstore_api/models/child_cat.py | 36 +++- .../petstore_api/models/child_cat_all_of.py | 31 +++- .../petstore_api/models/child_dog.py | 36 +++- .../petstore_api/models/child_dog_all_of.py | 31 +++- .../petstore_api/models/child_lizard.py | 36 +++- .../models/child_lizard_all_of.py | 31 +++- .../petstore_api/models/class_model.py | 31 +++- .../petstore_api/models/client.py | 31 +++- .../petstore_api/models/dog.py | 36 +++- .../petstore_api/models/dog_all_of.py | 31 +++- .../petstore_api/models/enum_arrays.py | 31 +++- .../petstore_api/models/enum_class.py | 31 +++- .../petstore_api/models/enum_test.py | 31 +++- .../petstore_api/models/file.py | 31 +++- .../models/file_schema_test_class.py | 31 +++- .../petstore_api/models/format_test.py | 31 +++- .../petstore_api/models/grandparent.py | 31 +++- .../petstore_api/models/grandparent_animal.py | 37 +++- .../petstore_api/models/has_only_read_only.py | 31 +++- .../petstore_api/models/list.py | 31 +++- .../petstore_api/models/map_test.py | 31 +++- ...perties_and_additional_properties_class.py | 31 +++- .../petstore_api/models/model200_response.py | 31 +++- .../petstore_api/models/model_return.py | 31 +++- .../petstore_api/models/name.py | 31 +++- .../petstore_api/models/number_only.py | 31 +++- .../petstore_api/models/order.py | 31 +++- .../petstore_api/models/outer_composite.py | 31 +++- .../petstore_api/models/outer_enum.py | 31 +++- .../petstore_api/models/outer_number.py | 31 +++- .../petstore_api/models/parent.py | 30 +++- .../petstore_api/models/parent_all_of.py | 31 +++- .../petstore_api/models/parent_pet.py | 36 +++- .../petstore_api/models/pet.py | 31 +++- .../petstore_api/models/player.py | 31 +++- .../petstore_api/models/read_only_first.py | 31 +++- .../petstore_api/models/special_model_name.py | 31 +++- .../petstore_api/models/string_boolean_map.py | 31 +++- .../petstore_api/models/tag.py | 31 +++- .../models/type_holder_default.py | 31 +++- .../models/type_holder_example.py | 31 +++- .../petstore_api/models/user.py | 31 +++- .../petstore_api/models/xml_item.py | 31 +++- .../python-experimental/test/test_child.py | 2 +- .../python-experimental/test/test_dog.py | 2 +- .../petstore_api/model_utils.py | 158 +++++++++++------- .../models/additional_properties_class.py | 31 +++- .../petstore_api/models/address.py | 31 +++- .../petstore_api/models/animal.py | 37 +++- .../petstore_api/models/api_response.py | 31 +++- .../petstore_api/models/apple.py | 31 +++- .../petstore_api/models/apple_req.py | 31 +++- .../models/array_of_array_of_number_only.py | 31 +++- .../models/array_of_number_only.py | 31 +++- .../petstore_api/models/array_test.py | 31 +++- .../petstore_api/models/banana.py | 31 +++- .../petstore_api/models/banana_req.py | 31 +++- .../petstore_api/models/capitalization.py | 31 +++- .../petstore_api/models/cat.py | 30 +++- .../petstore_api/models/cat_all_of.py | 31 +++- .../petstore_api/models/category.py | 31 +++- .../petstore_api/models/class_model.py | 31 +++- .../petstore_api/models/client.py | 31 +++- .../petstore_api/models/dog.py | 30 +++- .../petstore_api/models/dog_all_of.py | 31 +++- .../petstore_api/models/enum_arrays.py | 31 +++- .../petstore_api/models/enum_class.py | 31 +++- .../petstore_api/models/enum_test.py | 31 +++- .../petstore_api/models/file.py | 31 +++- .../models/file_schema_test_class.py | 31 +++- .../petstore_api/models/foo.py | 31 +++- .../petstore_api/models/format_test.py | 31 +++- .../petstore_api/models/fruit.py | 30 +++- .../petstore_api/models/fruit_req.py | 30 +++- .../petstore_api/models/gm_fruit.py | 30 +++- .../petstore_api/models/has_only_read_only.py | 31 +++- .../models/health_check_result.py | 31 +++- .../petstore_api/models/inline_object.py | 31 +++- .../petstore_api/models/inline_object1.py | 31 +++- .../petstore_api/models/inline_object2.py | 31 +++- .../petstore_api/models/inline_object3.py | 31 +++- .../petstore_api/models/inline_object4.py | 31 +++- .../petstore_api/models/inline_object5.py | 31 +++- .../models/inline_response_default.py | 31 +++- .../petstore_api/models/list.py | 31 +++- .../petstore_api/models/mammal.py | 36 +++- .../petstore_api/models/map_test.py | 31 +++- ...perties_and_additional_properties_class.py | 31 +++- .../petstore_api/models/model200_response.py | 31 +++- .../petstore_api/models/model_return.py | 31 +++- .../petstore_api/models/name.py | 31 +++- .../petstore_api/models/nullable_class.py | 31 +++- .../petstore_api/models/number_only.py | 31 +++- .../petstore_api/models/order.py | 31 +++- .../petstore_api/models/outer_composite.py | 31 +++- .../petstore_api/models/outer_enum.py | 31 +++- .../models/outer_enum_default_value.py | 31 +++- .../petstore_api/models/outer_enum_integer.py | 31 +++- .../outer_enum_integer_default_value.py | 31 +++- .../petstore_api/models/pet.py | 31 +++- .../petstore_api/models/read_only_first.py | 31 +++- .../petstore_api/models/special_model_name.py | 31 +++- .../petstore_api/models/string_boolean_map.py | 31 +++- .../petstore_api/models/tag.py | 31 +++- .../petstore_api/models/user.py | 31 +++- .../petstore_api/models/whale.py | 31 +++- .../petstore_api/models/zebra.py | 31 +++- .../python-experimental/test/test_fruit.py | 8 +- .../test/test_fruit_req.py | 8 +- .../python-experimental/test/test_gm_fruit.py | 10 +- 141 files changed, 3470 insertions(+), 940 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache index ef7da5728252..9afb17b52776 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache @@ -13,6 +13,9 @@ from {{packageName}}.model_utils import ( # noqa: F401 ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, 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 8b49e58edbf2..fe54e34f5bb6 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 @@ -94,7 +94,7 @@ additional_properties_type = {{#additionalPropertiesType}}({{{additionalPropertiesType}}},) # noqa: E501{{/additionalPropertiesType}}{{^additionalPropertiesType}}None{{/additionalPropertiesType}} - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -113,7 +113,7 @@ {{/optionalVars}} } - @staticmethod + @cached_property def discriminator(): {{^discriminator}}return None{{/discriminator}}{{#discriminator}}val = { {{#mappedModels}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache index c4baa722ffb5..de06fb461ebc 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache @@ -1,10 +1,10 @@ @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache index e00bf129b247..1acfe48a4679 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache @@ -4,6 +4,7 @@ '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', @@ -16,6 +17,7 @@ '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { {{#requiredVars}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache index d26506c56c31..8433c49f2f6a 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache @@ -4,6 +4,7 @@ '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) {{> python-experimental/model_templates/method_init_shared }} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache index 9dd5bc2b6f3f..d9b8146006a8 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache @@ -1,4 +1,5 @@ - def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """{{classname}} - a model defined in OpenAPI {{#requiredVars}} @@ -31,6 +32,21 @@ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) {{#optionalVars}} {{name}} ({{{dataType}}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} # noqa: E501 {{/optionalVars}} @@ -40,4 +56,5 @@ self._check_type = _check_type self._from_server = _from_server self._path_to_item = _path_to_item - self._configuration = _configuration \ No newline at end of file + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes \ No newline at end of file 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 bcafb71368f1..f4a36e42f25b 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,9 +6,8 @@ path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.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_templates/model_composed.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache index d53d89cef2be..002b2a578952 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache @@ -26,7 +26,7 @@ class {{unescapedDescription}}(ModelComposed): {{> python-experimental/model_templates/method_init_composed }} - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache index 8bfe6ada48d8..f9d82ef2a802 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache @@ -24,9 +24,7 @@ class {{unescapedDescription}}(ModelNormal): {{/optionalVars}} } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} {{> python-experimental/model_templates/method_init_normal}}{{#discriminator}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache index 465918dfa5c0..95b8a81715b2 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache @@ -11,8 +11,6 @@ class {{unescapedDescription}}(ModelSimple): {{> python-experimental/model_templates/classvars }} - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None {{> python-experimental/model_templates/method_init_normal}} \ No newline at end of file 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 58da408a19eb..bd3b36480d13 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 @@ -35,6 +35,24 @@ else: from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -42,6 +60,47 @@ class OpenApiModel(object): {{> python-experimental/model_templates/methods_shared }} + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + from_server = kwargs.get('_from_server', False) + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + from_server is False or + cls in visited_composed_classes + ): + # we don't have a discriminator + # from_server is false which means that we are building this model + # on the client side + # or we have already visited this class before and are sure that we + # want to instantiate it this time + + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + oneof_anyof_child = new_cls in oneof_anyof_classes + + new_visited_composed_classes = [cls] + new_visited_composed_classes.extend( + visited_composed_classes) + kwargs['_visited_composed_classes'] = new_visited_composed_classes + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -473,10 +532,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -553,21 +614,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -596,23 +642,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -833,7 +870,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -914,6 +951,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -927,18 +975,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # 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] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -950,8 +997,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -979,13 +1026,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -995,7 +1042,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. 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] @@ -1039,16 +1086,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # 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] @@ -1089,7 +1136,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: @@ -1105,7 +1152,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1125,9 +1172,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1136,7 +1181,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three 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 b905f7d347a5..fc24324ca176 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -43,6 +43,24 @@ from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -54,9 +72,8 @@ def set_attribute(self, name, value): path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), @@ -113,6 +130,47 @@ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + from_server = kwargs.get('_from_server', False) + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + from_server is False or + cls in visited_composed_classes + ): + # we don't have a discriminator + # from_server is false which means that we are building this model + # on the client side + # or we have already visited this class before and are sure that we + # want to instantiate it this time + + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + oneof_anyof_child = new_cls in oneof_anyof_classes + + new_visited_composed_classes = [cls] + new_visited_composed_classes.extend( + visited_composed_classes) + kwargs['_visited_composed_classes'] = new_visited_composed_classes + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -735,10 +793,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -815,21 +875,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -858,23 +903,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -1095,7 +1131,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -1176,6 +1212,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -1189,18 +1236,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # 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] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -1212,8 +1258,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -1241,13 +1287,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -1257,7 +1303,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. 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] @@ -1301,16 +1347,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # 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] @@ -1351,7 +1397,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: @@ -1367,7 +1413,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1387,9 +1433,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1398,7 +1442,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three 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 d1a06123ea88..f508aab03435 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesAnyType(ModelNormal): additional_properties_type = (bool, date, datetime, dict, float, int, list, str,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_any_type.AdditionalPropertiesAnyType - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 bba4f0ed95f1..551aba6b0ccf 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesArray(ModelNormal): additional_properties_type = ([bool, date, datetime, dict, float, int, list, str],) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_array.AdditionalPropertiesArray - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 de012c132c90..63b5559a3e33 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesBoolean(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_boolean.AdditionalPropertiesBoolean - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 c37e9b5c73bf..b42be293109b 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'anytype_3': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,9 +108,7 @@ def discriminator(): 'anytype_3': 'anytype_3', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -115,9 +116,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_class.AdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -134,6 +137,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_string ({str: (str,)}): [optional] # noqa: E501 map_number ({str: (float,)}): [optional] # noqa: E501 map_integer ({str: (int,)}): [optional] # noqa: E501 @@ -152,6 +170,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 649fbc485896..f3b20d4d6c50 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesInteger(ModelNormal): additional_properties_type = (int,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_integer.AdditionalPropertiesInteger - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 ce12662a8ed0..85ce9bced018 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesNumber(ModelNormal): additional_properties_type = (float,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_number.AdditionalPropertiesNumber - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 e5c60015a9e1..083505550369 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesObject(ModelNormal): additional_properties_type = ({str: (bool, date, datetime, dict, float, int, list, str,)},) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_object.AdditionalPropertiesObject - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 24cef21ba90d..ba3121804e6c 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesString(ModelNormal): additional_properties_type = (str,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_string.AdditionalPropertiesString - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 39dd9789ff8b..aa7fe3344172 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Animal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'Cat': cat.Cat, @@ -103,9 +106,7 @@ def discriminator(): 'color': 'color', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -113,9 +114,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """animal.Animal - a model defined in OpenAPI Args: @@ -135,6 +138,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,6 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): @@ -155,12 +174,12 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 f1680c87f67a..5628f7a84cd9 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ApiResponse(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'message': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'message': 'message', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """api_response.ApiResponse - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) code (int): [optional] # noqa: E501 type (str): [optional] # noqa: E501 message (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 bf6419e5c089..37e19948ae4c 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_array_number': ([[float]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_array_number': 'ArrayArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_array_of_number_only.ArrayOfArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_array_number ([[float]]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 f3bf89e27ba3..87ec314f1db3 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_number': ([float],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_number': 'ArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_number_only.ArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_number ([float]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 0a01b3cad210..56d997011e27 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class ArrayTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'array_array_of_model': 'array_array_of_model', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_test.ArrayTest - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_of_string ([str]): [optional] # noqa: E501 array_array_of_integer ([[int]]): [optional] # noqa: E501 array_array_of_model ([[read_only_first.ReadOnlyFirst]]): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 6011db39400c..2513965e7753 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Capitalization(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'att_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'att_name': 'ATT_NAME', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """capitalization.Capitalization - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) small_camel (str): [optional] # noqa: E501 capital_camel (str): [optional] # noqa: E501 small_snake (str): [optional] # noqa: E501 @@ -137,6 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 3f3c2384ec22..f7fe29d74a12 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Cat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat.Cat - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -200,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 75e856dcbcde..6dd21864b99b 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class CatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'declawed': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'declawed': 'declawed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat_all_of.CatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 5d3e21ddd7e9..fd2ff82d821f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/category.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Category(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'id': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'id': 'id', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """category.Category - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name for var_name, var_value in six.iteritems(kwargs): 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 501c22427916..64bddbc0d92d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Child(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'inter_net': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child.Child - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 tele_vision (bool): [optional] # noqa: E501 inter_net (bool): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run 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 69f6b962f242..e28fb9523d3e 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'inter_net': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'inter_net': 'interNet', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_all_of.ChildAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) inter_net (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 e7894c9c7af4..da09bf043f07 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildCat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_cat.ChildCat - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 dbe4e88bcebc..2ea89c1bb33d 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildCatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_cat_all_of.ChildCatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 8544773e8843..508c64149709 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildDog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'bark': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_dog.ChildDog - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bark (str): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 f95f5ff8ae74..018c1f881436 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildDogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'bark': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'bark': 'bark', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_dog_all_of.ChildDogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bark (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 681e99ae6665..b5b8f816ac99 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildLizard(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'loves_rocks': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_lizard.ChildLizard - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) loves_rocks (bool): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 27686379a890..19fe2b9d009b 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildLizardAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'loves_rocks': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'loves_rocks': 'lovesRocks', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_lizard_all_of.ChildLizardAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) loves_rocks (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 06c52dc8bee9..311a3cca302c 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ClassModel(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_class': '_class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """class_model.ClassModel - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _class (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 b7184b3f2b40..edbdfbe4efd5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/client.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Client(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'client': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'client': 'client', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """client.Client - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) client (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 5d5712d428e9..afc263ecba22 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Dog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog.Dog - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -200,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 0832f4b696cc..b54f91acd136 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class DogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'breed': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'breed': 'breed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog_all_of.DogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 358e9f680e76..c3fb4045aa6f 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -71,7 +74,7 @@ class EnumArrays(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -86,7 +89,7 @@ def openapi_types(): 'array_enum': ([str],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'array_enum': 'array_enum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_arrays.EnumArrays - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_symbol (str): [optional] # noqa: E501 array_enum ([str]): [optional] # noqa: E501 """ @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 5f3f1894de47..b020b85feda2 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class EnumClass(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_class.EnumClass - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): 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 4c35c7b8c2bb..54c01fc92e3d 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -86,7 +89,7 @@ class EnumTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -104,7 +107,7 @@ def openapi_types(): 'outer_enum': (outer_enum.OuterEnum,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -116,9 +119,7 @@ def discriminator(): 'outer_enum': 'outerEnum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -126,9 +127,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_test.EnumTest - a model defined in OpenAPI Args: @@ -148,6 +151,21 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_string (str): [optional] # noqa: E501 enum_integer (int): [optional] # noqa: E501 enum_number (float): [optional] # noqa: E501 @@ -159,6 +177,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): 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 f71dc07b7ca8..ed4e931c3039 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class File(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'source_uri': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'source_uri': 'sourceURI', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file.File - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) source_uri (str): Test capitalization. [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 1260e8affda2..9f7c01bdab56 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class FileSchemaTestClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'files': ([file.File],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'files': 'files', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file_schema_test_class.FileSchemaTestClass - a model defined in OpenAPI Keyword Args: @@ -121,6 +124,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) file (file.File): [optional] # noqa: E501 files ([file.File]): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 823c3cb88d91..afa34076ce34 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -98,7 +101,7 @@ class FormatTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -124,7 +127,7 @@ def openapi_types(): 'uuid': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -144,9 +147,7 @@ def discriminator(): 'uuid': 'uuid', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -154,9 +155,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """format_test.FormatTest - a model defined in OpenAPI Args: @@ -179,6 +182,21 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): [optional] # noqa: E501 int32 (int): [optional] # noqa: E501 int64 (int): [optional] # noqa: E501 @@ -195,6 +213,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.number = number self.byte = byte 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 98d7934f472f..7a0e89836e92 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Grandparent(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'radio_waves': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'radio_waves': 'radioWaves', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """grandparent.Grandparent - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 db7e6f33887d..46570c006e84 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -83,7 +86,7 @@ class GrandparentAnimal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'pet_type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'ChildCat': child_cat.ChildCat, @@ -113,9 +116,7 @@ def discriminator(): 'pet_type': 'pet_type', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -123,9 +124,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """grandparent_animal.GrandparentAnimal - a model defined in OpenAPI Args: @@ -145,6 +148,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -152,6 +170,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.pet_type = pet_type for var_name, var_value in six.iteritems(kwargs): @@ -164,12 +183,12 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 c84cf0be3f2b..ecaa14013316 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HasOnlyReadOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'foo': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'foo': 'foo', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """has_only_read_only.HasOnlyReadOnly - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 foo (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 c7c80e8bd28b..1e741e0dc1cf 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/list.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class List(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_123_list': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_123_list': '123-list', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """list.List - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _123_list (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 8cc47c0a6922..1aa0758ee71a 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class MapTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'indirect_map': 'indirect_map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """map_test.MapTest - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_map_of_string ({str: ({str: (str,)},)}): [optional] # noqa: E501 map_of_enum_string ({str: (str,)}): [optional] # noqa: E501 direct_map ({str: (bool,)}): [optional] # noqa: E501 @@ -140,6 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 143a79bfa266..8f0b53d56021 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'map': ({str: (animal.Animal,)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'map': 'map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) uuid (str): [optional] # noqa: E501 date_time (datetime): [optional] # noqa: E501 map ({str: (animal.Animal,)}): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 0c3885120210..4dba63ec23ab 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Model200Response(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): '_class': 'class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model200_response.Model200Response - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (int): [optional] # noqa: E501 _class (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 75c3cea6318b..517e430adfd4 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ModelReturn(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_return': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_return': 'return', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model_return.ModelReturn - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _return (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 db81ae16916d..d0fd87292d0d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Name(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -80,7 +83,7 @@ def openapi_types(): '_123_number': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -91,9 +94,7 @@ def discriminator(): '_123_number': '123Number', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -101,9 +102,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """name.Name - a model defined in OpenAPI Args: @@ -123,6 +126,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) snake_case (int): [optional] # noqa: E501 _property (str): [optional] # noqa: E501 _123_number (int): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name for var_name, var_value in six.iteritems(kwargs): 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 0c91e2ae62d0..9fcc65fbdf7e 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'just_number': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'just_number': 'JustNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """number_only.NumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_number (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 673295a8610c..f88078f1601b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/order.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Order(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'complete': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'complete': 'complete', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """order.Order - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 pet_id (int): [optional] # noqa: E501 quantity (int): [optional] # noqa: E501 @@ -142,6 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 c654c51daffe..2b65f7e8b688 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class OuterComposite(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'my_boolean': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'my_boolean': 'my_boolean', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_composite.OuterComposite - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) my_number (outer_number.OuterNumber): [optional] # noqa: E501 my_string (str): [optional] # noqa: E501 my_boolean (bool): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 9a933b28169b..e645856c8050 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnum(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum.OuterEnum - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): 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 9f7b3de76d91..40b7b5b48691 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class OuterNumber(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,13 +80,11 @@ def openapi_types(): 'value': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -91,9 +92,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_number.OuterNumber - a model defined in OpenAPI Args: @@ -113,6 +116,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -120,6 +138,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): 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 f62abd94ceed..a530fa9a3f09 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Parent(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'tele_vision': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -103,12 +106,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent.Parent - a model defined in OpenAPI Keyword Args: @@ -125,6 +130,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 tele_vision (bool): [optional] # noqa: E501 """ @@ -134,12 +154,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { } @@ -169,7 +191,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run 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 f927649600bd..f663f122ce0b 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ParentAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'tele_vision': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'tele_vision': 'teleVision', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent_all_of.ParentAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) tele_vision (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 e7f2a6fb63f9..c7581ddcc376 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -83,7 +86,7 @@ class ParentPet(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'pet_type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'ChildCat': child_cat.ChildCat, @@ -118,12 +121,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent_pet.ParentPet - a model defined in OpenAPI Args: @@ -143,6 +148,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -150,12 +170,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -186,7 +208,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -206,12 +228,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] 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 74cd8afef1af..e505674a8ce7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/pet.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Pet(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -110,9 +113,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -120,9 +121,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """pet.Pet - a model defined in OpenAPI Args: @@ -143,6 +146,21 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 category (category.Category): [optional] # noqa: E501 tags ([tag.Tag]): [optional] # noqa: E501 @@ -154,6 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name self.photo_urls = photo_urls diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/models/player.py index ea8d2a99456d..46806601dca7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/player.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/player.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Player(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'enemy_player': (Player,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'enemy_player': 'enemyPlayer', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """player.Player - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enemy_player (Player): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name for var_name, var_value in six.iteritems(kwargs): 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 329ec017d435..87416ef84e47 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ReadOnlyFirst(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'baz': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'baz': 'baz', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """read_only_first.ReadOnlyFirst - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 baz (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 d4ffc608a579..4de5bb810cb9 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class SpecialModelName(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'special_property_name': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'special_property_name': '$special[property.name]', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """special_model_name.SpecialModelName - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) special_property_name (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 7f797f5f1b5d..2b5d5d49a3bc 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class StringBooleanMap(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """string_boolean_map.StringBooleanMap - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 9af85413b39d..79fe23234bf1 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/tag.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Tag(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'full_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'full_name': 'fullName', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """tag.Tag - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 name (str): [optional] # noqa: E501 full_name (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 acde27d37ab4..62da560a4a5a 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class TypeHolderDefault(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'datetime_item': (datetime,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -97,9 +100,7 @@ def discriminator(): 'datetime_item': 'datetime_item', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -107,9 +108,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """type_holder_default.TypeHolderDefault - a model defined in OpenAPI Args: @@ -133,6 +136,21 @@ def __init__(self, array_item, string_item='what', number_item=1.234, integer_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) date_item (date): [optional] # noqa: E501 datetime_item (datetime): [optional] # noqa: E501 """ @@ -142,6 +160,7 @@ def __init__(self, array_item, string_item='what', number_item=1.234, integer_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.string_item = string_item self.number_item = number_item 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 dc8b5116da09..d2c905b01749 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class TypeHolderExample(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -90,7 +93,7 @@ def openapi_types(): 'array_item': ([int],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -102,9 +105,7 @@ def discriminator(): 'array_item': 'array_item', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -112,9 +113,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """type_holder_example.TypeHolderExample - a model defined in OpenAPI Args: @@ -138,6 +141,21 @@ def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -145,6 +163,7 @@ def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.string_item = string_item self.number_item = number_item 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 3b2eeb54b3d9..c66e2abfdfda 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/user.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class User(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'user_status': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -99,9 +102,7 @@ def discriminator(): 'user_status': 'userStatus', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -109,9 +110,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """user.User - a model defined in OpenAPI Keyword Args: @@ -128,6 +131,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 username (str): [optional] # noqa: E501 first_name (str): [optional] # noqa: E501 @@ -143,6 +161,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 3bcd62804dda..679aa7a3e0c0 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 @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class XmlItem(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -105,7 +108,7 @@ def openapi_types(): 'prefix_ns_wrapped_array': ([int],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -141,9 +144,7 @@ def discriminator(): 'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -151,9 +152,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """xml_item.XmlItem - a model defined in OpenAPI Keyword Args: @@ -170,6 +173,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) attribute_string (str): [optional] # noqa: E501 attribute_number (float): [optional] # noqa: E501 attribute_integer (int): [optional] # noqa: E501 @@ -206,6 +224,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/test/test_child.py b/samples/client/petstore/python-experimental/test/test_child.py index 96023582c4fd..43f1341b9233 100644 --- a/samples/client/petstore/python-experimental/test/test_child.py +++ b/samples/client/petstore/python-experimental/test/test_child.py @@ -81,7 +81,7 @@ def testChild(self): # make sure that the ModelComposed class properties are correct # model.composed_schemas() stores the anyOf/allOf/oneOf info self.assertEqual( - child._composed_schemas(), + child._composed_schemas, { 'anyOf': [], 'allOf': [ diff --git a/samples/client/petstore/python-experimental/test/test_dog.py b/samples/client/petstore/python-experimental/test/test_dog.py index cb1f3230a067..cc165d8b27df 100644 --- a/samples/client/petstore/python-experimental/test/test_dog.py +++ b/samples/client/petstore/python-experimental/test/test_dog.py @@ -81,7 +81,7 @@ def testDog(self): # make sure that the ModelComposed class properties are correct # model.composed_schemas() stores the anyOf/allOf/oneOf info self.assertEqual( - dog._composed_schemas(), + dog._composed_schemas, { 'anyOf': [], 'allOf': [ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py index b905f7d347a5..fc24324ca176 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py @@ -43,6 +43,24 @@ from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -54,9 +72,8 @@ def set_attribute(self, name, value): path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), @@ -113,6 +130,47 @@ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + from_server = kwargs.get('_from_server', False) + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + from_server is False or + cls in visited_composed_classes + ): + # we don't have a discriminator + # from_server is false which means that we are building this model + # on the client side + # or we have already visited this class before and are sure that we + # want to instantiate it this time + + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + oneof_anyof_child = new_cls in oneof_anyof_classes + + new_visited_composed_classes = [cls] + new_visited_composed_classes.extend( + visited_composed_classes) + kwargs['_visited_composed_classes'] = new_visited_composed_classes + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -735,10 +793,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -815,21 +875,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -858,23 +903,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -1095,7 +1131,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -1176,6 +1212,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -1189,18 +1236,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # 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] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -1212,8 +1258,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -1241,13 +1287,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -1257,7 +1303,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. 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] @@ -1301,16 +1347,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # 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] @@ -1351,7 +1397,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: @@ -1367,7 +1413,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1387,9 +1433,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1398,7 +1442,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index 30bc3cdce6f3..950ae9091d56 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'map_of_map_property': ({str: ({str: (str,)},)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'map_of_map_property': 'map_of_map_property', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_class.AdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_property ({str: (str,)}): [optional] # noqa: E501 map_of_map_property ({str: ({str: (str,)},)}): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py index 05a95d57fa99..917cced8798c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Address(ModelNormal): additional_properties_type = (int,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """address.Address - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py index 39dd9789ff8b..aa7fe3344172 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Animal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'Cat': cat.Cat, @@ -103,9 +106,7 @@ def discriminator(): 'color': 'color', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -113,9 +114,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """animal.Animal - a model defined in OpenAPI Args: @@ -135,6 +138,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,6 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): @@ -155,12 +174,12 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py index f1680c87f67a..5628f7a84cd9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ApiResponse(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'message': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'message': 'message', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """api_response.ApiResponse - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) code (int): [optional] # noqa: E501 type (str): [optional] # noqa: E501 message (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py index 03c502690d5d..57503971e97a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Apple(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'cultivar': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'cultivar': 'cultivar', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """apple.Apple - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) cultivar (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py index 7aa81bf4c776..32d50657b5bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AppleReq(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'mealy': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'mealy': 'mealy', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """apple_req.AppleReq - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) mealy (bool): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.cultivar = cultivar for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index bf6419e5c089..37e19948ae4c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_array_number': ([[float]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_array_number': 'ArrayArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_array_of_number_only.ArrayOfArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_array_number ([[float]]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index f3bf89e27ba3..87ec314f1db3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_number': ([float],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_number': 'ArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_number_only.ArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_number ([float]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py index 0a01b3cad210..56d997011e27 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class ArrayTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'array_array_of_model': 'array_array_of_model', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_test.ArrayTest - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_of_string ([str]): [optional] # noqa: E501 array_array_of_integer ([[int]]): [optional] # noqa: E501 array_array_of_model ([[read_only_first.ReadOnlyFirst]]): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py index fda69a28a253..327c130683e2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Banana(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'length_cm': 'lengthCm', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """banana.Banana - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) length_cm (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py index bf7d461c469c..4c4eaaf09df1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class BananaReq(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'sweet': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'sweet': 'sweet', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """banana_req.BananaReq - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_ite deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) sweet (bool): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_ite self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.length_cm = length_cm for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py index 6011db39400c..2513965e7753 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Capitalization(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'att_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'att_name': 'ATT_NAME', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """capitalization.Capitalization - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) small_camel (str): [optional] # noqa: E501 capital_camel (str): [optional] # noqa: E501 small_snake (str): [optional] # noqa: E501 @@ -137,6 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py index c3641a6862b9..b5794a113b67 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Cat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -94,7 +97,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -114,12 +117,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat.Cat - a model defined in OpenAPI Args: @@ -139,6 +144,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -148,12 +168,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'class_name': class_name, @@ -184,7 +206,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 75e856dcbcde..6dd21864b99b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class CatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'declawed': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'declawed': 'declawed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat_all_of.CatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py index 5d3e21ddd7e9..fd2ff82d821f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Category(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'id': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'id': 'id', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """category.Category - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py index 06c52dc8bee9..311a3cca302c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ClassModel(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_class': '_class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """class_model.ClassModel - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _class (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py index b7184b3f2b40..edbdfbe4efd5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Client(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'client': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'client': 'client', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """client.Client - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) client (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py index 5d5712d428e9..8c2a5d5c0414 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Dog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog.Dog - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index 0832f4b696cc..b54f91acd136 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class DogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'breed': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'breed': 'breed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog_all_of.DogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index 358e9f680e76..c3fb4045aa6f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -71,7 +74,7 @@ class EnumArrays(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -86,7 +89,7 @@ def openapi_types(): 'array_enum': ([str],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'array_enum': 'array_enum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_arrays.EnumArrays - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_symbol (str): [optional] # noqa: E501 array_enum ([str]): [optional] # noqa: E501 """ @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py index 5f3f1894de47..b020b85feda2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class EnumClass(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_class.EnumClass - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py index bcd601f04ed3..680829a718d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -101,7 +104,7 @@ class EnumTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -122,7 +125,7 @@ def openapi_types(): 'outer_enum_integer_default_value': (outer_enum_integer_default_value.OuterEnumIntegerDefaultValue,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -137,9 +140,7 @@ def discriminator(): 'outer_enum_integer_default_value': 'outerEnumIntegerDefaultValue', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -147,9 +148,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_test.EnumTest - a model defined in OpenAPI Args: @@ -169,6 +172,21 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_string (str): [optional] # noqa: E501 enum_integer (int): [optional] # noqa: E501 enum_number (float): [optional] # noqa: E501 @@ -183,6 +201,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py index f71dc07b7ca8..ed4e931c3039 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class File(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'source_uri': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'source_uri': 'sourceURI', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file.File - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) source_uri (str): Test capitalization. [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index 1260e8affda2..9f7c01bdab56 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class FileSchemaTestClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'files': ([file.File],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'files': 'files', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file_schema_test_class.FileSchemaTestClass - a model defined in OpenAPI Keyword Args: @@ -121,6 +124,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) file (file.File): [optional] # noqa: E501 files ([file.File]): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py index 7a71b34dc4de..9c43bc336434 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Foo(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'bar': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'bar': 'bar', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """foo.Foo - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] if omitted the server will use the default value of 'bar' # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py index 2a7e08f4d737..b13c5b455314 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -104,7 +107,7 @@ class FormatTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -132,7 +135,7 @@ def openapi_types(): 'pattern_with_digits_and_delimiter': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -154,9 +157,7 @@ def discriminator(): 'pattern_with_digits_and_delimiter': 'pattern_with_digits_and_delimiter', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -164,9 +165,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """format_test.FormatTest - a model defined in OpenAPI Args: @@ -189,6 +192,21 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): [optional] # noqa: E501 int32 (int): [optional] # noqa: E501 int64 (int): [optional] # noqa: E501 @@ -207,6 +225,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.number = number self.byte = byte diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py index d5e71abd700f..6f5c01a01497 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Fruit(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """fruit.Fruit - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] # noqa: E501 cultivar (str): [optional] # noqa: E501 length_cm (float): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py index 111326fcb4f6..fb0b59421d6c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class FruitReq(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -90,7 +93,7 @@ def openapi_types(): 'sweet': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """fruit_req.FruitReq - a model defined in OpenAPI Args: @@ -133,6 +138,21 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) mealy (bool): [optional] # noqa: E501 sweet (bool): [optional] # noqa: E501 """ @@ -142,12 +162,14 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'cultivar': cultivar, @@ -179,7 +201,7 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py index 0888743b8ec8..0db2df81ce8e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class GmFruit(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """gm_fruit.GmFruit - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] # noqa: E501 cultivar (str): [optional] # noqa: E501 length_cm (float): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index c84cf0be3f2b..ecaa14013316 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HasOnlyReadOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'foo': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'foo': 'foo', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """has_only_read_only.HasOnlyReadOnly - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 foo (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py index 873bad5451fe..cc82d5014119 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HealthCheckResult(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'nullable_message': (str, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'nullable_message': 'NullableMessage', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """health_check_result.HealthCheckResult - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) nullable_message (str, none_type): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py index bba44a11c13d..a3ea1af67022 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object.InlineObject - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): Updated name of the pet. [optional] # noqa: E501 status (str): Updated status of the pet. [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py index 4262d4165fdc..03e940f13607 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject1(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'file': (file_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'file': 'file', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object1.InlineObject1 - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) additional_metadata (str): Additional data to pass to server. [optional] # noqa: E501 file (file_type): file to upload. [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py index 2fd4792709f5..0035ebf9795d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class InlineObject2(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'enum_form_string': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -96,9 +99,7 @@ def discriminator(): 'enum_form_string': 'enum_form_string', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -106,9 +107,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object2.InlineObject2 - a model defined in OpenAPI Keyword Args: @@ -125,6 +128,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_form_string_array ([str]): Form parameter enum test (string array). [optional] # noqa: E501 enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' # noqa: E501 """ @@ -134,6 +152,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py index 209e97de6e18..2f0b7b3ea0bf 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -97,7 +100,7 @@ class InlineObject3(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -124,7 +127,7 @@ def openapi_types(): 'callback': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -145,9 +148,7 @@ def discriminator(): 'callback': 'callback', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -155,9 +156,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, double, pattern_without_delimiter, byte, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, double, pattern_without_delimiter, byte, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object3.InlineObject3 - a model defined in OpenAPI Args: @@ -180,6 +183,21 @@ def __init__(self, number, double, pattern_without_delimiter, byte, _check_type= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): None. [optional] # noqa: E501 int32 (int): None. [optional] # noqa: E501 int64 (int): None. [optional] # noqa: E501 @@ -197,6 +215,7 @@ def __init__(self, number, double, pattern_without_delimiter, byte, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.number = number self.double = double diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py index 67b14d2c64e5..001b9c6ee647 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject4(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'param2': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'param2': 'param2', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object4.InlineObject4 - a model defined in OpenAPI Args: @@ -120,6 +123,21 @@ def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -127,6 +145,7 @@ def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.param = param self.param2 = param2 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py index ce5fc59a4aee..15df0bd14625 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject5(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'additional_metadata': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'additional_metadata': 'additionalMetadata', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, required_file, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, required_file, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object5.InlineObject5 - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, required_file, _check_type=True, _from_server=False, _path_to deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) additional_metadata (str): Additional data to pass to server. [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, required_file, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.required_file = required_file for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py index ad0f356ab50b..ecc7c1809612 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class InlineResponseDefault(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'string': (foo.Foo,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -90,9 +93,7 @@ def discriminator(): 'string': 'string', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -100,9 +101,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_response_default.InlineResponseDefault - a model defined in OpenAPI Keyword Args: @@ -119,6 +122,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) string (foo.Foo): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py index c7c80e8bd28b..1e741e0dc1cf 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class List(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_123_list': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_123_list': '123-list', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """list.List - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _123_list (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py index d5ee114fe25f..d8e0a748b794 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Mammal(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -95,7 +98,7 @@ def openapi_types(): 'type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'whale': whale.Whale, @@ -118,12 +121,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mammal.Mammal - a model defined in OpenAPI Args: @@ -143,6 +148,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) has_baleen (bool): [optional] # noqa: E501 has_teeth (bool): [optional] # noqa: E501 type (str): [optional] # noqa: E501 @@ -153,12 +173,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, } required_args = { 'class_name': class_name, @@ -189,7 +211,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -210,12 +232,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py index 8cc47c0a6922..1aa0758ee71a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class MapTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'indirect_map': 'indirect_map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """map_test.MapTest - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_map_of_string ({str: ({str: (str,)},)}): [optional] # noqa: E501 map_of_enum_string ({str: (str,)}): [optional] # noqa: E501 direct_map ({str: (bool,)}): [optional] # noqa: E501 @@ -140,6 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index 143a79bfa266..8f0b53d56021 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'map': ({str: (animal.Animal,)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'map': 'map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) uuid (str): [optional] # noqa: E501 date_time (datetime): [optional] # noqa: E501 map ({str: (animal.Animal,)}): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py index 0c3885120210..4dba63ec23ab 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Model200Response(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): '_class': 'class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model200_response.Model200Response - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (int): [optional] # noqa: E501 _class (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py index 75c3cea6318b..517e430adfd4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ModelReturn(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_return': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_return': 'return', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model_return.ModelReturn - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _return (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py index db81ae16916d..d0fd87292d0d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Name(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -80,7 +83,7 @@ def openapi_types(): '_123_number': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -91,9 +94,7 @@ def discriminator(): '_123_number': '123Number', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -101,9 +102,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """name.Name - a model defined in OpenAPI Args: @@ -123,6 +126,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) snake_case (int): [optional] # noqa: E501 _property (str): [optional] # noqa: E501 _123_number (int): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py index c97b8227cde6..8ca71ac679d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NullableClass(ModelNormal): additional_properties_type = (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'object_items_nullable': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,9 +110,7 @@ def discriminator(): 'object_items_nullable': 'object_items_nullable', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -117,9 +118,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """nullable_class.NullableClass - a model defined in OpenAPI Keyword Args: @@ -136,6 +139,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer_prop (int, none_type): [optional] # noqa: E501 number_prop (float, none_type): [optional] # noqa: E501 boolean_prop (bool, none_type): [optional] # noqa: E501 @@ -155,6 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py index 0c91e2ae62d0..9fcc65fbdf7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'just_number': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'just_number': 'JustNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """number_only.NumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_number (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py index 673295a8610c..f88078f1601b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Order(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'complete': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'complete': 'complete', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """order.Order - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 pet_id (int): [optional] # noqa: E501 quantity (int): [optional] # noqa: E501 @@ -142,6 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py index d797e2f7d07a..ac4e47868afa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class OuterComposite(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'my_boolean': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'my_boolean': 'my_boolean', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_composite.OuterComposite - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) my_number (float): [optional] # noqa: E501 my_string (str): [optional] # noqa: E501 my_boolean (bool): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py index ad948db05274..29f0976dcb93 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -65,7 +68,7 @@ class OuterEnum(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,13 +82,11 @@ def openapi_types(): 'value': (str, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum.OuterEnum - a model defined in OpenAPI Args: @@ -115,6 +118,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -122,6 +140,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py index 789bf4ae86fa..b72b3d3a0b8c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumDefaultValue(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='placed', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='placed', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_default_value.OuterEnumDefaultValue - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='placed', _check_type=True, _from_server=False, _path_t deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='placed', _check_type=True, _from_server=False, _path_t self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py index a6323a7fc0ea..32340d24cf71 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumInteger(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_integer.OuterEnumInteger - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py index 1098c6494504..ec814530590e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumIntegerDefaultValue(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_integer_default_value.OuterEnumIntegerDefaultValue - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py index 74cd8afef1af..e505674a8ce7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Pet(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -110,9 +113,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -120,9 +121,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """pet.Pet - a model defined in OpenAPI Args: @@ -143,6 +146,21 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 category (category.Category): [optional] # noqa: E501 tags ([tag.Tag]): [optional] # noqa: E501 @@ -154,6 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.name = name self.photo_urls = photo_urls diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 329ec017d435..87416ef84e47 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ReadOnlyFirst(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'baz': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'baz': 'baz', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """read_only_first.ReadOnlyFirst - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 baz (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py index d4ffc608a579..4de5bb810cb9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class SpecialModelName(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'special_property_name': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'special_property_name': '$special[property.name]', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """special_model_name.SpecialModelName - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) special_property_name (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py index 7f797f5f1b5d..2b5d5d49a3bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class StringBooleanMap(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """string_boolean_map.StringBooleanMap - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py index 8ffba1b13071..883923793b74 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Tag(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """tag.Tag - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 name (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py index 31e9e36b1ad0..6fac2f3e490e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class User(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'arbitrary_nullable_type_value': (object, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,9 +110,7 @@ def discriminator(): 'arbitrary_nullable_type_value': 'arbitraryNullableTypeValue', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -117,9 +118,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """user.User - a model defined in OpenAPI Keyword Args: @@ -136,6 +139,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 username (str): [optional] # noqa: E501 first_name (str): [optional] # noqa: E501 @@ -155,6 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py index 0c166e663015..7cbf59ed0199 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Whale(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'has_teeth': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'has_teeth': 'hasTeeth', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """whale.Whale - a model defined in OpenAPI Args: @@ -121,6 +124,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) has_baleen (bool): [optional] # noqa: E501 has_teeth (bool): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py index 56c0b34c2672..0db6b19c02e5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Zebra(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'type': 'type', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """zebra.Zebra - a model defined in OpenAPI Args: @@ -124,6 +127,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) type (str): [optional] # noqa: E501 """ @@ -132,6 +150,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py index ee32229a8bbd..3b16da852e3d 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py @@ -66,9 +66,9 @@ def testFruit(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [], 'allOf': [], @@ -79,7 +79,7 @@ def testFruit(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Banana: banana_instance = composed_instance @@ -147,7 +147,7 @@ def testFruit(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py index 2fa26fac0aa5..89905eca7504 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py @@ -61,9 +61,9 @@ def testFruitReq(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [], 'allOf': [], @@ -74,7 +74,7 @@ def testFruitReq(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.BananaReq: banana_instance = composed_instance @@ -137,7 +137,7 @@ def testFruitReq(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.AppleReq: apple_instance = composed_instance diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py index dd9605bd8a1b..b8e02ed45a74 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py @@ -66,9 +66,9 @@ def testGmFruit(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [ petstore_api.Apple, @@ -79,7 +79,7 @@ def testGmFruit(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Banana: banana_instance = composed_instance @@ -137,7 +137,7 @@ def testGmFruit(self): self.assertEqual(getattr(fruit, 'length_cm'), length_cm) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance @@ -180,7 +180,7 @@ def testGmFruit(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance From e42d9ce423804847945fdd0a851eeee7cfca317a Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 30 Apr 2020 13:45:37 -0700 Subject: [PATCH 2/8] Adds v3 sample with 2 discriminators --- ...odels-for-testing-with-http-signature.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 74598c6ce709..2a75d000f248 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1875,3 +1875,55 @@ components: type: boolean required: - lengthCm + Shapes: + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + TriangleInterface: + properties: + shapeType: + type: string + triangleType: + type: string + required: + - shapeType + - triangleType + Triangle: + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + discriminator: + propertyName: triangleType + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + allOf: + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + shapeType: + type: string + quadrilateralType: + type: string + required: + - shapeType + - quadrilateralType + Quadrilateral: + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + discriminator: + propertyName: quadrilateralType + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/QuadrilateralInterface' From ffed5dc63f1fb573b08368752f7019eb0f31635c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 30 Apr 2020 16:31:09 -0700 Subject: [PATCH 3/8] Adds tests of Shape, Tringle, and Quadrilateral traveling through 2 discriminators --- .../python-experimental/model_utils.mustache | 16 +- ...odels-for-testing-with-http-signature.yaml | 40 ++- .../petstore/python-experimental/README.md | 10 + .../docs/ComplexQuadrilateral.md | 11 + .../docs/EquilateralTriangle.md | 11 + .../docs/IsoscelesTriangle.md | 11 + .../python-experimental/docs/Quadrilateral.md | 11 + .../docs/QuadrilateralInterface.md | 11 + .../docs/ScaleneTriangle.md | 11 + .../python-experimental/docs/Shape.md | 12 + .../docs/ShapeInterface.md | 10 + .../docs/SimpleQuadrilateral.md | 11 + .../python-experimental/docs/Triangle.md | 11 + .../docs/TriangleInterface.md | 11 + .../petstore_api/__init__.py | 10 + .../petstore_api/model_utils.py | 16 +- .../petstore_api/models/cat.py | 6 +- .../models/complex_quadrilateral.py | 210 +++++++++++++++ .../petstore_api/models/dog.py | 6 +- .../models/equilateral_triangle.py | 213 ++++++++++++++++ .../petstore_api/models/isosceles_triangle.py | 213 ++++++++++++++++ .../petstore_api/models/quadrilateral.py | 235 +++++++++++++++++ .../models/quadrilateral_interface.py | 159 ++++++++++++ .../petstore_api/models/scalene_triangle.py | 213 ++++++++++++++++ .../petstore_api/models/shape.py | 238 +++++++++++++++++ .../petstore_api/models/shape_interface.py | 155 +++++++++++ .../models/simple_quadrilateral.py | 210 +++++++++++++++ .../petstore_api/models/triangle.py | 241 ++++++++++++++++++ .../petstore_api/models/triangle_interface.py | 159 ++++++++++++ .../test/test_complex_quadrilateral.py | 37 +++ .../test/test_equilateral_triangle.py | 37 +++ .../test/test_isosceles_triangle.py | 37 +++ .../test/test_quadrilateral.py | 38 +++ .../test/test_quadrilateral_interface.py | 37 +++ .../test/test_scalene_triangle.py | 37 +++ .../python-experimental/test/test_shape.py | 84 ++++++ .../test/test_shape_interface.py | 37 +++ .../test/test_simple_quadrilateral.py | 37 +++ .../python-experimental/test/test_triangle.py | 40 +++ .../test/test_triangle_interface.py | 37 +++ 40 files changed, 2907 insertions(+), 22 deletions(-) create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Shape.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Triangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_shape.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py 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 bd3b36480d13..f49f52de8b00 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 @@ -65,16 +65,12 @@ class OpenApiModel(object): # pick a new schema/class to instantiate because a discriminator # propertyName value was passed in - from_server = kwargs.get('_from_server', False) visited_composed_classes = kwargs.get('_visited_composed_classes', ()) if ( cls.discriminator is None or - from_server is False or cls in visited_composed_classes ): # we don't have a discriminator - # from_server is false which means that we are building this model - # on the client side # or we have already visited this class before and are sure that we # want to instantiate it this time @@ -84,6 +80,18 @@ class OpenApiModel(object): oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) oneof_anyof_child = new_cls in oneof_anyof_classes new_visited_composed_classes = [cls] diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 2a75d000f248..812af040d8c4 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1875,22 +1875,25 @@ components: type: boolean required: - lengthCm - Shapes: + Shape: + properties: + shapeType: + type: string oneOf: - $ref: '#/components/schemas/Triangle' - $ref: '#/components/schemas/Quadrilateral' discriminator: propertyName: shapeType - TriangleInterface: + ShapeInterface: properties: shapeType: type: string - triangleType: - type: string required: - shapeType - - triangleType Triangle: + properties: + triangleType: + type: string oneOf: - $ref: '#/components/schemas/EquilateralTriangle' - $ref: '#/components/schemas/IsoscelesTriangle' @@ -1898,14 +1901,35 @@ components: discriminator: propertyName: triangleType EquilateralTriangle: + properties: + triangleType: + type: string + enum: + - EquilateralTriangle + required: + - triangleType allOf: - - $ref: '#/components/schemas/TriangleInterface' + - $ref: '#/components/schemas/ShapeInterface' IsoscelesTriangle: + properties: + triangleType: + type: string + enum: + - IsoscelesTriangle + required: + - triangleType allOf: - - $ref: '#/components/schemas/TriangleInterface' + - $ref: '#/components/schemas/ShapeInterface' ScaleneTriangle: + properties: + triangleType: + type: string + enum: + - ScaleneTriangle + required: + - triangleType allOf: - - $ref: '#/components/schemas/TriangleInterface' + - $ref: '#/components/schemas/ShapeInterface' QuadrilateralInterface: properties: shapeType: diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index b2158bd96594..1ed2a3fc079a 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -139,11 +139,13 @@ Class | Method | HTTP request | Description - [category.Category](docs/Category.md) - [class_model.ClassModel](docs/ClassModel.md) - [client.Client](docs/Client.md) + - [complex_quadrilateral.ComplexQuadrilateral](docs/ComplexQuadrilateral.md) - [dog.Dog](docs/Dog.md) - [dog_all_of.DogAllOf](docs/DogAllOf.md) - [enum_arrays.EnumArrays](docs/EnumArrays.md) - [enum_class.EnumClass](docs/EnumClass.md) - [enum_test.EnumTest](docs/EnumTest.md) + - [equilateral_triangle.EquilateralTriangle](docs/EquilateralTriangle.md) - [file.File](docs/File.md) - [file_schema_test_class.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [foo.Foo](docs/Foo.md) @@ -160,6 +162,7 @@ Class | Method | HTTP request | Description - [inline_object4.InlineObject4](docs/InlineObject4.md) - [inline_object5.InlineObject5](docs/InlineObject5.md) - [inline_response_default.InlineResponseDefault](docs/InlineResponseDefault.md) + - [isosceles_triangle.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [list.List](docs/List.md) - [mammal.Mammal](docs/Mammal.md) - [map_test.MapTest](docs/MapTest.md) @@ -176,10 +179,17 @@ Class | Method | HTTP request | Description - [outer_enum_integer.OuterEnumInteger](docs/OuterEnumInteger.md) - [outer_enum_integer_default_value.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [pet.Pet](docs/Pet.md) + - [quadrilateral.Quadrilateral](docs/Quadrilateral.md) + - [quadrilateral_interface.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [read_only_first.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [scalene_triangle.ScaleneTriangle](docs/ScaleneTriangle.md) + - [shape.Shape](docs/Shape.md) + - [shape_interface.ShapeInterface](docs/ShapeInterface.md) + - [simple_quadrilateral.SimpleQuadrilateral](docs/SimpleQuadrilateral.md) - [special_model_name.SpecialModelName](docs/SpecialModelName.md) - [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md) - [tag.Tag](docs/Tag.md) + - [triangle.Triangle](docs/Triangle.md) - [user.User](docs/User.md) - [whale.Whale](docs/Whale.md) - [zebra.Zebra](docs/Zebra.md) diff --git a/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..6a7288abcb8e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# complex_quadrilateral.ComplexQuadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..d79b6ce36dff --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# equilateral_triangle.EquilateralTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | defaults to 'EquilateralTriangle' + +[[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/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..c25558089dc7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# isosceles_triangle.IsoscelesTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | defaults to 'IsoscelesTriangle' + +[[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/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md new file mode 100644 index 000000000000..bc43f1e9351c --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md @@ -0,0 +1,11 @@ +# quadrilateral.Quadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quadrilateral_type** | **str** | | +**shape_type** | **str** | | defaults to nulltype.Null + +[[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/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..6833565f71eb --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md @@ -0,0 +1,11 @@ +# quadrilateral_interface.QuadrilateralInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..6dd133b5b0a9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# scalene_triangle.ScaleneTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | defaults to 'ScaleneTriangle' + +[[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/openapi3/client/petstore/python-experimental/docs/Shape.md b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md new file mode 100644 index 000000000000..3177ee2e8166 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md @@ -0,0 +1,12 @@ +# shape.Shape + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | +**shape_type** | **str** | | [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/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md new file mode 100644 index 000000000000..adb207397a49 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md @@ -0,0 +1,10 @@ +# shape_interface.ShapeInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..fe93f4173476 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# simple_quadrilateral.SimpleQuadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/Triangle.md b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md new file mode 100644 index 000000000000..e2d9ecc08e4d --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md @@ -0,0 +1,11 @@ +# triangle.Triangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | [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/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md new file mode 100644 index 000000000000..1e2662963692 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md @@ -0,0 +1,11 @@ +# triangle_interface.TriangleInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py index 3aa279dd15d6..748663d27abb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py @@ -57,11 +57,13 @@ from petstore_api.models.category import Category from petstore_api.models.class_model import ClassModel from petstore_api.models.client import Client +from petstore_api.models.complex_quadrilateral import ComplexQuadrilateral from petstore_api.models.dog import Dog from petstore_api.models.dog_all_of import DogAllOf from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.equilateral_triangle import EquilateralTriangle from petstore_api.models.file import File from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo @@ -78,6 +80,7 @@ from petstore_api.models.inline_object4 import InlineObject4 from petstore_api.models.inline_object5 import InlineObject5 from petstore_api.models.inline_response_default import InlineResponseDefault +from petstore_api.models.isosceles_triangle import IsoscelesTriangle from petstore_api.models.list import List from petstore_api.models.mammal import Mammal from petstore_api.models.map_test import MapTest @@ -94,10 +97,17 @@ from petstore_api.models.outer_enum_integer import OuterEnumInteger from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue from petstore_api.models.pet import Pet +from petstore_api.models.quadrilateral import Quadrilateral +from petstore_api.models.quadrilateral_interface import QuadrilateralInterface from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.scalene_triangle import ScaleneTriangle +from petstore_api.models.shape import Shape +from petstore_api.models.shape_interface import ShapeInterface +from petstore_api.models.simple_quadrilateral import SimpleQuadrilateral from petstore_api.models.special_model_name import SpecialModelName from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag +from petstore_api.models.triangle import Triangle from petstore_api.models.user import User from petstore_api.models.whale import Whale from petstore_api.models.zebra import Zebra diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py index fc24324ca176..b51ca24d81fe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py @@ -135,16 +135,12 @@ def __new__(cls, *args, **kwargs): # pick a new schema/class to instantiate because a discriminator # propertyName value was passed in - from_server = kwargs.get('_from_server', False) visited_composed_classes = kwargs.get('_visited_composed_classes', ()) if ( cls.discriminator is None or - from_server is False or cls in visited_composed_classes ): # we don't have a discriminator - # from_server is false which means that we are building this model - # on the client side # or we have already visited this class before and are sure that we # want to instantiate it this time @@ -154,6 +150,18 @@ def __new__(cls, *args, **kwargs): oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) oneof_anyof_child = new_cls in oneof_anyof_classes new_visited_composed_classes = [cls] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py index b5794a113b67..6bb8e9b9f452 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py @@ -228,12 +228,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py new file mode 100644 index 000000000000..c614a335e3be --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py @@ -0,0 +1,210 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.models.quadrilateral_interface'] + + +class ComplexQuadrilateral(ModelComposed): + """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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """complex_quadrilateral.ComplexQuadrilateral - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + quadrilateral_interface.QuadrilateralInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py index 8c2a5d5c0414..afc263ecba22 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py @@ -222,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py new file mode 100644 index 000000000000..84ec8af67aab --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py @@ -0,0 +1,213 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] + + +class EquilateralTriangle(ModelComposed): + """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 = { + ('triangle_type',): { + 'EQUILATERALTRIANGLE': "EquilateralTriangle", + }, + } + + validations = { + } + + additional_properties_type = None + + @cached_property + 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 { + 'triangle_type': (str,), # noqa: E501 + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'triangle_type': 'triangleType', # noqa: E501 + 'shape_type': 'shapeType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type='EquilateralTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """equilateral_triangle.EquilateralTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + + Keyword Args: + triangle_type (str): defaults to 'EquilateralTriangle', must be one of ["EquilateralTriangle", ] # noqa: E501 + _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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'triangle_type': triangle_type, + 'shape_type': shape_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py new file mode 100644 index 000000000000..a1356a1af4d3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py @@ -0,0 +1,213 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] + + +class IsoscelesTriangle(ModelComposed): + """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 = { + ('triangle_type',): { + 'ISOSCELESTRIANGLE': "IsoscelesTriangle", + }, + } + + validations = { + } + + additional_properties_type = None + + @cached_property + 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 { + 'triangle_type': (str,), # noqa: E501 + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'triangle_type': 'triangleType', # noqa: E501 + 'shape_type': 'shapeType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type='IsoscelesTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """isosceles_triangle.IsoscelesTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + + Keyword Args: + triangle_type (str): defaults to 'IsoscelesTriangle', must be one of ["IsoscelesTriangle", ] # noqa: E501 + _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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'triangle_type': triangle_type, + 'shape_type': shape_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py new file mode 100644 index 000000000000..bcccf99fc178 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py @@ -0,0 +1,235 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import complex_quadrilateral +except ImportError: + complex_quadrilateral = sys.modules[ + 'petstore_api.models.complex_quadrilateral'] +try: + from petstore_api.models import simple_quadrilateral +except ImportError: + simple_quadrilateral = sys.modules[ + 'petstore_api.models.simple_quadrilateral'] + + +class Quadrilateral(ModelComposed): + """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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'ComplexQuadrilateral': complex_quadrilateral.ComplexQuadrilateral, + 'SimpleQuadrilateral': simple_quadrilateral.SimpleQuadrilateral, + } + if not val: + return None + return {'quadrilateral_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, quadrilateral_type, shape_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """quadrilateral.Quadrilateral - a model defined in OpenAPI + + Args: + quadrilateral_type (str): + + Keyword Args: + shape_type (str): defaults to nulltype.Null # noqa: E501 + _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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + complex_quadrilateral.ComplexQuadrilateral, + simple_quadrilateral.SimpleQuadrilateral, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py new file mode 100644 index 000000000000..f679965f6fe0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py @@ -0,0 +1,159 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class QuadrilateralInterface(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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """quadrilateral_interface.QuadrilateralInterface - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + self.shape_type = shape_type + self.quadrilateral_type = quadrilateral_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py new file mode 100644 index 000000000000..95fdf7ace7a7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py @@ -0,0 +1,213 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] + + +class ScaleneTriangle(ModelComposed): + """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 = { + ('triangle_type',): { + 'SCALENETRIANGLE': "ScaleneTriangle", + }, + } + + validations = { + } + + additional_properties_type = None + + @cached_property + 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 { + 'triangle_type': (str,), # noqa: E501 + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'triangle_type': 'triangleType', # noqa: E501 + 'shape_type': 'shapeType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type='ScaleneTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """scalene_triangle.ScaleneTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + + Keyword Args: + triangle_type (str): defaults to 'ScaleneTriangle', must be one of ["ScaleneTriangle", ] # noqa: E501 + _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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'triangle_type': triangle_type, + 'shape_type': shape_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py new file mode 100644 index 000000000000..dfd8fd7f6c64 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py @@ -0,0 +1,238 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.models.quadrilateral'] +try: + from petstore_api.models import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.models.triangle'] + + +class Shape(ModelComposed): + """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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'Quadrilateral': quadrilateral.Quadrilateral, + 'Triangle': triangle.Triangle, + } + if not val: + return None + return {'shape_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + 'shape_type': 'shapeType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """shape.Shape - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + shape_type (str): [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._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + quadrilateral.Quadrilateral, + triangle.Triangle, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py new file mode 100644 index 000000000000..bab7ca2eed55 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py @@ -0,0 +1,155 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class ShapeInterface(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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """shape_interface.ShapeInterface - a model defined in OpenAPI + + Args: + shape_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + self.shape_type = shape_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py new file mode 100644 index 000000000000..d481ea40d15a --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py @@ -0,0 +1,210 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.models.quadrilateral_interface'] + + +class SimpleQuadrilateral(ModelComposed): + """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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """simple_quadrilateral.SimpleQuadrilateral - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + quadrilateral_interface.QuadrilateralInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py new file mode 100644 index 000000000000..57a182c8197a --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py @@ -0,0 +1,241 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import equilateral_triangle +except ImportError: + equilateral_triangle = sys.modules[ + 'petstore_api.models.equilateral_triangle'] +try: + from petstore_api.models import isosceles_triangle +except ImportError: + isosceles_triangle = sys.modules[ + 'petstore_api.models.isosceles_triangle'] +try: + from petstore_api.models import scalene_triangle +except ImportError: + scalene_triangle = sys.modules[ + 'petstore_api.models.scalene_triangle'] + + +class Triangle(ModelComposed): + """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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'EquilateralTriangle': equilateral_triangle.EquilateralTriangle, + 'IsoscelesTriangle': isosceles_triangle.IsoscelesTriangle, + 'ScaleneTriangle': scalene_triangle.ScaleneTriangle, + } + if not val: + return None + return {'triangle_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """triangle.Triangle - a model defined in OpenAPI + + Args: + shape_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + triangle_type (str): [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._visited_composed_classes = _visited_composed_classes + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': _visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + equilateral_triangle.EquilateralTriangle, + isosceles_triangle.IsoscelesTriangle, + scalene_triangle.ScaleneTriangle, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py new file mode 100644 index 000000000000..ac13b277d917 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py @@ -0,0 +1,159 @@ +# 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 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class TriangleInterface(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 + + @cached_property + 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 { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """triangle_interface.TriangleInterface - a model defined in OpenAPI + + Args: + shape_type (str): + triangle_type (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. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + + self.shape_type = shape_type + self.triangle_type = triangle_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py new file mode 100644 index 000000000000..b1d4fc9079bd --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py @@ -0,0 +1,37 @@ +# 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 TestComplexQuadrilateral(unittest.TestCase): + """ComplexQuadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testComplexQuadrilateral(self): + """Test ComplexQuadrilateral""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ComplexQuadrilateral() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py new file mode 100644 index 000000000000..cdef216105eb --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py @@ -0,0 +1,37 @@ +# 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 TestEquilateralTriangle(unittest.TestCase): + """EquilateralTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEquilateralTriangle(self): + """Test EquilateralTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.EquilateralTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py new file mode 100644 index 000000000000..1f27f751d061 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py @@ -0,0 +1,37 @@ +# 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 TestIsoscelesTriangle(unittest.TestCase): + """IsoscelesTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testIsoscelesTriangle(self): + """Test IsoscelesTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.IsoscelesTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py new file mode 100644 index 000000000000..9bb838811892 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py @@ -0,0 +1,38 @@ +# 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 TestQuadrilateral(unittest.TestCase): + """Quadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testQuadrilateral(self): + """Test Quadrilateral""" + complex_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") + assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + simple_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") + assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py new file mode 100644 index 000000000000..7a48ce64a9df --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py @@ -0,0 +1,37 @@ +# 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 TestQuadrilateralInterface(unittest.TestCase): + """QuadrilateralInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testQuadrilateralInterface(self): + """Test QuadrilateralInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.QuadrilateralInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py new file mode 100644 index 000000000000..8452fc183137 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py @@ -0,0 +1,37 @@ +# 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 TestScaleneTriangle(unittest.TestCase): + """ScaleneTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testScaleneTriangle(self): + """Test ScaleneTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ScaleneTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py new file mode 100644 index 000000000000..c8296aad8ef8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py @@ -0,0 +1,84 @@ +# 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 TestShape(unittest.TestCase): + """Shape unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testShape(self): + """Test Shape""" + equilateral_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="EquilateralTriangle" + ) + assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + + isosceles_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="IsoscelesTriangle" + ) + assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + + scalene_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="ScaleneTriangle" + ) + assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + + complex_quadrilateral = petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="ComplexQuadrilateral" + ) + assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + + simple_quadrilateral = petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="SimpleQuadrilateral" + ) + assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + + # invalid shape_type (first discriminator) + err_msg = ("Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("shapeType", "Circle") + ): + petstore_api.Shape(shape_type="Circle") + + # invalid quadrilateral_type (second discriminator) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") + ): + petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="Triangle" + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py new file mode 100644 index 000000000000..a768951489a0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py @@ -0,0 +1,37 @@ +# 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 TestShapeInterface(unittest.TestCase): + """ShapeInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testShapeInterface(self): + """Test ShapeInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ShapeInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py new file mode 100644 index 000000000000..f51722093445 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py @@ -0,0 +1,37 @@ +# 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 TestSimpleQuadrilateral(unittest.TestCase): + """SimpleQuadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSimpleQuadrilateral(self): + """Test SimpleQuadrilateral""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.SimpleQuadrilateral() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py new file mode 100644 index 000000000000..42037a1ec79b --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py @@ -0,0 +1,40 @@ +# 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 TestTriangle(unittest.TestCase): + """Triangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTriangle(self): + """Test Triangle""" + equilateral_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") + assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + isosceles_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") + assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + scalene_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") + assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py new file mode 100644 index 000000000000..4d87e647e61e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py @@ -0,0 +1,37 @@ +# 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 TestTriangleInterface(unittest.TestCase): + """TriangleInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTriangleInterface(self): + """Test TriangleInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.TriangleInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() From aebdc93125babce841e2ec1aac0f28409ecec126 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 30 Apr 2020 16:41:56 -0700 Subject: [PATCH 4/8] Adds test_deserialization.py:test_deserialize_shape --- .../tests/test_deserialization.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py index f1a71a67378b..1cff538a15fc 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py @@ -27,6 +27,48 @@ def setUp(self): self.api_client = petstore_api.ApiClient() self.deserialize = self.api_client.deserialize + def test_deserialize_shape(self): + """ + + deserialize Shape to an instance of: + - EquilateralTriangle + - IsoscelesTriangle + - IsoscelesTriangle + - ScaleneTriangle + - ComplexQuadrilateral + - SimpleQuadrilateral + by traveling through 2 discriminators + """ + shape_type, triangle_type = ['Triangle', 'EquilateralTriangle'] + data = { + 'shapeType': shape_type, + 'triangleType': triangle_type, + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, (petstore_api.Shape,), True) + self.assertTrue(isinstance(deserialized, petstore_api.EquilateralTriangle)) + self.assertEqual(deserialized.shape_type, shape_type) + self.assertEqual(deserialized.triangle_type, triangle_type) + + # invalid second discriminator value + shape_type, quadrilateral_type = ['Quadrilateral', 'Triangle'] + data = { + 'shapeType': shape_type, + 'quadrilateralType': quadrilateral_type, + } + response = MockResponse(data=json.dumps(data)) + + err_msg = ("Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") + ): + self.deserialize(response, (petstore_api.Shape,), True) + def test_deserialize_animal(self): """ deserialize Animal to a Dog instance From 32075a2345dd5d325efbe38550aa8c8ee52f52f2 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 30 Apr 2020 17:06:51 -0700 Subject: [PATCH 5/8] Simplifes XTriangle sample spec schemas --- ...odels-for-testing-with-http-signature.yaml | 34 +++++-------------- .../petstore/python-experimental/README.md | 1 + .../docs/EquilateralTriangle.md | 2 +- .../docs/IsoscelesTriangle.md | 2 +- .../docs/QuadrilateralInterface.md | 1 - .../docs/ScaleneTriangle.md | 2 +- .../python-experimental/docs/Shape.md | 1 + .../python-experimental/docs/Triangle.md | 4 +-- .../docs/TriangleInterface.md | 1 - .../petstore_api/__init__.py | 1 + .../models/complex_quadrilateral.py | 6 ++++ .../models/equilateral_triangle.py | 19 ++++++----- .../petstore_api/models/isosceles_triangle.py | 19 ++++++----- .../models/quadrilateral_interface.py | 6 +--- .../petstore_api/models/scalene_triangle.py | 19 ++++++----- .../petstore_api/models/shape.py | 6 +++- .../models/simple_quadrilateral.py | 6 ++++ .../petstore_api/models/triangle.py | 7 ++-- .../petstore_api/models/triangle_interface.py | 6 +--- 19 files changed, 73 insertions(+), 70 deletions(-) diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 812af040d8c4..cd72a2431a86 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1890,10 +1890,13 @@ components: type: string required: - shapeType - Triangle: + TriangleInterface: properties: triangleType: type: string + required: + - triangleType + Triangle: oneOf: - $ref: '#/components/schemas/EquilateralTriangle' - $ref: '#/components/schemas/IsoscelesTriangle' @@ -1901,43 +1904,22 @@ components: discriminator: propertyName: triangleType EquilateralTriangle: - properties: - triangleType: - type: string - enum: - - EquilateralTriangle - required: - - triangleType allOf: - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' IsoscelesTriangle: - properties: - triangleType: - type: string - enum: - - IsoscelesTriangle - required: - - triangleType allOf: - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' ScaleneTriangle: - properties: - triangleType: - type: string - enum: - - ScaleneTriangle - required: - - triangleType allOf: - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' QuadrilateralInterface: properties: - shapeType: - type: string quadrilateralType: type: string required: - - shapeType - quadrilateralType Quadrilateral: oneOf: @@ -1947,7 +1929,9 @@ components: propertyName: quadrilateralType SimpleQuadrilateral: allOf: + - $ref: '#/components/schemas/ShapeInterface' - $ref: '#/components/schemas/QuadrilateralInterface' ComplexQuadrilateral: allOf: + - $ref: '#/components/schemas/ShapeInterface' - $ref: '#/components/schemas/QuadrilateralInterface' diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index 1ed2a3fc079a..75c709986b76 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -190,6 +190,7 @@ Class | Method | HTTP request | Description - [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md) - [tag.Tag](docs/Tag.md) - [triangle.Triangle](docs/Triangle.md) + - [triangle_interface.TriangleInterface](docs/TriangleInterface.md) - [user.User](docs/User.md) - [whale.Whale](docs/Whale.md) - [zebra.Zebra](docs/Zebra.md) diff --git a/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md index d79b6ce36dff..46c822e9db42 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shape_type** | **str** | | -**triangle_type** | **str** | | defaults to 'EquilateralTriangle' +**triangle_type** | **str** | | [[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/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md index c25558089dc7..335edad8c0fe 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shape_type** | **str** | | -**triangle_type** | **str** | | defaults to 'IsoscelesTriangle' +**triangle_type** | **str** | | [[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/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md index 6833565f71eb..d3600c6c5ba7 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md @@ -3,7 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**shape_type** | **str** | | **quadrilateral_type** | **str** | | [[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/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md index 6dd133b5b0a9..a99a1f761c2f 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shape_type** | **str** | | -**triangle_type** | **str** | | defaults to 'ScaleneTriangle' +**triangle_type** | **str** | | [[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/openapi3/client/petstore/python-experimental/docs/Shape.md b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md index 3177ee2e8166..05e9c57f8f8b 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/Shape.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shape_type** | **str** | | **quadrilateral_type** | **str** | | +**triangle_type** | **str** | | **shape_type** | **str** | | [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/openapi3/client/petstore/python-experimental/docs/Triangle.md b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md index e2d9ecc08e4d..b6cf81066821 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**shape_type** | **str** | | -**triangle_type** | **str** | | [optional] +**triangle_type** | **str** | | +**shape_type** | **str** | | defaults to nulltype.Null [[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/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md index 1e2662963692..7a32b8572145 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md @@ -3,7 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**shape_type** | **str** | | **triangle_type** | **str** | | [[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/openapi3/client/petstore/python-experimental/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py index 748663d27abb..8b55c4a48b2a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py @@ -108,6 +108,7 @@ from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.triangle import Triangle +from petstore_api.models.triangle_interface import TriangleInterface from petstore_api.models.user import User from petstore_api.models.whale import Whale from petstore_api.models.zebra import Zebra diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py index c614a335e3be..9ee853d7bf02 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py @@ -37,6 +37,11 @@ except ImportError: quadrilateral_interface = sys.modules[ 'petstore_api.models.quadrilateral_interface'] +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] class ComplexQuadrilateral(ModelComposed): @@ -204,6 +209,7 @@ def _composed_schemas(): ], 'allOf': [ quadrilateral_interface.QuadrilateralInterface, + shape_interface.ShapeInterface, ], 'oneOf': [ ], diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py index 84ec8af67aab..db714188c8d8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py @@ -37,6 +37,11 @@ except ImportError: shape_interface = sys.modules[ 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] class EquilateralTriangle(ModelComposed): @@ -64,9 +69,6 @@ class EquilateralTriangle(ModelComposed): """ allowed_values = { - ('triangle_type',): { - 'EQUILATERALTRIANGLE': "EquilateralTriangle", - }, } validations = { @@ -85,8 +87,8 @@ def openapi_types(): and the value is attribute type. """ return { - 'triangle_type': (str,), # noqa: E501 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 } @cached_property @@ -94,8 +96,8 @@ def discriminator(): return None attribute_map = { - 'triangle_type': 'triangleType', # noqa: E501 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 } required_properties = set([ @@ -111,14 +113,14 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, triangle_type='EquilateralTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """equilateral_triangle.EquilateralTriangle - a model defined in OpenAPI Args: shape_type (str): + triangle_type (str): Keyword Args: - triangle_type (str): defaults to 'EquilateralTriangle', must be one of ["EquilateralTriangle", ] # noqa: E501 _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. @@ -164,8 +166,8 @@ def __init__(self, shape_type, triangle_type='EquilateralTriangle', _check_type= '_visited_composed_classes': _visited_composed_classes, } required_args = { - 'triangle_type': triangle_type, 'shape_type': shape_type, + 'triangle_type': triangle_type, } # remove args whose value is Null because they are unset required_arg_names = list(required_args.keys()) @@ -207,6 +209,7 @@ def _composed_schemas(): ], 'allOf': [ shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, ], 'oneOf': [ ], diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py index a1356a1af4d3..4eebf89debe3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py @@ -37,6 +37,11 @@ except ImportError: shape_interface = sys.modules[ 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] class IsoscelesTriangle(ModelComposed): @@ -64,9 +69,6 @@ class IsoscelesTriangle(ModelComposed): """ allowed_values = { - ('triangle_type',): { - 'ISOSCELESTRIANGLE': "IsoscelesTriangle", - }, } validations = { @@ -85,8 +87,8 @@ def openapi_types(): and the value is attribute type. """ return { - 'triangle_type': (str,), # noqa: E501 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 } @cached_property @@ -94,8 +96,8 @@ def discriminator(): return None attribute_map = { - 'triangle_type': 'triangleType', # noqa: E501 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 } required_properties = set([ @@ -111,14 +113,14 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, triangle_type='IsoscelesTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """isosceles_triangle.IsoscelesTriangle - a model defined in OpenAPI Args: shape_type (str): + triangle_type (str): Keyword Args: - triangle_type (str): defaults to 'IsoscelesTriangle', must be one of ["IsoscelesTriangle", ] # noqa: E501 _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. @@ -164,8 +166,8 @@ def __init__(self, shape_type, triangle_type='IsoscelesTriangle', _check_type=Tr '_visited_composed_classes': _visited_composed_classes, } required_args = { - 'triangle_type': triangle_type, 'shape_type': shape_type, + 'triangle_type': triangle_type, } # remove args whose value is Null because they are unset required_arg_names = list(required_args.keys()) @@ -207,6 +209,7 @@ def _composed_schemas(): ], 'allOf': [ shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, ], 'oneOf': [ ], diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py index f679965f6fe0..7de7a8ea1172 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py @@ -77,7 +77,6 @@ def openapi_types(): and the value is attribute type. """ return { - 'shape_type': (str,), # noqa: E501 'quadrilateral_type': (str,), # noqa: E501 } @@ -86,7 +85,6 @@ def discriminator(): return None attribute_map = { - 'shape_type': 'shapeType', # noqa: E501 'quadrilateral_type': 'quadrilateralType', # noqa: E501 } @@ -102,11 +100,10 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """quadrilateral_interface.QuadrilateralInterface - a model defined in OpenAPI Args: - shape_type (str): quadrilateral_type (str): Keyword Args: @@ -147,7 +144,6 @@ def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_serve self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes - self.shape_type = shape_type self.quadrilateral_type = quadrilateral_type for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py index 95fdf7ace7a7..b11a1fb90eef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py @@ -37,6 +37,11 @@ except ImportError: shape_interface = sys.modules[ 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] class ScaleneTriangle(ModelComposed): @@ -64,9 +69,6 @@ class ScaleneTriangle(ModelComposed): """ allowed_values = { - ('triangle_type',): { - 'SCALENETRIANGLE': "ScaleneTriangle", - }, } validations = { @@ -85,8 +87,8 @@ def openapi_types(): and the value is attribute type. """ return { - 'triangle_type': (str,), # noqa: E501 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 } @cached_property @@ -94,8 +96,8 @@ def discriminator(): return None attribute_map = { - 'triangle_type': 'triangleType', # noqa: E501 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 } required_properties = set([ @@ -111,14 +113,14 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, triangle_type='ScaleneTriangle', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """scalene_triangle.ScaleneTriangle - a model defined in OpenAPI Args: shape_type (str): + triangle_type (str): Keyword Args: - triangle_type (str): defaults to 'ScaleneTriangle', must be one of ["ScaleneTriangle", ] # noqa: E501 _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. @@ -164,8 +166,8 @@ def __init__(self, shape_type, triangle_type='ScaleneTriangle', _check_type=True '_visited_composed_classes': _visited_composed_classes, } required_args = { - 'triangle_type': triangle_type, 'shape_type': shape_type, + 'triangle_type': triangle_type, } # remove args whose value is Null because they are unset required_arg_names = list(required_args.keys()) @@ -207,6 +209,7 @@ def _composed_schemas(): ], 'allOf': [ shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, ], 'oneOf': [ ], diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py index dfd8fd7f6c64..1bcb8fcac812 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py @@ -89,6 +89,7 @@ def openapi_types(): return { 'shape_type': (str,), # noqa: E501 'quadrilateral_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 'shape_type': (str,), # noqa: E501 } @@ -105,6 +106,7 @@ def discriminator(): attribute_map = { 'shape_type': 'shapeType', # noqa: E501 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 'shape_type': 'shapeType', # noqa: E501 } @@ -121,12 +123,13 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, shape_type, quadrilateral_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """shape.Shape - a model defined in OpenAPI Args: shape_type (str): quadrilateral_type (str): + triangle_type (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -177,6 +180,7 @@ def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_serve required_args = { 'shape_type': shape_type, 'quadrilateral_type': quadrilateral_type, + 'triangle_type': triangle_type, } # remove args whose value is Null because they are unset required_arg_names = list(required_args.keys()) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py index d481ea40d15a..2cb9e5a51896 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py @@ -37,6 +37,11 @@ except ImportError: quadrilateral_interface = sys.modules[ 'petstore_api.models.quadrilateral_interface'] +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] class SimpleQuadrilateral(ModelComposed): @@ -204,6 +209,7 @@ def _composed_schemas(): ], 'allOf': [ quadrilateral_interface.QuadrilateralInterface, + shape_interface.ShapeInterface, ], 'oneOf': [ ], diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py index 57a182c8197a..4c1f77caafef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py @@ -125,13 +125,14 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, triangle_type, shape_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """triangle.Triangle - a model defined in OpenAPI Args: - shape_type (str): + triangle_type (str): Keyword Args: + shape_type (str): defaults to nulltype.Null # noqa: E501 _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. @@ -160,7 +161,6 @@ def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_it Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - triangle_type (str): [optional] # noqa: E501 """ self._data_store = {} @@ -179,6 +179,7 @@ def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_it } required_args = { 'shape_type': shape_type, + 'triangle_type': triangle_type, } # remove args whose value is Null because they are unset required_arg_names = list(required_args.keys()) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py index ac13b277d917..ecab19b380a2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py @@ -77,7 +77,6 @@ def openapi_types(): and the value is attribute type. """ return { - 'shape_type': (str,), # noqa: E501 'triangle_type': (str,), # noqa: E501 } @@ -86,7 +85,6 @@ def discriminator(): return None attribute_map = { - 'shape_type': 'shapeType', # noqa: E501 'triangle_type': 'triangleType', # noqa: E501 } @@ -102,11 +100,10 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """triangle_interface.TriangleInterface - a model defined in OpenAPI Args: - shape_type (str): triangle_type (str): Keyword Args: @@ -147,7 +144,6 @@ def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=Fal self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes - self.shape_type = shape_type self.triangle_type = triangle_type for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ From d9c170f1309bb95c56dfffe67eafbf8a436c3223 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 1 May 2020 10:30:37 -0700 Subject: [PATCH 6/8] Simplifies Shape schema definition, updates go+python-experimental samples --- ...odels-for-testing-with-http-signature.yaml | 3 - .../petstore_api/model_utils.py | 16 +- .../go-experimental/go-petstore/README.md | 11 ++ .../go-petstore/api/openapi.yaml | 60 ++++++++ .../go-petstore/docs/ComplexQuadrilateral.md | 78 ++++++++++ .../go-petstore/docs/EquilateralTriangle.md | 78 ++++++++++ .../go-petstore/docs/IsoscelesTriangle.md | 78 ++++++++++ .../go-petstore/docs/Quadrilateral.md | 14 ++ .../docs/QuadrilateralInterface.md | 51 +++++++ .../go-petstore/docs/ScaleneTriangle.md | 78 ++++++++++ .../go-experimental/go-petstore/docs/Shape.md | 14 ++ .../go-petstore/docs/ShapeInterface.md | 51 +++++++ .../go-petstore/docs/SimpleQuadrilateral.md | 78 ++++++++++ .../go-petstore/docs/Triangle.md | 14 ++ .../go-petstore/docs/TriangleInterface.md | 51 +++++++ .../model_complex_quadrilateral.go | 138 ++++++++++++++++++ .../go-petstore/model_equilateral_triangle.go | 138 ++++++++++++++++++ .../go-petstore/model_isosceles_triangle.go | 138 ++++++++++++++++++ .../go-petstore/model_quadrilateral.go | 96 ++++++++++++ .../model_quadrilateral_interface.go | 105 +++++++++++++ .../go-petstore/model_scalene_triangle.go | 138 ++++++++++++++++++ .../go-petstore/model_shape.go | 92 ++++++++++++ .../go-petstore/model_shape_interface.go | 105 +++++++++++++ .../go-petstore/model_simple_quadrilateral.go | 138 ++++++++++++++++++ .../go-petstore/model_triangle.go | 104 +++++++++++++ .../go-petstore/model_triangle_interface.go | 105 +++++++++++++ .../python-experimental/docs/Shape.md | 5 +- .../petstore_api/models/shape.py | 9 +- 28 files changed, 1970 insertions(+), 16 deletions(-) create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go create mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index cd72a2431a86..22105c0e022c 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1876,9 +1876,6 @@ components: required: - lengthCm Shape: - properties: - shapeType: - type: string oneOf: - $ref: '#/components/schemas/Triangle' - $ref: '#/components/schemas/Quadrilateral' 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 fc24324ca176..b51ca24d81fe 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -135,16 +135,12 @@ def __new__(cls, *args, **kwargs): # pick a new schema/class to instantiate because a discriminator # propertyName value was passed in - from_server = kwargs.get('_from_server', False) visited_composed_classes = kwargs.get('_visited_composed_classes', ()) if ( cls.discriminator is None or - from_server is False or cls in visited_composed_classes ): # we don't have a discriminator - # from_server is false which means that we are building this model - # on the client side # or we have already visited this class before and are sure that we # want to instantiate it this time @@ -154,6 +150,18 @@ def __new__(cls, *args, **kwargs): oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) oneof_anyof_child = new_cls in oneof_anyof_classes new_visited_composed_classes = [cls] diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md index 1467a6316fc8..e9121aa273b1 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md @@ -130,11 +130,13 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [ClassModel](docs/ClassModel.md) - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) - [Dog](docs/Dog.md) - [DogAllOf](docs/DogAllOf.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) @@ -151,6 +153,7 @@ Class | Method | HTTP request | Description - [InlineObject4](docs/InlineObject4.md) - [InlineObject5](docs/InlineObject5.md) - [InlineResponseDefault](docs/InlineResponseDefault.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) - [List](docs/List.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) @@ -166,10 +169,18 @@ Class | Method | HTTP request | Description - [OuterEnumInteger](docs/OuterEnumInteger.md) - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [Pet](docs/Pet.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Return](docs/Return.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) - [SpecialModelName](docs/SpecialModelName.md) - [Tag](docs/Tag.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) - [User](docs/User.md) - [Whale](docs/Whale.md) - [Zebra](docs/Zebra.md) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml index 8f1a907787d2..4ac43c4ec883 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1994,6 +1994,66 @@ components: required: - lengthCm type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + x-one-of-name: Shape + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + x-one-of-name: Triangle + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + x-one-of-name: Quadrilateral + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' inline_response_default: example: string: diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..4d2eaf638f92 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md @@ -0,0 +1,78 @@ +# ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | +**QuadrilateralType** | Pointer to **string** | | + +## Methods + +### NewComplexQuadrilateral + +`func NewComplexQuadrilateral(shapeType string, quadrilateralType string, ) *ComplexQuadrilateral` + +NewComplexQuadrilateral instantiates a new ComplexQuadrilateral object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewComplexQuadrilateralWithDefaults + +`func NewComplexQuadrilateralWithDefaults() *ComplexQuadrilateral` + +NewComplexQuadrilateralWithDefaults instantiates a new ComplexQuadrilateral object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *ComplexQuadrilateral) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *ComplexQuadrilateral) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *ComplexQuadrilateral) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + +### GetQuadrilateralType + +`func (o *ComplexQuadrilateral) GetQuadrilateralType() string` + +GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. + +### GetQuadrilateralTypeOk + +`func (o *ComplexQuadrilateral) GetQuadrilateralTypeOk() (*string, bool)` + +GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuadrilateralType + +`func (o *ComplexQuadrilateral) SetQuadrilateralType(v string)` + +SetQuadrilateralType sets QuadrilateralType field to given value. + + + +### AsQuadrilateral + +`func (s *ComplexQuadrilateral) AsQuadrilateral() Quadrilateral` + +Convenience method to wrap this instance of ComplexQuadrilateral in Quadrilateral + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..54349f81af3e --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md @@ -0,0 +1,78 @@ +# EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | +**TriangleType** | Pointer to **string** | | + +## Methods + +### NewEquilateralTriangle + +`func NewEquilateralTriangle(shapeType string, triangleType string, ) *EquilateralTriangle` + +NewEquilateralTriangle instantiates a new EquilateralTriangle object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewEquilateralTriangleWithDefaults + +`func NewEquilateralTriangleWithDefaults() *EquilateralTriangle` + +NewEquilateralTriangleWithDefaults instantiates a new EquilateralTriangle object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *EquilateralTriangle) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *EquilateralTriangle) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *EquilateralTriangle) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + +### GetTriangleType + +`func (o *EquilateralTriangle) GetTriangleType() string` + +GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. + +### GetTriangleTypeOk + +`func (o *EquilateralTriangle) GetTriangleTypeOk() (*string, bool)` + +GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTriangleType + +`func (o *EquilateralTriangle) SetTriangleType(v string)` + +SetTriangleType sets TriangleType field to given value. + + + +### AsTriangle + +`func (s *EquilateralTriangle) AsTriangle() Triangle` + +Convenience method to wrap this instance of EquilateralTriangle in Triangle + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..761610abffca --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md @@ -0,0 +1,78 @@ +# IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | +**TriangleType** | Pointer to **string** | | + +## Methods + +### NewIsoscelesTriangle + +`func NewIsoscelesTriangle(shapeType string, triangleType string, ) *IsoscelesTriangle` + +NewIsoscelesTriangle instantiates a new IsoscelesTriangle object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIsoscelesTriangleWithDefaults + +`func NewIsoscelesTriangleWithDefaults() *IsoscelesTriangle` + +NewIsoscelesTriangleWithDefaults instantiates a new IsoscelesTriangle object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *IsoscelesTriangle) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *IsoscelesTriangle) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *IsoscelesTriangle) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + +### GetTriangleType + +`func (o *IsoscelesTriangle) GetTriangleType() string` + +GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. + +### GetTriangleTypeOk + +`func (o *IsoscelesTriangle) GetTriangleTypeOk() (*string, bool)` + +GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTriangleType + +`func (o *IsoscelesTriangle) SetTriangleType(v string)` + +SetTriangleType sets TriangleType field to given value. + + + +### AsTriangle + +`func (s *IsoscelesTriangle) AsTriangle() Triangle` + +Convenience method to wrap this instance of IsoscelesTriangle in Triangle + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md new file mode 100644 index 000000000000..4ee835368123 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md @@ -0,0 +1,14 @@ +# Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralInterface** | **interface { GetQuadrilateralType() string }** | An interface that can hold any of the proper implementing types | + +## Methods + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..88f350c0a062 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md @@ -0,0 +1,51 @@ +# QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | Pointer to **string** | | + +## Methods + +### NewQuadrilateralInterface + +`func NewQuadrilateralInterface(quadrilateralType string, ) *QuadrilateralInterface` + +NewQuadrilateralInterface instantiates a new QuadrilateralInterface object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewQuadrilateralInterfaceWithDefaults + +`func NewQuadrilateralInterfaceWithDefaults() *QuadrilateralInterface` + +NewQuadrilateralInterfaceWithDefaults instantiates a new QuadrilateralInterface object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetQuadrilateralType + +`func (o *QuadrilateralInterface) GetQuadrilateralType() string` + +GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. + +### GetQuadrilateralTypeOk + +`func (o *QuadrilateralInterface) GetQuadrilateralTypeOk() (*string, bool)` + +GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuadrilateralType + +`func (o *QuadrilateralInterface) SetQuadrilateralType(v string)` + +SetQuadrilateralType sets QuadrilateralType field to given value. + + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..a3138beb72ba --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md @@ -0,0 +1,78 @@ +# ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | +**TriangleType** | Pointer to **string** | | + +## Methods + +### NewScaleneTriangle + +`func NewScaleneTriangle(shapeType string, triangleType string, ) *ScaleneTriangle` + +NewScaleneTriangle instantiates a new ScaleneTriangle object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewScaleneTriangleWithDefaults + +`func NewScaleneTriangleWithDefaults() *ScaleneTriangle` + +NewScaleneTriangleWithDefaults instantiates a new ScaleneTriangle object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *ScaleneTriangle) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *ScaleneTriangle) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *ScaleneTriangle) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + +### GetTriangleType + +`func (o *ScaleneTriangle) GetTriangleType() string` + +GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. + +### GetTriangleTypeOk + +`func (o *ScaleneTriangle) GetTriangleTypeOk() (*string, bool)` + +GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTriangleType + +`func (o *ScaleneTriangle) SetTriangleType(v string)` + +SetTriangleType sets TriangleType field to given value. + + + +### AsTriangle + +`func (s *ScaleneTriangle) AsTriangle() Triangle` + +Convenience method to wrap this instance of ScaleneTriangle in Triangle + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md new file mode 100644 index 000000000000..2fe54faa7f63 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md @@ -0,0 +1,14 @@ +# Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeInterface** | **interface { GetShapeType() string }** | An interface that can hold any of the proper implementing types | + +## Methods + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md new file mode 100644 index 000000000000..decb29b48368 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md @@ -0,0 +1,51 @@ +# ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | + +## Methods + +### NewShapeInterface + +`func NewShapeInterface(shapeType string, ) *ShapeInterface` + +NewShapeInterface instantiates a new ShapeInterface object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewShapeInterfaceWithDefaults + +`func NewShapeInterfaceWithDefaults() *ShapeInterface` + +NewShapeInterfaceWithDefaults instantiates a new ShapeInterface object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *ShapeInterface) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *ShapeInterface) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *ShapeInterface) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..bbc1634a3155 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md @@ -0,0 +1,78 @@ +# SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | Pointer to **string** | | +**QuadrilateralType** | Pointer to **string** | | + +## Methods + +### NewSimpleQuadrilateral + +`func NewSimpleQuadrilateral(shapeType string, quadrilateralType string, ) *SimpleQuadrilateral` + +NewSimpleQuadrilateral instantiates a new SimpleQuadrilateral object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSimpleQuadrilateralWithDefaults + +`func NewSimpleQuadrilateralWithDefaults() *SimpleQuadrilateral` + +NewSimpleQuadrilateralWithDefaults instantiates a new SimpleQuadrilateral object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetShapeType + +`func (o *SimpleQuadrilateral) GetShapeType() string` + +GetShapeType returns the ShapeType field if non-nil, zero value otherwise. + +### GetShapeTypeOk + +`func (o *SimpleQuadrilateral) GetShapeTypeOk() (*string, bool)` + +GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShapeType + +`func (o *SimpleQuadrilateral) SetShapeType(v string)` + +SetShapeType sets ShapeType field to given value. + + +### GetQuadrilateralType + +`func (o *SimpleQuadrilateral) GetQuadrilateralType() string` + +GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. + +### GetQuadrilateralTypeOk + +`func (o *SimpleQuadrilateral) GetQuadrilateralTypeOk() (*string, bool)` + +GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuadrilateralType + +`func (o *SimpleQuadrilateral) SetQuadrilateralType(v string)` + +SetQuadrilateralType sets QuadrilateralType field to given value. + + + +### AsQuadrilateral + +`func (s *SimpleQuadrilateral) AsQuadrilateral() Quadrilateral` + +Convenience method to wrap this instance of SimpleQuadrilateral in Quadrilateral + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md new file mode 100644 index 000000000000..5b15a44e2b9e --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md @@ -0,0 +1,14 @@ +# Triangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleInterface** | **interface { GetTriangleType() string }** | An interface that can hold any of the proper implementing types | + +## Methods + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md new file mode 100644 index 000000000000..c49320eca582 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md @@ -0,0 +1,51 @@ +# TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | Pointer to **string** | | + +## Methods + +### NewTriangleInterface + +`func NewTriangleInterface(triangleType string, ) *TriangleInterface` + +NewTriangleInterface instantiates a new TriangleInterface object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTriangleInterfaceWithDefaults + +`func NewTriangleInterfaceWithDefaults() *TriangleInterface` + +NewTriangleInterfaceWithDefaults instantiates a new TriangleInterface object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetTriangleType + +`func (o *TriangleInterface) GetTriangleType() string` + +GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. + +### GetTriangleTypeOk + +`func (o *TriangleInterface) GetTriangleTypeOk() (*string, bool)` + +GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTriangleType + +`func (o *TriangleInterface) SetTriangleType(v string)` + +SetTriangleType sets TriangleType field to given value. + + + +[[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/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go new file mode 100644 index 000000000000..6d88b554dcb0 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go @@ -0,0 +1,138 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ComplexQuadrilateral struct for ComplexQuadrilateral +type ComplexQuadrilateral struct { + ShapeType string `json:"shapeType"` + QuadrilateralType string `json:"quadrilateralType"` +} + +// NewComplexQuadrilateral instantiates a new ComplexQuadrilateral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewComplexQuadrilateral(shapeType string, quadrilateralType string, ) *ComplexQuadrilateral { + this := ComplexQuadrilateral{} + this.ShapeType = shapeType + this.QuadrilateralType = quadrilateralType + return &this +} + +// NewComplexQuadrilateralWithDefaults instantiates a new ComplexQuadrilateral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewComplexQuadrilateralWithDefaults() *ComplexQuadrilateral { + this := ComplexQuadrilateral{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *ComplexQuadrilateral) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *ComplexQuadrilateral) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *ComplexQuadrilateral) SetShapeType(v string) { + o.ShapeType = v +} + +// GetQuadrilateralType returns the QuadrilateralType field value +func (o *ComplexQuadrilateral) GetQuadrilateralType() string { + if o == nil { + var ret string + return ret + } + + return o.QuadrilateralType +} + +// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value +// and a boolean to check if the value has been set. +func (o *ComplexQuadrilateral) GetQuadrilateralTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.QuadrilateralType, true +} + +// SetQuadrilateralType sets field value +func (o *ComplexQuadrilateral) SetQuadrilateralType(v string) { + o.QuadrilateralType = v +} + +func (o ComplexQuadrilateral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + if true { + toSerialize["quadrilateralType"] = o.QuadrilateralType + } + return json.Marshal(toSerialize) +} + +// AsQuadrilateral wraps this instance of ComplexQuadrilateral in Quadrilateral +func (s *ComplexQuadrilateral) AsQuadrilateral() Quadrilateral { + return Quadrilateral{ QuadrilateralInterface: s } +} +type NullableComplexQuadrilateral struct { + value *ComplexQuadrilateral + isSet bool +} + +func (v NullableComplexQuadrilateral) Get() *ComplexQuadrilateral { + return v.value +} + +func (v *NullableComplexQuadrilateral) Set(val *ComplexQuadrilateral) { + v.value = val + v.isSet = true +} + +func (v NullableComplexQuadrilateral) IsSet() bool { + return v.isSet +} + +func (v *NullableComplexQuadrilateral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableComplexQuadrilateral(val *ComplexQuadrilateral) *NullableComplexQuadrilateral { + return &NullableComplexQuadrilateral{value: val, isSet: true} +} + +func (v NullableComplexQuadrilateral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableComplexQuadrilateral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go new file mode 100644 index 000000000000..b67c56b28d1a --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go @@ -0,0 +1,138 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// EquilateralTriangle struct for EquilateralTriangle +type EquilateralTriangle struct { + ShapeType string `json:"shapeType"` + TriangleType string `json:"triangleType"` +} + +// NewEquilateralTriangle instantiates a new EquilateralTriangle object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEquilateralTriangle(shapeType string, triangleType string, ) *EquilateralTriangle { + this := EquilateralTriangle{} + this.ShapeType = shapeType + this.TriangleType = triangleType + return &this +} + +// NewEquilateralTriangleWithDefaults instantiates a new EquilateralTriangle object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEquilateralTriangleWithDefaults() *EquilateralTriangle { + this := EquilateralTriangle{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *EquilateralTriangle) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *EquilateralTriangle) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *EquilateralTriangle) SetShapeType(v string) { + o.ShapeType = v +} + +// GetTriangleType returns the TriangleType field value +func (o *EquilateralTriangle) GetTriangleType() string { + if o == nil { + var ret string + return ret + } + + return o.TriangleType +} + +// GetTriangleTypeOk returns a tuple with the TriangleType field value +// and a boolean to check if the value has been set. +func (o *EquilateralTriangle) GetTriangleTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TriangleType, true +} + +// SetTriangleType sets field value +func (o *EquilateralTriangle) SetTriangleType(v string) { + o.TriangleType = v +} + +func (o EquilateralTriangle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + if true { + toSerialize["triangleType"] = o.TriangleType + } + return json.Marshal(toSerialize) +} + +// AsTriangle wraps this instance of EquilateralTriangle in Triangle +func (s *EquilateralTriangle) AsTriangle() Triangle { + return Triangle{ TriangleInterface: s } +} +type NullableEquilateralTriangle struct { + value *EquilateralTriangle + isSet bool +} + +func (v NullableEquilateralTriangle) Get() *EquilateralTriangle { + return v.value +} + +func (v *NullableEquilateralTriangle) Set(val *EquilateralTriangle) { + v.value = val + v.isSet = true +} + +func (v NullableEquilateralTriangle) IsSet() bool { + return v.isSet +} + +func (v *NullableEquilateralTriangle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEquilateralTriangle(val *EquilateralTriangle) *NullableEquilateralTriangle { + return &NullableEquilateralTriangle{value: val, isSet: true} +} + +func (v NullableEquilateralTriangle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEquilateralTriangle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go new file mode 100644 index 000000000000..5c4d45bd6b91 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go @@ -0,0 +1,138 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// IsoscelesTriangle struct for IsoscelesTriangle +type IsoscelesTriangle struct { + ShapeType string `json:"shapeType"` + TriangleType string `json:"triangleType"` +} + +// NewIsoscelesTriangle instantiates a new IsoscelesTriangle object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIsoscelesTriangle(shapeType string, triangleType string, ) *IsoscelesTriangle { + this := IsoscelesTriangle{} + this.ShapeType = shapeType + this.TriangleType = triangleType + return &this +} + +// NewIsoscelesTriangleWithDefaults instantiates a new IsoscelesTriangle object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIsoscelesTriangleWithDefaults() *IsoscelesTriangle { + this := IsoscelesTriangle{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *IsoscelesTriangle) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *IsoscelesTriangle) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *IsoscelesTriangle) SetShapeType(v string) { + o.ShapeType = v +} + +// GetTriangleType returns the TriangleType field value +func (o *IsoscelesTriangle) GetTriangleType() string { + if o == nil { + var ret string + return ret + } + + return o.TriangleType +} + +// GetTriangleTypeOk returns a tuple with the TriangleType field value +// and a boolean to check if the value has been set. +func (o *IsoscelesTriangle) GetTriangleTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TriangleType, true +} + +// SetTriangleType sets field value +func (o *IsoscelesTriangle) SetTriangleType(v string) { + o.TriangleType = v +} + +func (o IsoscelesTriangle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + if true { + toSerialize["triangleType"] = o.TriangleType + } + return json.Marshal(toSerialize) +} + +// AsTriangle wraps this instance of IsoscelesTriangle in Triangle +func (s *IsoscelesTriangle) AsTriangle() Triangle { + return Triangle{ TriangleInterface: s } +} +type NullableIsoscelesTriangle struct { + value *IsoscelesTriangle + isSet bool +} + +func (v NullableIsoscelesTriangle) Get() *IsoscelesTriangle { + return v.value +} + +func (v *NullableIsoscelesTriangle) Set(val *IsoscelesTriangle) { + v.value = val + v.isSet = true +} + +func (v NullableIsoscelesTriangle) IsSet() bool { + return v.isSet +} + +func (v *NullableIsoscelesTriangle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIsoscelesTriangle(val *IsoscelesTriangle) *NullableIsoscelesTriangle { + return &NullableIsoscelesTriangle{value: val, isSet: true} +} + +func (v NullableIsoscelesTriangle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIsoscelesTriangle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go new file mode 100644 index 000000000000..7d0aaaeccddc --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go @@ -0,0 +1,96 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// Quadrilateral struct for Quadrilateral +type Quadrilateral struct { + QuadrilateralInterface interface { GetQuadrilateralType() string } +} + +func (s Quadrilateral) MarshalJSON() ([]byte, error) { + return json.Marshal(s.QuadrilateralInterface) +} + +func (s *Quadrilateral) UnmarshalJSON(src []byte) error { + var err error + var unmarshaled map[string]interface{} + err = json.Unmarshal(src, &unmarshaled) + if err != nil { + return err + } + if v, ok := unmarshaled["quadrilateralType"]; ok { + switch v { + case "ComplexQuadrilateral": + var result *ComplexQuadrilateral = &ComplexQuadrilateral{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.QuadrilateralInterface = result + return nil + case "SimpleQuadrilateral": + var result *SimpleQuadrilateral = &SimpleQuadrilateral{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.QuadrilateralInterface = result + return nil + default: + return fmt.Errorf("No oneOf model has 'quadrilateralType' equal to %s", v) + } + } else { + return fmt.Errorf("Discriminator property 'quadrilateralType' not found in unmarshaled payload: %+v", unmarshaled) + } +} +// AsShape wraps this instance of Quadrilateral in Shape +func (s *Quadrilateral) AsShape() Shape { + return Shape{ ShapeInterface: s } +} +type NullableQuadrilateral struct { + value *Quadrilateral + isSet bool +} + +func (v NullableQuadrilateral) Get() *Quadrilateral { + return v.value +} + +func (v *NullableQuadrilateral) Set(val *Quadrilateral) { + v.value = val + v.isSet = true +} + +func (v NullableQuadrilateral) IsSet() bool { + return v.isSet +} + +func (v *NullableQuadrilateral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuadrilateral(val *Quadrilateral) *NullableQuadrilateral { + return &NullableQuadrilateral{value: val, isSet: true} +} + +func (v NullableQuadrilateral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuadrilateral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go new file mode 100644 index 000000000000..b62f3166f524 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go @@ -0,0 +1,105 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// QuadrilateralInterface struct for QuadrilateralInterface +type QuadrilateralInterface struct { + QuadrilateralType string `json:"quadrilateralType"` +} + +// NewQuadrilateralInterface instantiates a new QuadrilateralInterface object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuadrilateralInterface(quadrilateralType string, ) *QuadrilateralInterface { + this := QuadrilateralInterface{} + this.QuadrilateralType = quadrilateralType + return &this +} + +// NewQuadrilateralInterfaceWithDefaults instantiates a new QuadrilateralInterface object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuadrilateralInterfaceWithDefaults() *QuadrilateralInterface { + this := QuadrilateralInterface{} + return &this +} + +// GetQuadrilateralType returns the QuadrilateralType field value +func (o *QuadrilateralInterface) GetQuadrilateralType() string { + if o == nil { + var ret string + return ret + } + + return o.QuadrilateralType +} + +// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value +// and a boolean to check if the value has been set. +func (o *QuadrilateralInterface) GetQuadrilateralTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.QuadrilateralType, true +} + +// SetQuadrilateralType sets field value +func (o *QuadrilateralInterface) SetQuadrilateralType(v string) { + o.QuadrilateralType = v +} + +func (o QuadrilateralInterface) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["quadrilateralType"] = o.QuadrilateralType + } + return json.Marshal(toSerialize) +} + +type NullableQuadrilateralInterface struct { + value *QuadrilateralInterface + isSet bool +} + +func (v NullableQuadrilateralInterface) Get() *QuadrilateralInterface { + return v.value +} + +func (v *NullableQuadrilateralInterface) Set(val *QuadrilateralInterface) { + v.value = val + v.isSet = true +} + +func (v NullableQuadrilateralInterface) IsSet() bool { + return v.isSet +} + +func (v *NullableQuadrilateralInterface) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuadrilateralInterface(val *QuadrilateralInterface) *NullableQuadrilateralInterface { + return &NullableQuadrilateralInterface{value: val, isSet: true} +} + +func (v NullableQuadrilateralInterface) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuadrilateralInterface) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go new file mode 100644 index 000000000000..98dbf673dede --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go @@ -0,0 +1,138 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ScaleneTriangle struct for ScaleneTriangle +type ScaleneTriangle struct { + ShapeType string `json:"shapeType"` + TriangleType string `json:"triangleType"` +} + +// NewScaleneTriangle instantiates a new ScaleneTriangle object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewScaleneTriangle(shapeType string, triangleType string, ) *ScaleneTriangle { + this := ScaleneTriangle{} + this.ShapeType = shapeType + this.TriangleType = triangleType + return &this +} + +// NewScaleneTriangleWithDefaults instantiates a new ScaleneTriangle object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewScaleneTriangleWithDefaults() *ScaleneTriangle { + this := ScaleneTriangle{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *ScaleneTriangle) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *ScaleneTriangle) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *ScaleneTriangle) SetShapeType(v string) { + o.ShapeType = v +} + +// GetTriangleType returns the TriangleType field value +func (o *ScaleneTriangle) GetTriangleType() string { + if o == nil { + var ret string + return ret + } + + return o.TriangleType +} + +// GetTriangleTypeOk returns a tuple with the TriangleType field value +// and a boolean to check if the value has been set. +func (o *ScaleneTriangle) GetTriangleTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TriangleType, true +} + +// SetTriangleType sets field value +func (o *ScaleneTriangle) SetTriangleType(v string) { + o.TriangleType = v +} + +func (o ScaleneTriangle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + if true { + toSerialize["triangleType"] = o.TriangleType + } + return json.Marshal(toSerialize) +} + +// AsTriangle wraps this instance of ScaleneTriangle in Triangle +func (s *ScaleneTriangle) AsTriangle() Triangle { + return Triangle{ TriangleInterface: s } +} +type NullableScaleneTriangle struct { + value *ScaleneTriangle + isSet bool +} + +func (v NullableScaleneTriangle) Get() *ScaleneTriangle { + return v.value +} + +func (v *NullableScaleneTriangle) Set(val *ScaleneTriangle) { + v.value = val + v.isSet = true +} + +func (v NullableScaleneTriangle) IsSet() bool { + return v.isSet +} + +func (v *NullableScaleneTriangle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScaleneTriangle(val *ScaleneTriangle) *NullableScaleneTriangle { + return &NullableScaleneTriangle{value: val, isSet: true} +} + +func (v NullableScaleneTriangle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScaleneTriangle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go new file mode 100644 index 000000000000..42f2752fd2b0 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go @@ -0,0 +1,92 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// Shape struct for Shape +type Shape struct { + ShapeInterface interface { GetShapeType() string } +} + +func (s Shape) MarshalJSON() ([]byte, error) { + return json.Marshal(s.ShapeInterface) +} + +func (s *Shape) UnmarshalJSON(src []byte) error { + var err error + var unmarshaled map[string]interface{} + err = json.Unmarshal(src, &unmarshaled) + if err != nil { + return err + } + if v, ok := unmarshaled["shapeType"]; ok { + switch v { + case "Quadrilateral": + var result *Quadrilateral = &Quadrilateral{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.ShapeInterface = result + return nil + case "Triangle": + var result *Triangle = &Triangle{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.ShapeInterface = result + return nil + default: + return fmt.Errorf("No oneOf model has 'shapeType' equal to %s", v) + } + } else { + return fmt.Errorf("Discriminator property 'shapeType' not found in unmarshaled payload: %+v", unmarshaled) + } +} +type NullableShape struct { + value *Shape + isSet bool +} + +func (v NullableShape) Get() *Shape { + return v.value +} + +func (v *NullableShape) Set(val *Shape) { + v.value = val + v.isSet = true +} + +func (v NullableShape) IsSet() bool { + return v.isSet +} + +func (v *NullableShape) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShape(val *Shape) *NullableShape { + return &NullableShape{value: val, isSet: true} +} + +func (v NullableShape) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShape) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go new file mode 100644 index 000000000000..284fa3d369b8 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go @@ -0,0 +1,105 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ShapeInterface struct for ShapeInterface +type ShapeInterface struct { + ShapeType string `json:"shapeType"` +} + +// NewShapeInterface instantiates a new ShapeInterface object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewShapeInterface(shapeType string, ) *ShapeInterface { + this := ShapeInterface{} + this.ShapeType = shapeType + return &this +} + +// NewShapeInterfaceWithDefaults instantiates a new ShapeInterface object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewShapeInterfaceWithDefaults() *ShapeInterface { + this := ShapeInterface{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *ShapeInterface) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *ShapeInterface) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *ShapeInterface) SetShapeType(v string) { + o.ShapeType = v +} + +func (o ShapeInterface) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + return json.Marshal(toSerialize) +} + +type NullableShapeInterface struct { + value *ShapeInterface + isSet bool +} + +func (v NullableShapeInterface) Get() *ShapeInterface { + return v.value +} + +func (v *NullableShapeInterface) Set(val *ShapeInterface) { + v.value = val + v.isSet = true +} + +func (v NullableShapeInterface) IsSet() bool { + return v.isSet +} + +func (v *NullableShapeInterface) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShapeInterface(val *ShapeInterface) *NullableShapeInterface { + return &NullableShapeInterface{value: val, isSet: true} +} + +func (v NullableShapeInterface) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShapeInterface) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go new file mode 100644 index 000000000000..2d194983f567 --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go @@ -0,0 +1,138 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// SimpleQuadrilateral struct for SimpleQuadrilateral +type SimpleQuadrilateral struct { + ShapeType string `json:"shapeType"` + QuadrilateralType string `json:"quadrilateralType"` +} + +// NewSimpleQuadrilateral instantiates a new SimpleQuadrilateral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSimpleQuadrilateral(shapeType string, quadrilateralType string, ) *SimpleQuadrilateral { + this := SimpleQuadrilateral{} + this.ShapeType = shapeType + this.QuadrilateralType = quadrilateralType + return &this +} + +// NewSimpleQuadrilateralWithDefaults instantiates a new SimpleQuadrilateral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSimpleQuadrilateralWithDefaults() *SimpleQuadrilateral { + this := SimpleQuadrilateral{} + return &this +} + +// GetShapeType returns the ShapeType field value +func (o *SimpleQuadrilateral) GetShapeType() string { + if o == nil { + var ret string + return ret + } + + return o.ShapeType +} + +// GetShapeTypeOk returns a tuple with the ShapeType field value +// and a boolean to check if the value has been set. +func (o *SimpleQuadrilateral) GetShapeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShapeType, true +} + +// SetShapeType sets field value +func (o *SimpleQuadrilateral) SetShapeType(v string) { + o.ShapeType = v +} + +// GetQuadrilateralType returns the QuadrilateralType field value +func (o *SimpleQuadrilateral) GetQuadrilateralType() string { + if o == nil { + var ret string + return ret + } + + return o.QuadrilateralType +} + +// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value +// and a boolean to check if the value has been set. +func (o *SimpleQuadrilateral) GetQuadrilateralTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.QuadrilateralType, true +} + +// SetQuadrilateralType sets field value +func (o *SimpleQuadrilateral) SetQuadrilateralType(v string) { + o.QuadrilateralType = v +} + +func (o SimpleQuadrilateral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["shapeType"] = o.ShapeType + } + if true { + toSerialize["quadrilateralType"] = o.QuadrilateralType + } + return json.Marshal(toSerialize) +} + +// AsQuadrilateral wraps this instance of SimpleQuadrilateral in Quadrilateral +func (s *SimpleQuadrilateral) AsQuadrilateral() Quadrilateral { + return Quadrilateral{ QuadrilateralInterface: s } +} +type NullableSimpleQuadrilateral struct { + value *SimpleQuadrilateral + isSet bool +} + +func (v NullableSimpleQuadrilateral) Get() *SimpleQuadrilateral { + return v.value +} + +func (v *NullableSimpleQuadrilateral) Set(val *SimpleQuadrilateral) { + v.value = val + v.isSet = true +} + +func (v NullableSimpleQuadrilateral) IsSet() bool { + return v.isSet +} + +func (v *NullableSimpleQuadrilateral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSimpleQuadrilateral(val *SimpleQuadrilateral) *NullableSimpleQuadrilateral { + return &NullableSimpleQuadrilateral{value: val, isSet: true} +} + +func (v NullableSimpleQuadrilateral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSimpleQuadrilateral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go new file mode 100644 index 000000000000..00b1cbecf04f --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go @@ -0,0 +1,104 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// Triangle struct for Triangle +type Triangle struct { + TriangleInterface interface { GetTriangleType() string } +} + +func (s Triangle) MarshalJSON() ([]byte, error) { + return json.Marshal(s.TriangleInterface) +} + +func (s *Triangle) UnmarshalJSON(src []byte) error { + var err error + var unmarshaled map[string]interface{} + err = json.Unmarshal(src, &unmarshaled) + if err != nil { + return err + } + if v, ok := unmarshaled["triangleType"]; ok { + switch v { + case "EquilateralTriangle": + var result *EquilateralTriangle = &EquilateralTriangle{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.TriangleInterface = result + return nil + case "IsoscelesTriangle": + var result *IsoscelesTriangle = &IsoscelesTriangle{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.TriangleInterface = result + return nil + case "ScaleneTriangle": + var result *ScaleneTriangle = &ScaleneTriangle{} + err = json.Unmarshal(src, result) + if err != nil { + return err + } + s.TriangleInterface = result + return nil + default: + return fmt.Errorf("No oneOf model has 'triangleType' equal to %s", v) + } + } else { + return fmt.Errorf("Discriminator property 'triangleType' not found in unmarshaled payload: %+v", unmarshaled) + } +} +// AsShape wraps this instance of Triangle in Shape +func (s *Triangle) AsShape() Shape { + return Shape{ ShapeInterface: s } +} +type NullableTriangle struct { + value *Triangle + isSet bool +} + +func (v NullableTriangle) Get() *Triangle { + return v.value +} + +func (v *NullableTriangle) Set(val *Triangle) { + v.value = val + v.isSet = true +} + +func (v NullableTriangle) IsSet() bool { + return v.isSet +} + +func (v *NullableTriangle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTriangle(val *Triangle) *NullableTriangle { + return &NullableTriangle{value: val, isSet: true} +} + +func (v NullableTriangle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTriangle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go new file mode 100644 index 000000000000..e35ec4ebc8db --- /dev/null +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go @@ -0,0 +1,105 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// TriangleInterface struct for TriangleInterface +type TriangleInterface struct { + TriangleType string `json:"triangleType"` +} + +// NewTriangleInterface instantiates a new TriangleInterface object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTriangleInterface(triangleType string, ) *TriangleInterface { + this := TriangleInterface{} + this.TriangleType = triangleType + return &this +} + +// NewTriangleInterfaceWithDefaults instantiates a new TriangleInterface object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTriangleInterfaceWithDefaults() *TriangleInterface { + this := TriangleInterface{} + return &this +} + +// GetTriangleType returns the TriangleType field value +func (o *TriangleInterface) GetTriangleType() string { + if o == nil { + var ret string + return ret + } + + return o.TriangleType +} + +// GetTriangleTypeOk returns a tuple with the TriangleType field value +// and a boolean to check if the value has been set. +func (o *TriangleInterface) GetTriangleTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TriangleType, true +} + +// SetTriangleType sets field value +func (o *TriangleInterface) SetTriangleType(v string) { + o.TriangleType = v +} + +func (o TriangleInterface) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["triangleType"] = o.TriangleType + } + return json.Marshal(toSerialize) +} + +type NullableTriangleInterface struct { + value *TriangleInterface + isSet bool +} + +func (v NullableTriangleInterface) Get() *TriangleInterface { + return v.value +} + +func (v *NullableTriangleInterface) Set(val *TriangleInterface) { + v.value = val + v.isSet = true +} + +func (v NullableTriangleInterface) IsSet() bool { + return v.isSet +} + +func (v *NullableTriangleInterface) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTriangleInterface(val *TriangleInterface) *NullableTriangleInterface { + return &NullableTriangleInterface{value: val, isSet: true} +} + +func (v NullableTriangleInterface) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTriangleInterface) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/petstore/python-experimental/docs/Shape.md b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md index 05e9c57f8f8b..6fbc1b6d2c70 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/Shape.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md @@ -4,9 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shape_type** | **str** | | -**quadrilateral_type** | **str** | | -**triangle_type** | **str** | | -**shape_type** | **str** | | [optional] +**quadrilateral_type** | **str** | | defaults to nulltype.Null +**triangle_type** | **str** | | defaults to nulltype.Null [[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/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py index 1bcb8fcac812..29830c11ba29 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py @@ -90,7 +90,6 @@ def openapi_types(): 'shape_type': (str,), # noqa: E501 'quadrilateral_type': (str,), # noqa: E501 'triangle_type': (str,), # noqa: E501 - 'shape_type': (str,), # noqa: E501 } @cached_property @@ -107,7 +106,6 @@ def discriminator(): 'shape_type': 'shapeType', # noqa: E501 'quadrilateral_type': 'quadrilateralType', # noqa: E501 'triangle_type': 'triangleType', # noqa: E501 - 'shape_type': 'shapeType', # noqa: E501 } required_properties = set([ @@ -123,15 +121,15 @@ def discriminator(): ]) @convert_js_args_to_python_args - def __init__(self, shape_type, quadrilateral_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + def __init__(self, shape_type, quadrilateral_type=nulltype.Null, triangle_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """shape.Shape - a model defined in OpenAPI Args: shape_type (str): - quadrilateral_type (str): - triangle_type (str): Keyword Args: + quadrilateral_type (str): defaults to nulltype.Null # noqa: E501 + triangle_type (str): defaults to nulltype.Null # noqa: E501 _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. @@ -160,7 +158,6 @@ def __init__(self, shape_type, quadrilateral_type, triangle_type, _check_type=Tr Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - shape_type (str): [optional] # noqa: E501 """ self._data_store = {} From a5276ad8669073ffaaf611cdab40ef83f5d9c54c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 1 May 2020 11:57:37 -0700 Subject: [PATCH 7/8] Fixes python-experimental test_dog tests --- .../model_templates/method_init_composed.mustache | 2 +- .../model_templates/method_init_shared.mustache | 2 +- .../python/python-experimental/model_utils.mustache | 12 ++++++------ .../python-experimental/petstore_api/model_utils.py | 12 ++++++------ .../models/additional_properties_any_type.py | 2 +- .../models/additional_properties_array.py | 2 +- .../models/additional_properties_boolean.py | 2 +- .../models/additional_properties_class.py | 2 +- .../models/additional_properties_integer.py | 2 +- .../models/additional_properties_number.py | 2 +- .../models/additional_properties_object.py | 2 +- .../models/additional_properties_string.py | 2 +- .../petstore_api/models/animal.py | 2 +- .../petstore_api/models/api_response.py | 2 +- .../models/array_of_array_of_number_only.py | 2 +- .../petstore_api/models/array_of_number_only.py | 2 +- .../petstore_api/models/array_test.py | 2 +- .../petstore_api/models/capitalization.py | 2 +- .../python-experimental/petstore_api/models/cat.py | 4 ++-- .../petstore_api/models/cat_all_of.py | 2 +- .../petstore_api/models/category.py | 2 +- .../python-experimental/petstore_api/models/child.py | 4 ++-- .../petstore_api/models/child_all_of.py | 2 +- .../petstore_api/models/child_cat.py | 4 ++-- .../petstore_api/models/child_cat_all_of.py | 2 +- .../petstore_api/models/child_dog.py | 4 ++-- .../petstore_api/models/child_dog_all_of.py | 2 +- .../petstore_api/models/child_lizard.py | 4 ++-- .../petstore_api/models/child_lizard_all_of.py | 2 +- .../petstore_api/models/class_model.py | 2 +- .../petstore_api/models/client.py | 2 +- .../python-experimental/petstore_api/models/dog.py | 4 ++-- .../petstore_api/models/dog_all_of.py | 2 +- .../petstore_api/models/enum_arrays.py | 2 +- .../petstore_api/models/enum_class.py | 2 +- .../petstore_api/models/enum_test.py | 2 +- .../python-experimental/petstore_api/models/file.py | 2 +- .../petstore_api/models/file_schema_test_class.py | 2 +- .../petstore_api/models/format_test.py | 2 +- .../petstore_api/models/grandparent.py | 2 +- .../petstore_api/models/grandparent_animal.py | 2 +- .../petstore_api/models/has_only_read_only.py | 2 +- .../python-experimental/petstore_api/models/list.py | 2 +- .../petstore_api/models/map_test.py | 2 +- ...xed_properties_and_additional_properties_class.py | 2 +- .../petstore_api/models/model200_response.py | 2 +- .../petstore_api/models/model_return.py | 2 +- .../python-experimental/petstore_api/models/name.py | 2 +- .../petstore_api/models/number_only.py | 2 +- .../python-experimental/petstore_api/models/order.py | 2 +- .../petstore_api/models/outer_composite.py | 2 +- .../petstore_api/models/outer_enum.py | 2 +- .../petstore_api/models/outer_number.py | 2 +- .../petstore_api/models/parent.py | 4 ++-- .../petstore_api/models/parent_all_of.py | 2 +- .../petstore_api/models/parent_pet.py | 4 ++-- .../python-experimental/petstore_api/models/pet.py | 2 +- .../petstore_api/models/player.py | 2 +- .../petstore_api/models/read_only_first.py | 2 +- .../petstore_api/models/special_model_name.py | 2 +- .../petstore_api/models/string_boolean_map.py | 2 +- .../python-experimental/petstore_api/models/tag.py | 2 +- .../petstore_api/models/type_holder_default.py | 2 +- .../petstore_api/models/type_holder_example.py | 2 +- .../python-experimental/petstore_api/models/user.py | 2 +- .../petstore_api/models/xml_item.py | 2 +- .../python-experimental/petstore_api/model_utils.py | 12 ++++++------ .../models/additional_properties_class.py | 2 +- .../petstore_api/models/address.py | 2 +- .../petstore_api/models/animal.py | 2 +- .../petstore_api/models/api_response.py | 2 +- .../python-experimental/petstore_api/models/apple.py | 2 +- .../petstore_api/models/apple_req.py | 2 +- .../models/array_of_array_of_number_only.py | 2 +- .../petstore_api/models/array_of_number_only.py | 2 +- .../petstore_api/models/array_test.py | 2 +- .../petstore_api/models/banana.py | 2 +- .../petstore_api/models/banana_req.py | 2 +- .../petstore_api/models/capitalization.py | 2 +- .../python-experimental/petstore_api/models/cat.py | 4 ++-- .../petstore_api/models/cat_all_of.py | 2 +- .../petstore_api/models/category.py | 2 +- .../petstore_api/models/class_model.py | 2 +- .../petstore_api/models/client.py | 2 +- .../petstore_api/models/complex_quadrilateral.py | 4 ++-- .../python-experimental/petstore_api/models/dog.py | 4 ++-- .../petstore_api/models/dog_all_of.py | 2 +- .../petstore_api/models/enum_arrays.py | 2 +- .../petstore_api/models/enum_class.py | 2 +- .../petstore_api/models/enum_test.py | 2 +- .../petstore_api/models/equilateral_triangle.py | 4 ++-- .../python-experimental/petstore_api/models/file.py | 2 +- .../petstore_api/models/file_schema_test_class.py | 2 +- .../python-experimental/petstore_api/models/foo.py | 2 +- .../petstore_api/models/format_test.py | 2 +- .../python-experimental/petstore_api/models/fruit.py | 4 ++-- .../petstore_api/models/fruit_req.py | 4 ++-- .../petstore_api/models/gm_fruit.py | 4 ++-- .../petstore_api/models/has_only_read_only.py | 2 +- .../petstore_api/models/health_check_result.py | 2 +- .../petstore_api/models/inline_object.py | 2 +- .../petstore_api/models/inline_object1.py | 2 +- .../petstore_api/models/inline_object2.py | 2 +- .../petstore_api/models/inline_object3.py | 2 +- .../petstore_api/models/inline_object4.py | 2 +- .../petstore_api/models/inline_object5.py | 2 +- .../petstore_api/models/inline_response_default.py | 2 +- .../petstore_api/models/isosceles_triangle.py | 4 ++-- .../python-experimental/petstore_api/models/list.py | 2 +- .../petstore_api/models/mammal.py | 4 ++-- .../petstore_api/models/map_test.py | 2 +- ...xed_properties_and_additional_properties_class.py | 2 +- .../petstore_api/models/model200_response.py | 2 +- .../petstore_api/models/model_return.py | 2 +- .../python-experimental/petstore_api/models/name.py | 2 +- .../petstore_api/models/nullable_class.py | 2 +- .../petstore_api/models/number_only.py | 2 +- .../python-experimental/petstore_api/models/order.py | 2 +- .../petstore_api/models/outer_composite.py | 2 +- .../petstore_api/models/outer_enum.py | 2 +- .../petstore_api/models/outer_enum_default_value.py | 2 +- .../petstore_api/models/outer_enum_integer.py | 2 +- .../models/outer_enum_integer_default_value.py | 2 +- .../python-experimental/petstore_api/models/pet.py | 2 +- .../petstore_api/models/quadrilateral.py | 4 ++-- .../petstore_api/models/quadrilateral_interface.py | 2 +- .../petstore_api/models/read_only_first.py | 2 +- .../petstore_api/models/scalene_triangle.py | 4 ++-- .../python-experimental/petstore_api/models/shape.py | 4 ++-- .../petstore_api/models/shape_interface.py | 2 +- .../petstore_api/models/simple_quadrilateral.py | 4 ++-- .../petstore_api/models/special_model_name.py | 2 +- .../petstore_api/models/string_boolean_map.py | 2 +- .../python-experimental/petstore_api/models/tag.py | 2 +- .../petstore_api/models/triangle.py | 4 ++-- .../petstore_api/models/triangle_interface.py | 2 +- .../python-experimental/petstore_api/models/user.py | 2 +- .../python-experimental/petstore_api/models/whale.py | 2 +- .../python-experimental/petstore_api/models/zebra.py | 2 +- 139 files changed, 176 insertions(+), 176 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache index 1acfe48a4679..a5d948f0dd8c 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache @@ -17,7 +17,7 @@ '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { {{#requiredVars}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache index d9b8146006a8..1631d57eec29 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache @@ -57,4 +57,4 @@ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes \ No newline at end of file + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) \ No newline at end of file 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 f49f52de8b00..e6b1df6b0e99 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 @@ -73,7 +73,6 @@ class OpenApiModel(object): # we don't have a discriminator # or we have already visited this class before and are sure that we # want to instantiate it this time - return super(OpenApiModel, cls).__new__(cls) oneof_anyof_classes = [] @@ -92,12 +91,13 @@ class OpenApiModel(object): "property '%s'='%s' at path: %s" % (disc_prop_name_js, disc_prop_value, path_to_item) ) - oneof_anyof_child = new_cls in oneof_anyof_classes - new_visited_composed_classes = [cls] - new_visited_composed_classes.extend( - visited_composed_classes) - kwargs['_visited_composed_classes'] = new_visited_composed_classes + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) if cls._composed_schemas.get('allOf') and oneof_anyof_child: # validate that we can make self because when we make the 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 b51ca24d81fe..519b5f7a5ed5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -143,7 +143,6 @@ def __new__(cls, *args, **kwargs): # we don't have a discriminator # or we have already visited this class before and are sure that we # want to instantiate it this time - return super(OpenApiModel, cls).__new__(cls) oneof_anyof_classes = [] @@ -162,12 +161,13 @@ def __new__(cls, *args, **kwargs): "property '%s'='%s' at path: %s" % (disc_prop_name_js, disc_prop_value, path_to_item) ) - oneof_anyof_child = new_cls in oneof_anyof_classes - new_visited_composed_classes = [cls] - new_visited_composed_classes.extend( - visited_composed_classes) - kwargs['_visited_composed_classes'] = new_visited_composed_classes + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) if cls._composed_schemas.get('allOf') and oneof_anyof_child: # validate that we can make self because when we make the 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 f508aab03435..4fec91d87358 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 551aba6b0ccf..345d5c970c9c 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 63b5559a3e33..22b604b631f7 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 b42be293109b..4ef564793dc0 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 @@ -170,7 +170,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 f3b20d4d6c50..c309826f2e82 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 85ce9bced018..8bbd629023ea 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 083505550369..749e3ada66e5 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 ba3121804e6c..88fb6a5e15bc 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 aa7fe3344172..34ae2ab23ef5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -161,7 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): 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 5628f7a84cd9..aa85a8d32c8e 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 @@ -146,7 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 37e19948ae4c..8648ca8e101e 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 87ec314f1db3..b457b27a8cb5 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 56d997011e27..3733298e843c 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 @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 2513965e7753..3ca42fba60be 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -155,7 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 f7fe29d74a12..d2ce6b29c10a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -163,14 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, 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 6dd21864b99b..f008695b43ac 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 fd2ff82d821f..b34ba8ac0206 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/category.py @@ -145,7 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): 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 64bddbc0d92d..3587e28fdcb7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child.py @@ -157,14 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } 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 e28fb9523d3e..c416862240f8 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 da09bf043f07..4493cc514bb3 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 @@ -160,14 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, 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 2ea89c1bb33d..2f0cf1bdc607 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 508c64149709..9df796705c99 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 @@ -160,14 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, 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 018c1f881436..1ab97028ee48 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 b5b8f816ac99..f42269372ea8 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 @@ -160,14 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, 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 19fe2b9d009b..41bd842225fd 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 311a3cca302c..a492a47164e7 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 edbdfbe4efd5..195e3d4209ca 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/client.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 afc263ecba22..edf89695f8fa 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -163,14 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, 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 b54f91acd136..6278289267d5 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 c3fb4045aa6f..107e1f3e0f8f 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 @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 b020b85feda2..4323ac7f0856 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 @@ -139,7 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): 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 54c01fc92e3d..160db49fd14c 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 @@ -177,7 +177,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): 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 ed4e931c3039..0f21a84df498 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 9f7c01bdab56..2715cfdbfd55 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 @@ -148,7 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 afa34076ce34..b22bc0b30527 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 @@ -213,7 +213,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.byte = byte 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 7a0e89836e92..bb5188acaf02 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 46570c006e84..e87b751a0ee7 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 @@ -170,7 +170,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.pet_type = pet_type for var_name, var_value in six.iteritems(kwargs): 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 ecaa14013316..974136a56a6f 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 @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 1e741e0dc1cf..3f85acb2e4d3 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/list.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 1aa0758ee71a..e3510cef772f 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 @@ -158,7 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 8f0b53d56021..36f5add3db88 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 @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 4dba63ec23ab..96d39402d563 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 @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 517e430adfd4..f9213c37ea7e 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 d0fd87292d0d..b2fce89ec9b7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/name.py @@ -151,7 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): 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 9fcc65fbdf7e..896757360765 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 f88078f1601b..6ff62a572333 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/order.py @@ -160,7 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 2b65f7e8b688..d34d654e0845 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 @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 e645856c8050..e85ac1b87ebb 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 @@ -139,7 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): 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 40b7b5b48691..df65a2d3d047 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 @@ -138,7 +138,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): 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 a530fa9a3f09..16bb62ed0fbd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent.py @@ -154,14 +154,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } 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 f663f122ce0b..6ee6983a4abc 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 c7581ddcc376..8d708aadf4fb 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 @@ -170,14 +170,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, 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 e505674a8ce7..1b34db901312 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/pet.py @@ -172,7 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name self.photo_urls = photo_urls diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/models/player.py index 46806601dca7..147bf2ff6f97 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/player.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/player.py @@ -145,7 +145,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): 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 87416ef84e47..8c6d80c71f16 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 @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 4de5bb810cb9..168554fa343e 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 @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 2b5d5d49a3bc..10d0a9882261 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 @@ -137,7 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 79fe23234bf1..fdd4ff690009 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/tag.py @@ -146,7 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 62da560a4a5a..442f9837881b 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 @@ -160,7 +160,7 @@ def __init__(self, array_item, string_item='what', number_item=1.234, integer_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.string_item = string_item self.number_item = number_item 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 d2c905b01749..0c08758bf04a 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 @@ -163,7 +163,7 @@ def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.string_item = string_item self.number_item = number_item 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 c66e2abfdfda..1f1095d3773c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/user.py @@ -161,7 +161,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ 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 679aa7a3e0c0..aad4db483aa4 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 @@ -224,7 +224,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py index b51ca24d81fe..519b5f7a5ed5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py @@ -143,7 +143,6 @@ def __new__(cls, *args, **kwargs): # we don't have a discriminator # or we have already visited this class before and are sure that we # want to instantiate it this time - return super(OpenApiModel, cls).__new__(cls) oneof_anyof_classes = [] @@ -162,12 +161,13 @@ def __new__(cls, *args, **kwargs): "property '%s'='%s' at path: %s" % (disc_prop_name_js, disc_prop_value, path_to_item) ) - oneof_anyof_child = new_cls in oneof_anyof_classes - new_visited_composed_classes = [cls] - new_visited_composed_classes.extend( - visited_composed_classes) - kwargs['_visited_composed_classes'] = new_visited_composed_classes + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) if cls._composed_schemas.get('allOf') and oneof_anyof_child: # validate that we can make self because when we make the diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index 950ae9091d56..0dc65073d31e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py index 917cced8798c..a8a541d6c21c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py @@ -137,7 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py index aa7fe3344172..34ae2ab23ef5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py @@ -161,7 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py index 5628f7a84cd9..aa85a8d32c8e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -146,7 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py index 57503971e97a..cf86835a3295 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py index 32d50657b5bc..e0209f490b43 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py @@ -145,7 +145,7 @@ def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.cultivar = cultivar for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index 37e19948ae4c..8648ca8e101e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index 87ec314f1db3..b457b27a8cb5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py index 56d997011e27..3733298e843c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py index 327c130683e2..ea8e0969a483 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py index 4c4eaaf09df1..180a51d33a62 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py @@ -145,7 +145,7 @@ def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_ite self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.length_cm = length_cm for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py index 2513965e7753..3ca42fba60be 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -155,7 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py index 6bb8e9b9f452..a99db498e685 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py @@ -168,14 +168,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 6dd21864b99b..f008695b43ac 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py index fd2ff82d821f..b34ba8ac0206 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py @@ -145,7 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py index 311a3cca302c..a492a47164e7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py index edbdfbe4efd5..195e3d4209ca 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py index 9ee853d7bf02..0be63bdcd2d6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py @@ -156,14 +156,14 @@ def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_serve self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py index afc263ecba22..edf89695f8fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py @@ -163,14 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index b54f91acd136..6278289267d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index c3fb4045aa6f..107e1f3e0f8f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py index b020b85feda2..4323ac7f0856 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -139,7 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py index 680829a718d5..83043b7c4315 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -201,7 +201,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py index db714188c8d8..90c79fd2bbcc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py @@ -156,14 +156,14 @@ def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=Fal self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py index ed4e931c3039..0f21a84df498 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index 9f7c01bdab56..2715cfdbfd55 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -148,7 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py index 9c43bc336434..6e88c734c966 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py index b13c5b455314..e3084b719111 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -225,7 +225,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.byte = byte diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py index 6f5c01a01497..dd0d21e3315b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py @@ -157,14 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py index fb0b59421d6c..a1836e551c0e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py @@ -162,14 +162,14 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'cultivar': cultivar, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py index 0db2df81ce8e..9afdc0ecc95b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py @@ -157,14 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index ecaa14013316..974136a56a6f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py index cc82d5014119..662cf79189ff 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py index a3ea1af67022..5de65e44476e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py index 03e940f13607..03ec7a1908c9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py index 0035ebf9795d..701f8f8985b9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py @@ -152,7 +152,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py index 2f0b7b3ea0bf..e720690a0550 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py @@ -215,7 +215,7 @@ def __init__(self, number, double, pattern_without_delimiter, byte, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.double = double diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py index 001b9c6ee647..dd5ade491376 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py @@ -145,7 +145,7 @@ def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.param = param self.param2 = param2 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py index 15df0bd14625..b133b4026884 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py @@ -145,7 +145,7 @@ def __init__(self, required_file, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.required_file = required_file for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py index ecc7c1809612..1ef604607e67 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py @@ -145,7 +145,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py index 4eebf89debe3..6ef7500c2c62 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py @@ -156,14 +156,14 @@ def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=Fal self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py index 1e741e0dc1cf..3f85acb2e4d3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py index d8e0a748b794..d57315bdd61a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py @@ -173,14 +173,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py index 1aa0758ee71a..e3510cef772f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -158,7 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index 8f0b53d56021..36f5add3db88 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -151,7 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py index 4dba63ec23ab..96d39402d563 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py index 517e430adfd4..f9213c37ea7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py index d0fd87292d0d..b2fce89ec9b7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py @@ -151,7 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py index 8ca71ac679d5..89d8720a969c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py @@ -173,7 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py index 9fcc65fbdf7e..896757360765 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py index f88078f1601b..6ff62a572333 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py @@ -160,7 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py index ac4e47868afa..da7cbd159058 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -146,7 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py index 29f0976dcb93..7c09a5b8d59a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -140,7 +140,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py index b72b3d3a0b8c..fdc882ee5dba 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py @@ -139,7 +139,7 @@ def __init__(self, value='placed', _check_type=True, _from_server=False, _path_t self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py index 32340d24cf71..187a714b33bf 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py @@ -139,7 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py index ec814530590e..41da57604fc8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py @@ -139,7 +139,7 @@ def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py index e505674a8ce7..1b34db901312 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py @@ -172,7 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name self.photo_urls = photo_urls diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py index bcccf99fc178..30443f766f02 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py @@ -162,14 +162,14 @@ def __init__(self, quadrilateral_type, shape_type=nulltype.Null, _check_type=Tru self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py index 7de7a8ea1172..2f60ea9362dc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py @@ -142,7 +142,7 @@ def __init__(self, quadrilateral_type, _check_type=True, _from_server=False, _pa self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.quadrilateral_type = quadrilateral_type for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 87416ef84e47..8c6d80c71f16 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py index b11a1fb90eef..8a9b46fd4c6f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py @@ -156,14 +156,14 @@ def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=Fal self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py index 29830c11ba29..bb8ec6d238ec 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py @@ -165,14 +165,14 @@ def __init__(self, shape_type, quadrilateral_type=nulltype.Null, triangle_type=n self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py index bab7ca2eed55..1152adfc8a48 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py @@ -142,7 +142,7 @@ def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.shape_type = shape_type for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py index 2cb9e5a51896..cd92ebf412e8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py @@ -156,14 +156,14 @@ def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_serve self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py index 4de5bb810cb9..168554fa343e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -140,7 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py index 2b5d5d49a3bc..10d0a9882261 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py @@ -137,7 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py index 883923793b74..26cdd6f50922 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py @@ -143,7 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py index 4c1f77caafef..fb3536503993 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py @@ -168,14 +168,14 @@ def __init__(self, triangle_type, shape_type=nulltype.Null, _check_type=True, _f self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, - '_visited_composed_classes': _visited_composed_classes, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'shape_type': shape_type, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py index ecab19b380a2..5881e3c94728 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py @@ -142,7 +142,7 @@ def __init__(self, triangle_type, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.triangle_type = triangle_type for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py index 6fac2f3e490e..7a571040a2fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py @@ -173,7 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py index 7cbf59ed0199..c89497b6b556 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py @@ -148,7 +148,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py index 0db6b19c02e5..53c8a1dc2dee 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py @@ -150,7 +150,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): From 758b400d6b6936a68e66ee48e7c7f0da6faefd7d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 3 May 2020 10:06:41 -0700 Subject: [PATCH 8/8] Separates off python-experimental spec --- bin/openapi3/python-experimental-petstore.sh | 2 +- ...odels-for-testing-with-http-signature.yaml | 57 - ...odels-for-testing-with-http-signature.yaml | 1936 +++++++++++++++++ .../go-experimental/go-petstore/README.md | 11 - .../go-petstore/api/openapi.yaml | 60 - .../go-petstore/docs/ComplexQuadrilateral.md | 78 - .../go-petstore/docs/EquilateralTriangle.md | 78 - .../go-petstore/docs/IsoscelesTriangle.md | 78 - .../go-petstore/docs/Quadrilateral.md | 14 - .../docs/QuadrilateralInterface.md | 51 - .../go-petstore/docs/ScaleneTriangle.md | 78 - .../go-experimental/go-petstore/docs/Shape.md | 14 - .../go-petstore/docs/ShapeInterface.md | 51 - .../go-petstore/docs/SimpleQuadrilateral.md | 78 - .../go-petstore/docs/Triangle.md | 14 - .../go-petstore/docs/TriangleInterface.md | 51 - .../model_complex_quadrilateral.go | 138 -- .../go-petstore/model_equilateral_triangle.go | 138 -- .../go-petstore/model_isosceles_triangle.go | 138 -- .../go-petstore/model_quadrilateral.go | 96 - .../model_quadrilateral_interface.go | 105 - .../go-petstore/model_scalene_triangle.go | 138 -- .../go-petstore/model_shape.go | 92 - .../go-petstore/model_shape_interface.go | 105 - .../go-petstore/model_simple_quadrilateral.go | 138 -- .../go-petstore/model_triangle.go | 104 - .../go-petstore/model_triangle_interface.go | 105 - 27 files changed, 1937 insertions(+), 2011 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go delete mode 100644 samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go diff --git a/bin/openapi3/python-experimental-petstore.sh b/bin/openapi3/python-experimental-petstore.sh index 71cd902dee57..20d0595485c3 100755 --- a/bin/openapi3/python-experimental-petstore.sh +++ b/bin/openapi3/python-experimental-petstore.sh @@ -28,7 +28,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" #yaml="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml" -yaml="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml" +yaml="modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml" ags="generate -t modules/openapi-generator/src/main/resources/python -i $yaml -g python-experimental -o samples/openapi3/client/petstore/python-experimental/ --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 22105c0e022c..74598c6ce709 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1875,60 +1875,3 @@ components: type: boolean required: - lengthCm - Shape: - oneOf: - - $ref: '#/components/schemas/Triangle' - - $ref: '#/components/schemas/Quadrilateral' - discriminator: - propertyName: shapeType - ShapeInterface: - properties: - shapeType: - type: string - required: - - shapeType - TriangleInterface: - properties: - triangleType: - type: string - required: - - triangleType - Triangle: - oneOf: - - $ref: '#/components/schemas/EquilateralTriangle' - - $ref: '#/components/schemas/IsoscelesTriangle' - - $ref: '#/components/schemas/ScaleneTriangle' - discriminator: - propertyName: triangleType - EquilateralTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - IsoscelesTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - ScaleneTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - QuadrilateralInterface: - properties: - quadrilateralType: - type: string - required: - - quadrilateralType - Quadrilateral: - oneOf: - - $ref: '#/components/schemas/SimpleQuadrilateral' - - $ref: '#/components/schemas/ComplexQuadrilateral' - discriminator: - propertyName: quadrilateralType - SimpleQuadrilateral: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/QuadrilateralInterface' - ComplexQuadrilateral: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/QuadrilateralInterface' diff --git a/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml new file mode 100644 index 000000000000..066d7f295127 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -0,0 +1,1936 @@ +openapi: 3.0.0 +info: + description: >- + This spec is mainly for testing Petstore server and contains fake endpoints, + models. Please do not use this for any other purpose. Special characters: " + \ + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /foo: + get: + responses: + default: + description: response + content: + application/json: + schema: + type: object + properties: + string: + $ref: '#/components/schemas/Foo' + /pet: + servers: + - url: 'http://petstore.swagger.io/v2' + - url: 'http://path-server-test.petstore.local/v2' + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '405': + description: Invalid input + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{order_id}': + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generated exceptions + operationId: getOrderById + parameters: + - name: order_id + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: order_id + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + /fake_classname_test: + patch: + tags: + - 'fake_classname_tags 123#$%^' + summary: To test class name in snake case + description: To test class name in snake case + operationId: testClassname + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + security: + - api_key_query: [] + requestBody: + $ref: '#/components/requestBodies/Client' + /fake: + patch: + tags: + - fake + summary: To test "client" model + description: To test "client" model + operationId: testClientModel + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + get: + tags: + - fake + summary: To test enum parameters + description: To test enum parameters + operationId: testEnumParameters + parameters: + - name: enum_header_string_array + in: header + description: Header parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_header_string + in: header + description: Header parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_string_array + in: query + description: Query parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_query_string + in: query + description: Query parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_integer + in: query + description: Query parameter enum test (double) + schema: + type: integer + format: int32 + enum: + - 1 + - -2 + - name: enum_query_double + in: query + description: Query parameter enum test (double) + schema: + type: number + format: double + enum: + - 1.1 + - -1.2 + responses: + '400': + description: Invalid request + '404': + description: Not found + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + enum_form_string: + description: Form parameter enum test (string) + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + post: + tags: + - fake + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - http_basic_test: [] + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + integer: + description: None + type: integer + minimum: 10 + maximum: 100 + int32: + description: None + type: integer + format: int32 + minimum: 20 + maximum: 200 + int64: + description: None + type: integer + format: int64 + number: + description: None + type: number + minimum: 32.1 + maximum: 543.2 + float: + description: None + type: number + format: float + maximum: 987.6 + double: + description: None + type: number + format: double + minimum: 67.8 + maximum: 123.4 + string: + description: None + type: string + pattern: '/[a-z]/i' + pattern_without_delimiter: + description: None + type: string + pattern: '^[A-Z].*' + byte: + description: None + type: string + format: byte + binary: + description: None + type: string + format: binary + date: + description: None + type: string + format: date + dateTime: + description: None + type: string + format: date-time + password: + description: None + type: string + format: password + minLength: 10 + maxLength: 64 + callback: + description: None + type: string + required: + - number + - double + - pattern_without_delimiter + - byte + delete: + tags: + - fake + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + x-group-parameters: true + parameters: + - name: required_string_group + in: query + description: Required String in group parameters + required: true + schema: + type: integer + - name: required_boolean_group + in: header + description: Required Boolean in group parameters + required: true + schema: + type: boolean + - name: required_int64_group + in: query + description: Required Integer in group parameters + required: true + schema: + type: integer + format: int64 + - name: string_group + in: query + description: String in group parameters + schema: + type: integer + - name: boolean_group + in: header + description: Boolean in group parameters + schema: + type: boolean + - name: int64_group + in: query + description: Integer in group parameters + schema: + type: integer + format: int64 + responses: + '400': + description: Someting wrong + /fake/outer/number: + post: + tags: + - fake + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + responses: + '200': + description: Output number + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + /fake/outer/string: + post: + tags: + - fake + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + responses: + '200': + description: Output string + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + /fake/outer/boolean: + post: + tags: + - fake + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + responses: + '200': + description: Output boolean + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + /fake/outer/composite: + post: + tags: + - fake + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + responses: + '200': + description: Output composite + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + /fake/jsonFormData: + get: + tags: + - fake + summary: test json serialization of form data + description: '' + operationId: testJsonFormData + responses: + '200': + description: successful operation + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + /fake/inline-additionalProperties: + post: + tags: + - fake + summary: test inline additionalProperties + description: '' + operationId: testInlineAdditionalProperties + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + type: object + additionalProperties: + type: string + description: request body + required: true + /fake/body-with-query-params: + put: + tags: + - fake + operationId: testBodyWithQueryParams + parameters: + - name: query + in: query + required: true + schema: + type: string + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + /another-fake/dummy: + patch: + tags: + - $another-fake? + summary: To test special tags + description: To test special tags and operation ID starting with number + operationId: '123_test_@#$%_special_tags' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + /fake/body-with-file-schema: + put: + tags: + - fake + description: >- + For this test, the body for this request much reference a schema named + `File`. + operationId: testBodyWithFileSchema + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + /fake/test-query-paramters: + put: + tags: + - fake + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - name: pipe + in: query + required: true + schema: + type: array + items: + type: string + - name: ioutil + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: http + in: query + required: true + style: spaceDelimited + schema: + type: array + items: + type: string + - name: url + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: context + in: query + required: true + explode: true + schema: + type: array + items: + type: string + responses: + "200": + description: Success + '/fake/{petId}/uploadImageWithRequiredFile': + post: + tags: + - pet + summary: uploads an image (required) + description: '' + operationId: uploadFileWithRequiredFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + type: string + format: binary + required: + - requiredFile + /fake/health: + get: + tags: + - fake + summary: Health check endpoint + responses: + 200: + description: The instance started successfully + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' +servers: + - url: 'http://{server}.swagger.io:{port}/v2' + description: petstore server + variables: + server: + enum: + - 'petstore' + - 'qa-petstore' + - 'dev-petstore' + default: 'petstore' + port: + enum: + - 80 + - 8080 + default: 80 + - url: https://localhost:8080/{version} + description: The local server + variables: + version: + enum: + - 'v1' + - 'v2' + default: 'v2' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + api_key_query: + type: apiKey + name: api_key_query + in: query + http_basic_test: + type: http + scheme: basic + bearer_test: + type: http + scheme: bearer + bearerFormat: JWT + http_signature_test: + # Test the 'HTTP signature' security scheme. + # Each HTTP request is cryptographically signed as specified + # in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ + type: http + scheme: signature + schemas: + Foo: + type: object + properties: + bar: + $ref: '#/components/schemas/Bar' + Bar: + type: string + default: bar + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + default: default-name + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + arbitraryObject: + type: object + description: test code generation for objects + Value must be a map of strings to values. It cannot be the 'null' value. + arbitraryNullableObject: + type: object + description: test code generation for nullable objects. + Value must be a map of strings to values or the 'null' value. + nullable: true + arbitraryTypeValue: + description: test code generation for any type + Value can be any type - string, number, boolean, array or object. + arbitraryNullableTypeValue: + description: test code generation for any type + Value can be any type - string, number, boolean, array, object or + the 'null' value. + nullable: true + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + property: + type: string + 123Number: + type: integer + readOnly: true + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - type: object + properties: + declawed: + type: boolean + Address: + type: object + additionalProperties: + type: integer + Animal: + type: object + discriminator: + propertyName: className + required: + - className + properties: + className: + type: string + color: + type: string + default: red + AnimalFarm: + type: array + items: + $ref: '#/components/schemas/Animal' + format_test: + type: object + required: + - number + - byte + - date + - password + properties: + integer: + type: integer + maximum: 100 + minimum: 10 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 + double: + type: number + format: double + maximum: 123.4 + minimum: 67.8 + string: + type: string + pattern: '/[a-z]/i' + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + password: + type: string + format: password + maxLength: 64 + minLength: 10 + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + type: string + pattern: '^\d{10}$' + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + type: string + pattern: '/^image_\d{1,3}$/i' + EnumClass: + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + Enum_Test: + type: object + required: + - enum_string_required + properties: + enum_string: + type: string + enum: + - UPPER + - lower + - '' + enum_string_required: + type: string + enum: + - UPPER + - lower + - '' + enum_integer: + type: integer + format: int32 + enum: + - 1 + - -1 + enum_number: + type: number + format: double + enum: + - 1.1 + - -1.2 + outerEnum: + $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + AdditionalPropertiesClass: + type: object + properties: + map_property: + type: object + additionalProperties: + type: string + map_of_map_property: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + MixedPropertiesAndAdditionalPropertiesClass: + type: object + properties: + uuid: + type: string + format: uuid + dateTime: + type: string + format: date-time + map: + type: object + additionalProperties: + $ref: '#/components/schemas/Animal' + List: + type: object + properties: + 123-list: + type: string + Client: + type: object + properties: + client: + type: string + ReadOnlyFirst: + type: object + properties: + bar: + type: string + readOnly: true + baz: + type: string + hasOnlyReadOnly: + type: object + properties: + bar: + type: string + readOnly: true + foo: + type: string + readOnly: true + Capitalization: + type: object + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + MapTest: + type: object + properties: + map_map_of_string: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + map_of_enum_string: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower + direct_map: + type: object + additionalProperties: + type: boolean + indirect_map: + $ref: '#/components/schemas/StringBooleanMap' + ArrayTest: + type: object + properties: + array_of_string: + type: array + items: + type: string + array_array_of_integer: + type: array + items: + type: array + items: + type: integer + format: int64 + array_array_of_model: + type: array + items: + type: array + items: + $ref: '#/components/schemas/ReadOnlyFirst' + NumberOnly: + type: object + properties: + JustNumber: + type: number + ArrayOfNumberOnly: + type: object + properties: + ArrayNumber: + type: array + items: + type: number + ArrayOfArrayOfNumberOnly: + type: object + properties: + ArrayArrayNumber: + type: array + items: + type: array + items: + type: number + EnumArrays: + type: object + properties: + just_symbol: + type: string + enum: + - '>=' + - $ + array_enum: + type: array + items: + type: string + enum: + - fish + - crab + OuterEnum: + nullable: true + type: string + enum: + - placed + - approved + - delivered + OuterEnumInteger: + type: integer + enum: + - 0 + - 1 + - 2 + OuterEnumDefaultValue: + type: string + enum: + - placed + - approved + - delivered + default: placed + OuterEnumIntegerDefaultValue: + type: integer + enum: + - 0 + - 1 + - 2 + default: 0 + OuterComposite: + type: object + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + FileSchemaTestClass: + type: object + properties: + file: + $ref: '#/components/schemas/File' + files: + type: array + items: + $ref: '#/components/schemas/File' + File: + type: object + description: Must be named `File` for test. + properties: + sourceURI: + description: Test capitalization + type: string + _special_model.name_: + properties: + '$special[property.name]': + type: integer + format: int64 + xml: + name: '$special[model.name]' + HealthCheckResult: + type: object + properties: + NullableMessage: + nullable: true + type: string + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + NullableClass: + type: object + properties: + integer_prop: + type: integer + nullable: true + number_prop: + type: number + nullable: true + boolean_prop: + type: boolean + nullable: true + string_prop: + type: string + nullable: true + date_prop: + type: string + format: date + nullable: true + datetime_prop: + type: string + format: date-time + nullable: true + array_nullable_prop: + type: array + nullable: true + items: + type: object + array_and_items_nullable_prop: + type: array + nullable: true + items: + type: object + nullable: true + array_items_nullable: + type: array + items: + type: object + nullable: true + object_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + object_and_items_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + object_items_nullable: + type: object + additionalProperties: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + fruit: + properties: + color: + type: string + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + apple: + type: object + properties: + cultivar: + type: string + banana: + type: object + properties: + lengthCm: + type: number + mammal: + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + discriminator: + propertyName: className + mapping: + whale: '#/components/schemas/whale' + zebra: '#/components/schemas/zebra' + whale: + type: object + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + zebra: + type: object + properties: + type: + type: string + enum: + - plains + - mountain + - grevys + className: + type: string + required: + - className + gmFruit: + properties: + color: + type: string + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + fruitReq: + oneOf: + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + appleReq: + type: object + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + bananaReq: + type: object + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + # go-experimental is unable to make Triangle and Quadrilateral models + # correctly https://github.com/OpenAPITools/openapi-generator/issues/6149 + Shape: + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + discriminator: + propertyName: triangleType + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + discriminator: + propertyName: quadrilateralType + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md index e9121aa273b1..1467a6316fc8 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/README.md @@ -130,13 +130,11 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [ClassModel](docs/ClassModel.md) - [Client](docs/Client.md) - - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) - [Dog](docs/Dog.md) - [DogAllOf](docs/DogAllOf.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - - [EquilateralTriangle](docs/EquilateralTriangle.md) - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) @@ -153,7 +151,6 @@ Class | Method | HTTP request | Description - [InlineObject4](docs/InlineObject4.md) - [InlineObject5](docs/InlineObject5.md) - [InlineResponseDefault](docs/InlineResponseDefault.md) - - [IsoscelesTriangle](docs/IsoscelesTriangle.md) - [List](docs/List.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) @@ -169,18 +166,10 @@ Class | Method | HTTP request | Description - [OuterEnumInteger](docs/OuterEnumInteger.md) - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [Pet](docs/Pet.md) - - [Quadrilateral](docs/Quadrilateral.md) - - [QuadrilateralInterface](docs/QuadrilateralInterface.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Return](docs/Return.md) - - [ScaleneTriangle](docs/ScaleneTriangle.md) - - [Shape](docs/Shape.md) - - [ShapeInterface](docs/ShapeInterface.md) - - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) - [SpecialModelName](docs/SpecialModelName.md) - [Tag](docs/Tag.md) - - [Triangle](docs/Triangle.md) - - [TriangleInterface](docs/TriangleInterface.md) - [User](docs/User.md) - [Whale](docs/Whale.md) - [Zebra](docs/Zebra.md) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml index 4ac43c4ec883..8f1a907787d2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1994,66 +1994,6 @@ components: required: - lengthCm type: object - Shape: - discriminator: - propertyName: shapeType - oneOf: - - $ref: '#/components/schemas/Triangle' - - $ref: '#/components/schemas/Quadrilateral' - x-one-of-name: Shape - ShapeInterface: - properties: - shapeType: - type: string - required: - - shapeType - TriangleInterface: - properties: - triangleType: - type: string - required: - - triangleType - Triangle: - discriminator: - propertyName: triangleType - oneOf: - - $ref: '#/components/schemas/EquilateralTriangle' - - $ref: '#/components/schemas/IsoscelesTriangle' - - $ref: '#/components/schemas/ScaleneTriangle' - x-one-of-name: Triangle - EquilateralTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - IsoscelesTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - ScaleneTriangle: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/TriangleInterface' - QuadrilateralInterface: - properties: - quadrilateralType: - type: string - required: - - quadrilateralType - Quadrilateral: - discriminator: - propertyName: quadrilateralType - oneOf: - - $ref: '#/components/schemas/SimpleQuadrilateral' - - $ref: '#/components/schemas/ComplexQuadrilateral' - x-one-of-name: Quadrilateral - SimpleQuadrilateral: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/QuadrilateralInterface' - ComplexQuadrilateral: - allOf: - - $ref: '#/components/schemas/ShapeInterface' - - $ref: '#/components/schemas/QuadrilateralInterface' inline_response_default: example: string: diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md deleted file mode 100644 index 4d2eaf638f92..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ComplexQuadrilateral.md +++ /dev/null @@ -1,78 +0,0 @@ -# ComplexQuadrilateral - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | -**QuadrilateralType** | Pointer to **string** | | - -## Methods - -### NewComplexQuadrilateral - -`func NewComplexQuadrilateral(shapeType string, quadrilateralType string, ) *ComplexQuadrilateral` - -NewComplexQuadrilateral instantiates a new ComplexQuadrilateral object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewComplexQuadrilateralWithDefaults - -`func NewComplexQuadrilateralWithDefaults() *ComplexQuadrilateral` - -NewComplexQuadrilateralWithDefaults instantiates a new ComplexQuadrilateral object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *ComplexQuadrilateral) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *ComplexQuadrilateral) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *ComplexQuadrilateral) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - -### GetQuadrilateralType - -`func (o *ComplexQuadrilateral) GetQuadrilateralType() string` - -GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. - -### GetQuadrilateralTypeOk - -`func (o *ComplexQuadrilateral) GetQuadrilateralTypeOk() (*string, bool)` - -GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetQuadrilateralType - -`func (o *ComplexQuadrilateral) SetQuadrilateralType(v string)` - -SetQuadrilateralType sets QuadrilateralType field to given value. - - - -### AsQuadrilateral - -`func (s *ComplexQuadrilateral) AsQuadrilateral() Quadrilateral` - -Convenience method to wrap this instance of ComplexQuadrilateral in Quadrilateral - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md deleted file mode 100644 index 54349f81af3e..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/EquilateralTriangle.md +++ /dev/null @@ -1,78 +0,0 @@ -# EquilateralTriangle - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | -**TriangleType** | Pointer to **string** | | - -## Methods - -### NewEquilateralTriangle - -`func NewEquilateralTriangle(shapeType string, triangleType string, ) *EquilateralTriangle` - -NewEquilateralTriangle instantiates a new EquilateralTriangle object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewEquilateralTriangleWithDefaults - -`func NewEquilateralTriangleWithDefaults() *EquilateralTriangle` - -NewEquilateralTriangleWithDefaults instantiates a new EquilateralTriangle object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *EquilateralTriangle) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *EquilateralTriangle) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *EquilateralTriangle) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - -### GetTriangleType - -`func (o *EquilateralTriangle) GetTriangleType() string` - -GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. - -### GetTriangleTypeOk - -`func (o *EquilateralTriangle) GetTriangleTypeOk() (*string, bool)` - -GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTriangleType - -`func (o *EquilateralTriangle) SetTriangleType(v string)` - -SetTriangleType sets TriangleType field to given value. - - - -### AsTriangle - -`func (s *EquilateralTriangle) AsTriangle() Triangle` - -Convenience method to wrap this instance of EquilateralTriangle in Triangle - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md deleted file mode 100644 index 761610abffca..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/IsoscelesTriangle.md +++ /dev/null @@ -1,78 +0,0 @@ -# IsoscelesTriangle - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | -**TriangleType** | Pointer to **string** | | - -## Methods - -### NewIsoscelesTriangle - -`func NewIsoscelesTriangle(shapeType string, triangleType string, ) *IsoscelesTriangle` - -NewIsoscelesTriangle instantiates a new IsoscelesTriangle object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewIsoscelesTriangleWithDefaults - -`func NewIsoscelesTriangleWithDefaults() *IsoscelesTriangle` - -NewIsoscelesTriangleWithDefaults instantiates a new IsoscelesTriangle object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *IsoscelesTriangle) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *IsoscelesTriangle) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *IsoscelesTriangle) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - -### GetTriangleType - -`func (o *IsoscelesTriangle) GetTriangleType() string` - -GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. - -### GetTriangleTypeOk - -`func (o *IsoscelesTriangle) GetTriangleTypeOk() (*string, bool)` - -GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTriangleType - -`func (o *IsoscelesTriangle) SetTriangleType(v string)` - -SetTriangleType sets TriangleType field to given value. - - - -### AsTriangle - -`func (s *IsoscelesTriangle) AsTriangle() Triangle` - -Convenience method to wrap this instance of IsoscelesTriangle in Triangle - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md deleted file mode 100644 index 4ee835368123..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Quadrilateral.md +++ /dev/null @@ -1,14 +0,0 @@ -# Quadrilateral - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**QuadrilateralInterface** | **interface { GetQuadrilateralType() string }** | An interface that can hold any of the proper implementing types | - -## Methods - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md deleted file mode 100644 index 88f350c0a062..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/QuadrilateralInterface.md +++ /dev/null @@ -1,51 +0,0 @@ -# QuadrilateralInterface - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**QuadrilateralType** | Pointer to **string** | | - -## Methods - -### NewQuadrilateralInterface - -`func NewQuadrilateralInterface(quadrilateralType string, ) *QuadrilateralInterface` - -NewQuadrilateralInterface instantiates a new QuadrilateralInterface object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewQuadrilateralInterfaceWithDefaults - -`func NewQuadrilateralInterfaceWithDefaults() *QuadrilateralInterface` - -NewQuadrilateralInterfaceWithDefaults instantiates a new QuadrilateralInterface object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetQuadrilateralType - -`func (o *QuadrilateralInterface) GetQuadrilateralType() string` - -GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. - -### GetQuadrilateralTypeOk - -`func (o *QuadrilateralInterface) GetQuadrilateralTypeOk() (*string, bool)` - -GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetQuadrilateralType - -`func (o *QuadrilateralInterface) SetQuadrilateralType(v string)` - -SetQuadrilateralType sets QuadrilateralType field to given value. - - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md deleted file mode 100644 index a3138beb72ba..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ScaleneTriangle.md +++ /dev/null @@ -1,78 +0,0 @@ -# ScaleneTriangle - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | -**TriangleType** | Pointer to **string** | | - -## Methods - -### NewScaleneTriangle - -`func NewScaleneTriangle(shapeType string, triangleType string, ) *ScaleneTriangle` - -NewScaleneTriangle instantiates a new ScaleneTriangle object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewScaleneTriangleWithDefaults - -`func NewScaleneTriangleWithDefaults() *ScaleneTriangle` - -NewScaleneTriangleWithDefaults instantiates a new ScaleneTriangle object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *ScaleneTriangle) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *ScaleneTriangle) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *ScaleneTriangle) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - -### GetTriangleType - -`func (o *ScaleneTriangle) GetTriangleType() string` - -GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. - -### GetTriangleTypeOk - -`func (o *ScaleneTriangle) GetTriangleTypeOk() (*string, bool)` - -GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTriangleType - -`func (o *ScaleneTriangle) SetTriangleType(v string)` - -SetTriangleType sets TriangleType field to given value. - - - -### AsTriangle - -`func (s *ScaleneTriangle) AsTriangle() Triangle` - -Convenience method to wrap this instance of ScaleneTriangle in Triangle - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md deleted file mode 100644 index 2fe54faa7f63..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Shape.md +++ /dev/null @@ -1,14 +0,0 @@ -# Shape - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeInterface** | **interface { GetShapeType() string }** | An interface that can hold any of the proper implementing types | - -## Methods - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md deleted file mode 100644 index decb29b48368..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/ShapeInterface.md +++ /dev/null @@ -1,51 +0,0 @@ -# ShapeInterface - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | - -## Methods - -### NewShapeInterface - -`func NewShapeInterface(shapeType string, ) *ShapeInterface` - -NewShapeInterface instantiates a new ShapeInterface object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewShapeInterfaceWithDefaults - -`func NewShapeInterfaceWithDefaults() *ShapeInterface` - -NewShapeInterfaceWithDefaults instantiates a new ShapeInterface object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *ShapeInterface) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *ShapeInterface) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *ShapeInterface) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md deleted file mode 100644 index bbc1634a3155..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/SimpleQuadrilateral.md +++ /dev/null @@ -1,78 +0,0 @@ -# SimpleQuadrilateral - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ShapeType** | Pointer to **string** | | -**QuadrilateralType** | Pointer to **string** | | - -## Methods - -### NewSimpleQuadrilateral - -`func NewSimpleQuadrilateral(shapeType string, quadrilateralType string, ) *SimpleQuadrilateral` - -NewSimpleQuadrilateral instantiates a new SimpleQuadrilateral object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewSimpleQuadrilateralWithDefaults - -`func NewSimpleQuadrilateralWithDefaults() *SimpleQuadrilateral` - -NewSimpleQuadrilateralWithDefaults instantiates a new SimpleQuadrilateral object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetShapeType - -`func (o *SimpleQuadrilateral) GetShapeType() string` - -GetShapeType returns the ShapeType field if non-nil, zero value otherwise. - -### GetShapeTypeOk - -`func (o *SimpleQuadrilateral) GetShapeTypeOk() (*string, bool)` - -GetShapeTypeOk returns a tuple with the ShapeType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetShapeType - -`func (o *SimpleQuadrilateral) SetShapeType(v string)` - -SetShapeType sets ShapeType field to given value. - - -### GetQuadrilateralType - -`func (o *SimpleQuadrilateral) GetQuadrilateralType() string` - -GetQuadrilateralType returns the QuadrilateralType field if non-nil, zero value otherwise. - -### GetQuadrilateralTypeOk - -`func (o *SimpleQuadrilateral) GetQuadrilateralTypeOk() (*string, bool)` - -GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetQuadrilateralType - -`func (o *SimpleQuadrilateral) SetQuadrilateralType(v string)` - -SetQuadrilateralType sets QuadrilateralType field to given value. - - - -### AsQuadrilateral - -`func (s *SimpleQuadrilateral) AsQuadrilateral() Quadrilateral` - -Convenience method to wrap this instance of SimpleQuadrilateral in Quadrilateral - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md deleted file mode 100644 index 5b15a44e2b9e..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Triangle.md +++ /dev/null @@ -1,14 +0,0 @@ -# Triangle - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**TriangleInterface** | **interface { GetTriangleType() string }** | An interface that can hold any of the proper implementing types | - -## Methods - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md deleted file mode 100644 index c49320eca582..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/TriangleInterface.md +++ /dev/null @@ -1,51 +0,0 @@ -# TriangleInterface - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**TriangleType** | Pointer to **string** | | - -## Methods - -### NewTriangleInterface - -`func NewTriangleInterface(triangleType string, ) *TriangleInterface` - -NewTriangleInterface instantiates a new TriangleInterface object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTriangleInterfaceWithDefaults - -`func NewTriangleInterfaceWithDefaults() *TriangleInterface` - -NewTriangleInterfaceWithDefaults instantiates a new TriangleInterface object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetTriangleType - -`func (o *TriangleInterface) GetTriangleType() string` - -GetTriangleType returns the TriangleType field if non-nil, zero value otherwise. - -### GetTriangleTypeOk - -`func (o *TriangleInterface) GetTriangleTypeOk() (*string, bool)` - -GetTriangleTypeOk returns a tuple with the TriangleType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTriangleType - -`func (o *TriangleInterface) SetTriangleType(v string)` - -SetTriangleType sets TriangleType field to given value. - - - -[[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/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go deleted file mode 100644 index 6d88b554dcb0..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_complex_quadrilateral.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// ComplexQuadrilateral struct for ComplexQuadrilateral -type ComplexQuadrilateral struct { - ShapeType string `json:"shapeType"` - QuadrilateralType string `json:"quadrilateralType"` -} - -// NewComplexQuadrilateral instantiates a new ComplexQuadrilateral object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewComplexQuadrilateral(shapeType string, quadrilateralType string, ) *ComplexQuadrilateral { - this := ComplexQuadrilateral{} - this.ShapeType = shapeType - this.QuadrilateralType = quadrilateralType - return &this -} - -// NewComplexQuadrilateralWithDefaults instantiates a new ComplexQuadrilateral object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewComplexQuadrilateralWithDefaults() *ComplexQuadrilateral { - this := ComplexQuadrilateral{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *ComplexQuadrilateral) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *ComplexQuadrilateral) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *ComplexQuadrilateral) SetShapeType(v string) { - o.ShapeType = v -} - -// GetQuadrilateralType returns the QuadrilateralType field value -func (o *ComplexQuadrilateral) GetQuadrilateralType() string { - if o == nil { - var ret string - return ret - } - - return o.QuadrilateralType -} - -// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value -// and a boolean to check if the value has been set. -func (o *ComplexQuadrilateral) GetQuadrilateralTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.QuadrilateralType, true -} - -// SetQuadrilateralType sets field value -func (o *ComplexQuadrilateral) SetQuadrilateralType(v string) { - o.QuadrilateralType = v -} - -func (o ComplexQuadrilateral) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - if true { - toSerialize["quadrilateralType"] = o.QuadrilateralType - } - return json.Marshal(toSerialize) -} - -// AsQuadrilateral wraps this instance of ComplexQuadrilateral in Quadrilateral -func (s *ComplexQuadrilateral) AsQuadrilateral() Quadrilateral { - return Quadrilateral{ QuadrilateralInterface: s } -} -type NullableComplexQuadrilateral struct { - value *ComplexQuadrilateral - isSet bool -} - -func (v NullableComplexQuadrilateral) Get() *ComplexQuadrilateral { - return v.value -} - -func (v *NullableComplexQuadrilateral) Set(val *ComplexQuadrilateral) { - v.value = val - v.isSet = true -} - -func (v NullableComplexQuadrilateral) IsSet() bool { - return v.isSet -} - -func (v *NullableComplexQuadrilateral) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableComplexQuadrilateral(val *ComplexQuadrilateral) *NullableComplexQuadrilateral { - return &NullableComplexQuadrilateral{value: val, isSet: true} -} - -func (v NullableComplexQuadrilateral) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableComplexQuadrilateral) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go deleted file mode 100644 index b67c56b28d1a..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_equilateral_triangle.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// EquilateralTriangle struct for EquilateralTriangle -type EquilateralTriangle struct { - ShapeType string `json:"shapeType"` - TriangleType string `json:"triangleType"` -} - -// NewEquilateralTriangle instantiates a new EquilateralTriangle object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewEquilateralTriangle(shapeType string, triangleType string, ) *EquilateralTriangle { - this := EquilateralTriangle{} - this.ShapeType = shapeType - this.TriangleType = triangleType - return &this -} - -// NewEquilateralTriangleWithDefaults instantiates a new EquilateralTriangle object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewEquilateralTriangleWithDefaults() *EquilateralTriangle { - this := EquilateralTriangle{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *EquilateralTriangle) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *EquilateralTriangle) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *EquilateralTriangle) SetShapeType(v string) { - o.ShapeType = v -} - -// GetTriangleType returns the TriangleType field value -func (o *EquilateralTriangle) GetTriangleType() string { - if o == nil { - var ret string - return ret - } - - return o.TriangleType -} - -// GetTriangleTypeOk returns a tuple with the TriangleType field value -// and a boolean to check if the value has been set. -func (o *EquilateralTriangle) GetTriangleTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TriangleType, true -} - -// SetTriangleType sets field value -func (o *EquilateralTriangle) SetTriangleType(v string) { - o.TriangleType = v -} - -func (o EquilateralTriangle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - if true { - toSerialize["triangleType"] = o.TriangleType - } - return json.Marshal(toSerialize) -} - -// AsTriangle wraps this instance of EquilateralTriangle in Triangle -func (s *EquilateralTriangle) AsTriangle() Triangle { - return Triangle{ TriangleInterface: s } -} -type NullableEquilateralTriangle struct { - value *EquilateralTriangle - isSet bool -} - -func (v NullableEquilateralTriangle) Get() *EquilateralTriangle { - return v.value -} - -func (v *NullableEquilateralTriangle) Set(val *EquilateralTriangle) { - v.value = val - v.isSet = true -} - -func (v NullableEquilateralTriangle) IsSet() bool { - return v.isSet -} - -func (v *NullableEquilateralTriangle) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableEquilateralTriangle(val *EquilateralTriangle) *NullableEquilateralTriangle { - return &NullableEquilateralTriangle{value: val, isSet: true} -} - -func (v NullableEquilateralTriangle) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableEquilateralTriangle) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go deleted file mode 100644 index 5c4d45bd6b91..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_isosceles_triangle.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// IsoscelesTriangle struct for IsoscelesTriangle -type IsoscelesTriangle struct { - ShapeType string `json:"shapeType"` - TriangleType string `json:"triangleType"` -} - -// NewIsoscelesTriangle instantiates a new IsoscelesTriangle object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewIsoscelesTriangle(shapeType string, triangleType string, ) *IsoscelesTriangle { - this := IsoscelesTriangle{} - this.ShapeType = shapeType - this.TriangleType = triangleType - return &this -} - -// NewIsoscelesTriangleWithDefaults instantiates a new IsoscelesTriangle object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewIsoscelesTriangleWithDefaults() *IsoscelesTriangle { - this := IsoscelesTriangle{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *IsoscelesTriangle) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *IsoscelesTriangle) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *IsoscelesTriangle) SetShapeType(v string) { - o.ShapeType = v -} - -// GetTriangleType returns the TriangleType field value -func (o *IsoscelesTriangle) GetTriangleType() string { - if o == nil { - var ret string - return ret - } - - return o.TriangleType -} - -// GetTriangleTypeOk returns a tuple with the TriangleType field value -// and a boolean to check if the value has been set. -func (o *IsoscelesTriangle) GetTriangleTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TriangleType, true -} - -// SetTriangleType sets field value -func (o *IsoscelesTriangle) SetTriangleType(v string) { - o.TriangleType = v -} - -func (o IsoscelesTriangle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - if true { - toSerialize["triangleType"] = o.TriangleType - } - return json.Marshal(toSerialize) -} - -// AsTriangle wraps this instance of IsoscelesTriangle in Triangle -func (s *IsoscelesTriangle) AsTriangle() Triangle { - return Triangle{ TriangleInterface: s } -} -type NullableIsoscelesTriangle struct { - value *IsoscelesTriangle - isSet bool -} - -func (v NullableIsoscelesTriangle) Get() *IsoscelesTriangle { - return v.value -} - -func (v *NullableIsoscelesTriangle) Set(val *IsoscelesTriangle) { - v.value = val - v.isSet = true -} - -func (v NullableIsoscelesTriangle) IsSet() bool { - return v.isSet -} - -func (v *NullableIsoscelesTriangle) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableIsoscelesTriangle(val *IsoscelesTriangle) *NullableIsoscelesTriangle { - return &NullableIsoscelesTriangle{value: val, isSet: true} -} - -func (v NullableIsoscelesTriangle) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableIsoscelesTriangle) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go deleted file mode 100644 index 7d0aaaeccddc..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral.go +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" - "fmt" -) - -// Quadrilateral struct for Quadrilateral -type Quadrilateral struct { - QuadrilateralInterface interface { GetQuadrilateralType() string } -} - -func (s Quadrilateral) MarshalJSON() ([]byte, error) { - return json.Marshal(s.QuadrilateralInterface) -} - -func (s *Quadrilateral) UnmarshalJSON(src []byte) error { - var err error - var unmarshaled map[string]interface{} - err = json.Unmarshal(src, &unmarshaled) - if err != nil { - return err - } - if v, ok := unmarshaled["quadrilateralType"]; ok { - switch v { - case "ComplexQuadrilateral": - var result *ComplexQuadrilateral = &ComplexQuadrilateral{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.QuadrilateralInterface = result - return nil - case "SimpleQuadrilateral": - var result *SimpleQuadrilateral = &SimpleQuadrilateral{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.QuadrilateralInterface = result - return nil - default: - return fmt.Errorf("No oneOf model has 'quadrilateralType' equal to %s", v) - } - } else { - return fmt.Errorf("Discriminator property 'quadrilateralType' not found in unmarshaled payload: %+v", unmarshaled) - } -} -// AsShape wraps this instance of Quadrilateral in Shape -func (s *Quadrilateral) AsShape() Shape { - return Shape{ ShapeInterface: s } -} -type NullableQuadrilateral struct { - value *Quadrilateral - isSet bool -} - -func (v NullableQuadrilateral) Get() *Quadrilateral { - return v.value -} - -func (v *NullableQuadrilateral) Set(val *Quadrilateral) { - v.value = val - v.isSet = true -} - -func (v NullableQuadrilateral) IsSet() bool { - return v.isSet -} - -func (v *NullableQuadrilateral) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableQuadrilateral(val *Quadrilateral) *NullableQuadrilateral { - return &NullableQuadrilateral{value: val, isSet: true} -} - -func (v NullableQuadrilateral) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableQuadrilateral) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go deleted file mode 100644 index b62f3166f524..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_quadrilateral_interface.go +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// QuadrilateralInterface struct for QuadrilateralInterface -type QuadrilateralInterface struct { - QuadrilateralType string `json:"quadrilateralType"` -} - -// NewQuadrilateralInterface instantiates a new QuadrilateralInterface object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewQuadrilateralInterface(quadrilateralType string, ) *QuadrilateralInterface { - this := QuadrilateralInterface{} - this.QuadrilateralType = quadrilateralType - return &this -} - -// NewQuadrilateralInterfaceWithDefaults instantiates a new QuadrilateralInterface object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewQuadrilateralInterfaceWithDefaults() *QuadrilateralInterface { - this := QuadrilateralInterface{} - return &this -} - -// GetQuadrilateralType returns the QuadrilateralType field value -func (o *QuadrilateralInterface) GetQuadrilateralType() string { - if o == nil { - var ret string - return ret - } - - return o.QuadrilateralType -} - -// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value -// and a boolean to check if the value has been set. -func (o *QuadrilateralInterface) GetQuadrilateralTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.QuadrilateralType, true -} - -// SetQuadrilateralType sets field value -func (o *QuadrilateralInterface) SetQuadrilateralType(v string) { - o.QuadrilateralType = v -} - -func (o QuadrilateralInterface) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["quadrilateralType"] = o.QuadrilateralType - } - return json.Marshal(toSerialize) -} - -type NullableQuadrilateralInterface struct { - value *QuadrilateralInterface - isSet bool -} - -func (v NullableQuadrilateralInterface) Get() *QuadrilateralInterface { - return v.value -} - -func (v *NullableQuadrilateralInterface) Set(val *QuadrilateralInterface) { - v.value = val - v.isSet = true -} - -func (v NullableQuadrilateralInterface) IsSet() bool { - return v.isSet -} - -func (v *NullableQuadrilateralInterface) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableQuadrilateralInterface(val *QuadrilateralInterface) *NullableQuadrilateralInterface { - return &NullableQuadrilateralInterface{value: val, isSet: true} -} - -func (v NullableQuadrilateralInterface) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableQuadrilateralInterface) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go deleted file mode 100644 index 98dbf673dede..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_scalene_triangle.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// ScaleneTriangle struct for ScaleneTriangle -type ScaleneTriangle struct { - ShapeType string `json:"shapeType"` - TriangleType string `json:"triangleType"` -} - -// NewScaleneTriangle instantiates a new ScaleneTriangle object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewScaleneTriangle(shapeType string, triangleType string, ) *ScaleneTriangle { - this := ScaleneTriangle{} - this.ShapeType = shapeType - this.TriangleType = triangleType - return &this -} - -// NewScaleneTriangleWithDefaults instantiates a new ScaleneTriangle object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewScaleneTriangleWithDefaults() *ScaleneTriangle { - this := ScaleneTriangle{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *ScaleneTriangle) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *ScaleneTriangle) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *ScaleneTriangle) SetShapeType(v string) { - o.ShapeType = v -} - -// GetTriangleType returns the TriangleType field value -func (o *ScaleneTriangle) GetTriangleType() string { - if o == nil { - var ret string - return ret - } - - return o.TriangleType -} - -// GetTriangleTypeOk returns a tuple with the TriangleType field value -// and a boolean to check if the value has been set. -func (o *ScaleneTriangle) GetTriangleTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TriangleType, true -} - -// SetTriangleType sets field value -func (o *ScaleneTriangle) SetTriangleType(v string) { - o.TriangleType = v -} - -func (o ScaleneTriangle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - if true { - toSerialize["triangleType"] = o.TriangleType - } - return json.Marshal(toSerialize) -} - -// AsTriangle wraps this instance of ScaleneTriangle in Triangle -func (s *ScaleneTriangle) AsTriangle() Triangle { - return Triangle{ TriangleInterface: s } -} -type NullableScaleneTriangle struct { - value *ScaleneTriangle - isSet bool -} - -func (v NullableScaleneTriangle) Get() *ScaleneTriangle { - return v.value -} - -func (v *NullableScaleneTriangle) Set(val *ScaleneTriangle) { - v.value = val - v.isSet = true -} - -func (v NullableScaleneTriangle) IsSet() bool { - return v.isSet -} - -func (v *NullableScaleneTriangle) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableScaleneTriangle(val *ScaleneTriangle) *NullableScaleneTriangle { - return &NullableScaleneTriangle{value: val, isSet: true} -} - -func (v NullableScaleneTriangle) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableScaleneTriangle) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go deleted file mode 100644 index 42f2752fd2b0..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" - "fmt" -) - -// Shape struct for Shape -type Shape struct { - ShapeInterface interface { GetShapeType() string } -} - -func (s Shape) MarshalJSON() ([]byte, error) { - return json.Marshal(s.ShapeInterface) -} - -func (s *Shape) UnmarshalJSON(src []byte) error { - var err error - var unmarshaled map[string]interface{} - err = json.Unmarshal(src, &unmarshaled) - if err != nil { - return err - } - if v, ok := unmarshaled["shapeType"]; ok { - switch v { - case "Quadrilateral": - var result *Quadrilateral = &Quadrilateral{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.ShapeInterface = result - return nil - case "Triangle": - var result *Triangle = &Triangle{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.ShapeInterface = result - return nil - default: - return fmt.Errorf("No oneOf model has 'shapeType' equal to %s", v) - } - } else { - return fmt.Errorf("Discriminator property 'shapeType' not found in unmarshaled payload: %+v", unmarshaled) - } -} -type NullableShape struct { - value *Shape - isSet bool -} - -func (v NullableShape) Get() *Shape { - return v.value -} - -func (v *NullableShape) Set(val *Shape) { - v.value = val - v.isSet = true -} - -func (v NullableShape) IsSet() bool { - return v.isSet -} - -func (v *NullableShape) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableShape(val *Shape) *NullableShape { - return &NullableShape{value: val, isSet: true} -} - -func (v NullableShape) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableShape) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go deleted file mode 100644 index 284fa3d369b8..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_shape_interface.go +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// ShapeInterface struct for ShapeInterface -type ShapeInterface struct { - ShapeType string `json:"shapeType"` -} - -// NewShapeInterface instantiates a new ShapeInterface object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewShapeInterface(shapeType string, ) *ShapeInterface { - this := ShapeInterface{} - this.ShapeType = shapeType - return &this -} - -// NewShapeInterfaceWithDefaults instantiates a new ShapeInterface object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewShapeInterfaceWithDefaults() *ShapeInterface { - this := ShapeInterface{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *ShapeInterface) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *ShapeInterface) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *ShapeInterface) SetShapeType(v string) { - o.ShapeType = v -} - -func (o ShapeInterface) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - return json.Marshal(toSerialize) -} - -type NullableShapeInterface struct { - value *ShapeInterface - isSet bool -} - -func (v NullableShapeInterface) Get() *ShapeInterface { - return v.value -} - -func (v *NullableShapeInterface) Set(val *ShapeInterface) { - v.value = val - v.isSet = true -} - -func (v NullableShapeInterface) IsSet() bool { - return v.isSet -} - -func (v *NullableShapeInterface) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableShapeInterface(val *ShapeInterface) *NullableShapeInterface { - return &NullableShapeInterface{value: val, isSet: true} -} - -func (v NullableShapeInterface) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableShapeInterface) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go deleted file mode 100644 index 2d194983f567..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_simple_quadrilateral.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// SimpleQuadrilateral struct for SimpleQuadrilateral -type SimpleQuadrilateral struct { - ShapeType string `json:"shapeType"` - QuadrilateralType string `json:"quadrilateralType"` -} - -// NewSimpleQuadrilateral instantiates a new SimpleQuadrilateral object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewSimpleQuadrilateral(shapeType string, quadrilateralType string, ) *SimpleQuadrilateral { - this := SimpleQuadrilateral{} - this.ShapeType = shapeType - this.QuadrilateralType = quadrilateralType - return &this -} - -// NewSimpleQuadrilateralWithDefaults instantiates a new SimpleQuadrilateral object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewSimpleQuadrilateralWithDefaults() *SimpleQuadrilateral { - this := SimpleQuadrilateral{} - return &this -} - -// GetShapeType returns the ShapeType field value -func (o *SimpleQuadrilateral) GetShapeType() string { - if o == nil { - var ret string - return ret - } - - return o.ShapeType -} - -// GetShapeTypeOk returns a tuple with the ShapeType field value -// and a boolean to check if the value has been set. -func (o *SimpleQuadrilateral) GetShapeTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ShapeType, true -} - -// SetShapeType sets field value -func (o *SimpleQuadrilateral) SetShapeType(v string) { - o.ShapeType = v -} - -// GetQuadrilateralType returns the QuadrilateralType field value -func (o *SimpleQuadrilateral) GetQuadrilateralType() string { - if o == nil { - var ret string - return ret - } - - return o.QuadrilateralType -} - -// GetQuadrilateralTypeOk returns a tuple with the QuadrilateralType field value -// and a boolean to check if the value has been set. -func (o *SimpleQuadrilateral) GetQuadrilateralTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.QuadrilateralType, true -} - -// SetQuadrilateralType sets field value -func (o *SimpleQuadrilateral) SetQuadrilateralType(v string) { - o.QuadrilateralType = v -} - -func (o SimpleQuadrilateral) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["shapeType"] = o.ShapeType - } - if true { - toSerialize["quadrilateralType"] = o.QuadrilateralType - } - return json.Marshal(toSerialize) -} - -// AsQuadrilateral wraps this instance of SimpleQuadrilateral in Quadrilateral -func (s *SimpleQuadrilateral) AsQuadrilateral() Quadrilateral { - return Quadrilateral{ QuadrilateralInterface: s } -} -type NullableSimpleQuadrilateral struct { - value *SimpleQuadrilateral - isSet bool -} - -func (v NullableSimpleQuadrilateral) Get() *SimpleQuadrilateral { - return v.value -} - -func (v *NullableSimpleQuadrilateral) Set(val *SimpleQuadrilateral) { - v.value = val - v.isSet = true -} - -func (v NullableSimpleQuadrilateral) IsSet() bool { - return v.isSet -} - -func (v *NullableSimpleQuadrilateral) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSimpleQuadrilateral(val *SimpleQuadrilateral) *NullableSimpleQuadrilateral { - return &NullableSimpleQuadrilateral{value: val, isSet: true} -} - -func (v NullableSimpleQuadrilateral) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSimpleQuadrilateral) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go deleted file mode 100644 index 00b1cbecf04f..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle.go +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" - "fmt" -) - -// Triangle struct for Triangle -type Triangle struct { - TriangleInterface interface { GetTriangleType() string } -} - -func (s Triangle) MarshalJSON() ([]byte, error) { - return json.Marshal(s.TriangleInterface) -} - -func (s *Triangle) UnmarshalJSON(src []byte) error { - var err error - var unmarshaled map[string]interface{} - err = json.Unmarshal(src, &unmarshaled) - if err != nil { - return err - } - if v, ok := unmarshaled["triangleType"]; ok { - switch v { - case "EquilateralTriangle": - var result *EquilateralTriangle = &EquilateralTriangle{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.TriangleInterface = result - return nil - case "IsoscelesTriangle": - var result *IsoscelesTriangle = &IsoscelesTriangle{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.TriangleInterface = result - return nil - case "ScaleneTriangle": - var result *ScaleneTriangle = &ScaleneTriangle{} - err = json.Unmarshal(src, result) - if err != nil { - return err - } - s.TriangleInterface = result - return nil - default: - return fmt.Errorf("No oneOf model has 'triangleType' equal to %s", v) - } - } else { - return fmt.Errorf("Discriminator property 'triangleType' not found in unmarshaled payload: %+v", unmarshaled) - } -} -// AsShape wraps this instance of Triangle in Shape -func (s *Triangle) AsShape() Shape { - return Shape{ ShapeInterface: s } -} -type NullableTriangle struct { - value *Triangle - isSet bool -} - -func (v NullableTriangle) Get() *Triangle { - return v.value -} - -func (v *NullableTriangle) Set(val *Triangle) { - v.value = val - v.isSet = true -} - -func (v NullableTriangle) IsSet() bool { - return v.isSet -} - -func (v *NullableTriangle) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTriangle(val *Triangle) *NullableTriangle { - return &NullableTriangle{value: val, isSet: true} -} - -func (v NullableTriangle) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTriangle) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go deleted file mode 100644 index e35ec4ebc8db..000000000000 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_triangle_interface.go +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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: \" \\ - * - * API version: 1.0.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package petstore - -import ( - "encoding/json" -) - -// TriangleInterface struct for TriangleInterface -type TriangleInterface struct { - TriangleType string `json:"triangleType"` -} - -// NewTriangleInterface instantiates a new TriangleInterface object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTriangleInterface(triangleType string, ) *TriangleInterface { - this := TriangleInterface{} - this.TriangleType = triangleType - return &this -} - -// NewTriangleInterfaceWithDefaults instantiates a new TriangleInterface object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTriangleInterfaceWithDefaults() *TriangleInterface { - this := TriangleInterface{} - return &this -} - -// GetTriangleType returns the TriangleType field value -func (o *TriangleInterface) GetTriangleType() string { - if o == nil { - var ret string - return ret - } - - return o.TriangleType -} - -// GetTriangleTypeOk returns a tuple with the TriangleType field value -// and a boolean to check if the value has been set. -func (o *TriangleInterface) GetTriangleTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TriangleType, true -} - -// SetTriangleType sets field value -func (o *TriangleInterface) SetTriangleType(v string) { - o.TriangleType = v -} - -func (o TriangleInterface) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["triangleType"] = o.TriangleType - } - return json.Marshal(toSerialize) -} - -type NullableTriangleInterface struct { - value *TriangleInterface - isSet bool -} - -func (v NullableTriangleInterface) Get() *TriangleInterface { - return v.value -} - -func (v *NullableTriangleInterface) Set(val *TriangleInterface) { - v.value = val - v.isSet = true -} - -func (v NullableTriangleInterface) IsSet() bool { - return v.isSet -} - -func (v *NullableTriangleInterface) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTriangleInterface(val *TriangleInterface) *NullableTriangleInterface { - return &NullableTriangleInterface{value: val, isSet: true} -} - -func (v NullableTriangleInterface) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTriangleInterface) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -}