[python][template] move _path_to_item of simple init to avoid name error (#8737)

* [python][template] move _path_to_item of simple init up so its avaliable for missing default errors

* update generated examples
This commit is contained in:
Ronny Pfannschmidt 2021-02-23 06:00:14 +01:00 committed by GitHub
parent 19f43b5330
commit eb3d6d2f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 28 additions and 14 deletions

View File

@ -20,6 +20,8 @@
value ({{{dataType}}}):{{#description}} {{{description}}}.{{/description}}{{#defaultValue}} if omitted defaults to {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501 value ({{{dataType}}}):{{#description}} {{{description}}}.{{/description}}{{#defaultValue}} if omitted defaults to {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
{{> model_templates/docstring_init_required_kwargs }} {{> model_templates/docstring_init_required_kwargs }}
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -41,7 +43,6 @@
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class AnimalFarm(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -151,7 +153,6 @@ class AnimalFarm(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class EnumClass(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -147,7 +149,6 @@ class EnumClass(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -135,6 +135,8 @@ class NumberWithValidations(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -150,7 +152,6 @@ class NumberWithValidations(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class StringEnum(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -151,7 +153,6 @@ class StringEnum(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class AnimalFarm(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -151,7 +153,6 @@ class AnimalFarm(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class ArrayOfEnums(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -151,7 +153,6 @@ class ArrayOfEnums(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class EnumClass(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -147,7 +149,6 @@ class EnumClass(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class IntegerEnum(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -151,7 +153,6 @@ class IntegerEnum(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -134,6 +134,8 @@ class IntegerEnumOneValue(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -145,7 +147,6 @@ class IntegerEnumOneValue(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class IntegerEnumWithDefaultValue(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -147,7 +149,6 @@ class IntegerEnumWithDefaultValue(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -135,6 +135,8 @@ class NumberWithValidations(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -150,7 +152,6 @@ class NumberWithValidations(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -146,6 +146,8 @@ lines''', '''double quote
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -161,7 +163,6 @@ lines''', '''double quote
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

View File

@ -136,6 +136,8 @@ class StringEnumWithDefaultValue(ModelSimple):
through its discriminator because we passed in through its discriminator because we passed in
_visited_composed_classes = (Animal,) _visited_composed_classes = (Animal,)
""" """
# required up here when default value is not given
_path_to_item = kwargs.pop('_path_to_item', ())
if 'value' in kwargs: if 'value' in kwargs:
value = kwargs.pop('value') value = kwargs.pop('value')
@ -147,7 +149,6 @@ class StringEnumWithDefaultValue(ModelSimple):
_check_type = kwargs.pop('_check_type', True) _check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False) _spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None) _configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())