From 638a2faa3d17bcff0156aa1ba5c578514cd8c4e2 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 1 Oct 2021 13:09:32 -0700 Subject: [PATCH] Updated model generation, addProps handling moved into type object and anyType handling (#10505) * Updates fromModel helpers * Samples regenerated * updateModelForComposedSchema made protected so it can be overridden --- .../java/org/openapitools/codegen/DefaultCodegen.java | 11 ++++++----- .../codegen/languages/CSharpNetCoreClientCodegen.java | 2 ++ .../codegen/languages/GoServerCodegen.java | 2 ++ .../codegen/languages/JavaCXFServerCodegen.java | 2 ++ samples/client/petstore/python/docs/AnimalFarm.md | 1 - samples/client/petstore/python/docs/EnumClass.md | 1 - .../petstore/python/docs/NumberWithValidations.md | 1 - samples/client/petstore/python/docs/StringEnum.md | 1 - .../petstore/python/petstore_api/model/animal_farm.py | 9 +-------- .../petstore/python/petstore_api/model/enum_class.py | 8 +------- .../petstore_api/model/number_with_validations.py | 8 +------- .../petstore/python/petstore_api/model/string_enum.py | 8 +------- .../client/petstore/python/docs/AnimalFarm.md | 1 - .../client/petstore/python/docs/ArrayOfEnums.md | 1 - .../client/petstore/python/docs/BooleanEnum.md | 1 - .../openapi3/client/petstore/python/docs/EnumClass.md | 1 - .../client/petstore/python/docs/IntegerEnum.md | 1 - .../petstore/python/docs/IntegerEnumOneValue.md | 1 - .../python/docs/IntegerEnumWithDefaultValue.md | 1 - .../petstore/python/docs/NumberWithValidations.md | 1 - .../client/petstore/python/docs/StringEnum.md | 1 - .../python/docs/StringEnumWithDefaultValue.md | 1 - .../petstore/python/petstore_api/model/animal_farm.py | 9 +-------- .../python/petstore_api/model/array_of_enums.py | 9 +-------- .../python/petstore_api/model/boolean_enum.py | 8 +------- .../petstore/python/petstore_api/model/enum_class.py | 8 +------- .../python/petstore_api/model/integer_enum.py | 8 +------- .../petstore_api/model/integer_enum_one_value.py | 8 +------- .../model/integer_enum_with_default_value.py | 8 +------- .../petstore_api/model/number_with_validations.py | 8 +------- .../petstore/python/petstore_api/model/string_enum.py | 8 +------- .../model/string_enum_with_default_value.py | 8 +------- 32 files changed, 26 insertions(+), 120 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 65d34bdf664..689af8f5267 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2381,7 +2381,7 @@ public class DefaultCodegen implements CodegenConfig { Map schemaCodegenPropertyCache = new HashMap(); - private void updateModelForComposedSchema(CodegenModel m, Schema schema, Map allDefinitions) { + protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map allDefinitions) { final ComposedSchema composed = (ComposedSchema) schema; Map properties = new LinkedHashMap(); List required = new ArrayList(); @@ -2596,6 +2596,8 @@ public class DefaultCodegen implements CodegenConfig { // additionalProperties must be null, ObjectSchema, or empty Schema addAdditionPropertiesToCodeGenModel(m, schema); } + // process 'additionalProperties' + setAddProps(schema, m); } protected void updateModelForAnyType(CodegenModel m, Schema schema) { @@ -2614,6 +2616,8 @@ public class DefaultCodegen implements CodegenConfig { // passing null to allProperties and allRequired as there's no parent addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null); } + // process 'additionalProperties' + setAddProps(schema, m); } @@ -2776,9 +2780,6 @@ public class DefaultCodegen implements CodegenConfig { Collections.sort(m.allVars, comparator); } - // process 'additionalProperties' - setAddProps(schema, m); - // post process model properties if (m.vars != null) { for (CodegenProperty prop : m.vars) { @@ -2794,7 +2795,7 @@ public class DefaultCodegen implements CodegenConfig { return m; } - private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){ + protected void setAddProps(Schema schema, IJsonSchemaValidationProperties property){ if (schema.equals(new Schema())) { // if we are trying to set additionalProperties on an empty schema stop recursing return; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 66718bdaf7f..604fa336e38 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -1152,5 +1152,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen { addAdditionPropertiesToCodeGenModel(m, schema); } } + // process 'additionalProperties' + setAddProps(schema, m); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java index ab4f7b37cf7..0983ad705b9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java @@ -385,5 +385,7 @@ public class GoServerCodegen extends AbstractGoCodegen { addAdditionPropertiesToCodeGenModel(m, schema); } } + // process 'additionalProperties' + setAddProps(schema, m); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java index f406050ea68..54c1c0e6c0b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java @@ -354,5 +354,7 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen addAdditionPropertiesToCodeGenModel(m, schema); } } + // process 'additionalProperties' + setAddProps(schema, m); } } diff --git a/samples/client/petstore/python/docs/AnimalFarm.md b/samples/client/petstore/python/docs/AnimalFarm.md index fb3b33c9c9c..fc299cf27d3 100644 --- a/samples/client/petstore/python/docs/AnimalFarm.md +++ b/samples/client/petstore/python/docs/AnimalFarm.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | [**[Animal]**](Animal.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/EnumClass.md b/samples/client/petstore/python/docs/EnumClass.md index 39bb0e1644c..a1f9aae5819 100644 --- a/samples/client/petstore/python/docs/EnumClass.md +++ b/samples/client/petstore/python/docs/EnumClass.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/NumberWithValidations.md b/samples/client/petstore/python/docs/NumberWithValidations.md index cc6f77c152c..119e0f67823 100644 --- a/samples/client/petstore/python/docs/NumberWithValidations.md +++ b/samples/client/petstore/python/docs/NumberWithValidations.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **float** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/StringEnum.md b/samples/client/petstore/python/docs/StringEnum.md index 1ac6df2fb79..bb195ec0e45 100644 --- a/samples/client/petstore/python/docs/StringEnum.md +++ b/samples/client/petstore/python/docs/StringEnum.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **str** | | must be one of ["placed", "approved", "delivered", ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/petstore_api/model/animal_farm.py b/samples/client/petstore/python/petstore_api/model/animal_farm.py index 59bde51a290..042a8274ee7 100644 --- a/samples/client/petstore/python/petstore_api/model/animal_farm.py +++ b/samples/client/petstore/python/petstore_api/model/animal_farm.py @@ -60,14 +60,7 @@ class AnimalFarm(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/client/petstore/python/petstore_api/model/enum_class.py b/samples/client/petstore/python/petstore_api/model/enum_class.py index a9e7723b255..b0ed3d8966d 100644 --- a/samples/client/petstore/python/petstore_api/model/enum_class.py +++ b/samples/client/petstore/python/petstore_api/model/enum_class.py @@ -61,13 +61,7 @@ class EnumClass(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/client/petstore/python/petstore_api/model/number_with_validations.py b/samples/client/petstore/python/petstore_api/model/number_with_validations.py index 27bc46dbe44..5d66fec5ec6 100644 --- a/samples/client/petstore/python/petstore_api/model/number_with_validations.py +++ b/samples/client/petstore/python/petstore_api/model/number_with_validations.py @@ -60,13 +60,7 @@ class NumberWithValidations(ModelSimple): }, } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/client/petstore/python/petstore_api/model/string_enum.py b/samples/client/petstore/python/petstore_api/model/string_enum.py index 5bd1e28942e..2397dd59fc9 100644 --- a/samples/client/petstore/python/petstore_api/model/string_enum.py +++ b/samples/client/petstore/python/petstore_api/model/string_enum.py @@ -61,13 +61,7 @@ class StringEnum(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/docs/AnimalFarm.md b/samples/openapi3/client/petstore/python/docs/AnimalFarm.md index fb3b33c9c9c..fc299cf27d3 100644 --- a/samples/openapi3/client/petstore/python/docs/AnimalFarm.md +++ b/samples/openapi3/client/petstore/python/docs/AnimalFarm.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | [**[Animal]**](Animal.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/ArrayOfEnums.md b/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md index f1593c10afd..d2f8ea80a3d 100644 --- a/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md +++ b/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | [**[StringEnum]**](StringEnum.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/BooleanEnum.md b/samples/openapi3/client/petstore/python/docs/BooleanEnum.md index 592645544c5..ab7bdfff426 100644 --- a/samples/openapi3/client/petstore/python/docs/BooleanEnum.md +++ b/samples/openapi3/client/petstore/python/docs/BooleanEnum.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **bool** | | defaults to True, must be one of [True, ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/EnumClass.md b/samples/openapi3/client/petstore/python/docs/EnumClass.md index 39bb0e1644c..a1f9aae5819 100644 --- a/samples/openapi3/client/petstore/python/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/python/docs/EnumClass.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/IntegerEnum.md b/samples/openapi3/client/petstore/python/docs/IntegerEnum.md index a5b38556bf8..9567a76cc2e 100644 --- a/samples/openapi3/client/petstore/python/docs/IntegerEnum.md +++ b/samples/openapi3/client/petstore/python/docs/IntegerEnum.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **int** | | must be one of [0, 1, 2, ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/IntegerEnumOneValue.md b/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md index d92f3080973..99dcaa7a4ec 100644 --- a/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md +++ b/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **int** | | defaults to 0, must be one of [0, ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/IntegerEnumWithDefaultValue.md b/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md index 2fd432edc69..4b8e39d9cad 100644 --- a/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md +++ b/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **int** | | defaults to 0, must be one of [0, 1, 2, ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/NumberWithValidations.md b/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md index cc6f77c152c..119e0f67823 100644 --- a/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md +++ b/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **float** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/StringEnum.md b/samples/openapi3/client/petstore/python/docs/StringEnum.md index 29e160a9b07..b03f3b1e6c6 100644 --- a/samples/openapi3/client/petstore/python/docs/StringEnum.md +++ b/samples/openapi3/client/petstore/python/docs/StringEnum.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes **value** | **str** | | must be one of ["placed", "approved", "delivered", "single quoted", '''multiple lines''', '''double quote with newline''', ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/docs/StringEnumWithDefaultValue.md b/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md index 700a2caf3b8..7799b93d822 100644 --- a/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md +++ b/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value** | **str** | | defaults to "placed", must be one of ["placed", "approved", "delivered", ] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/petstore_api/model/animal_farm.py b/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py index 59bde51a290..042a8274ee7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py @@ -60,14 +60,7 @@ class AnimalFarm(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py index 1a4166a6e67..d83a7f15709 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py @@ -60,14 +60,7 @@ class ArrayOfEnums(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/boolean_enum.py b/samples/openapi3/client/petstore/python/petstore_api/model/boolean_enum.py index 6b5a2f7d65e..af104c19c78 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/boolean_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/boolean_enum.py @@ -59,13 +59,7 @@ class BooleanEnum(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py index a9e7723b255..b0ed3d8966d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py @@ -61,13 +61,7 @@ class EnumClass(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py index 2d3d1293cd3..aa397a09ebd 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py @@ -61,13 +61,7 @@ class IntegerEnum(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py index 63c1a0b9a7b..0ed72fe14cd 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py @@ -59,13 +59,7 @@ class IntegerEnumOneValue(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py index 008f954a0f1..2c479332983 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py @@ -61,13 +61,7 @@ class IntegerEnumWithDefaultValue(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py b/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py index afcbf8463ea..9a8a82b4821 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py @@ -60,13 +60,7 @@ class NumberWithValidations(ModelSimple): }, } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py index 890e25eeddc..3563698aacb 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py @@ -67,13 +67,7 @@ lines''', validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = True diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py index 3861e56a08c..b6432cdbd1b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py @@ -61,13 +61,7 @@ class StringEnumWithDefaultValue(ModelSimple): validations = { } - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + additional_properties_type = None _nullable = False