diff --git a/modules/openapi-generator/src/main/resources/python/model.mustache b/modules/openapi-generator/src/main/resources/python/model.mustache index 17264bb46b..70f6e7489a 100644 --- a/modules/openapi-generator/src/main/resources/python/model.mustache +++ b/modules/openapi-generator/src/main/resources/python/model.mustache @@ -27,6 +27,10 @@ class {{classname}}(object): {{/-last}} {{/enumVars}}{{/allowableValues}} +{{#allowableValues}} + allowable_values = [{{#enumVars}}{{name}}{{^-last}}, {{/-last}}{{/enumVars}}] # noqa: E501 + +{{/allowableValues}} """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/client/petstore/python/petstore_api/models/enum_class.py b/samples/client/petstore/python/petstore_api/models/enum_class.py index 8bc6275786..0df679d29f 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python/petstore_api/models/enum_class.py @@ -32,6 +32,8 @@ class EnumClass(object): _EFG = "-efg" _XYZ_ = "(xyz)" + allowable_values = [_ABC, _EFG, _XYZ_] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/client/petstore/python/petstore_api/models/outer_enum.py b/samples/client/petstore/python/petstore_api/models/outer_enum.py index 8fbfeb7aae..bcea632b3f 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python/petstore_api/models/outer_enum.py @@ -32,6 +32,8 @@ class OuterEnum(object): APPROVED = "approved" DELIVERED = "delivered" + allowable_values = [PLACED, APPROVED, DELIVERED] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py index 8bc6275786..0df679d29f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py @@ -32,6 +32,8 @@ class EnumClass(object): _EFG = "-efg" _XYZ_ = "(xyz)" + allowable_values = [_ABC, _EFG, _XYZ_] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py index 8fbfeb7aae..bcea632b3f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py @@ -32,6 +32,8 @@ class OuterEnum(object): APPROVED = "approved" DELIVERED = "delivered" + allowable_values = [PLACED, APPROVED, DELIVERED] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py index 881edd1384..e448af3c8c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py @@ -32,6 +32,8 @@ class OuterEnumDefaultValue(object): APPROVED = "approved" DELIVERED = "delivered" + allowable_values = [PLACED, APPROVED, DELIVERED] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py index 8e6d0c44b0..7047cd72c5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py @@ -32,6 +32,8 @@ class OuterEnumInteger(object): _1 = "1" _2 = "2" + allowable_values = [_0, _1, _2] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py index 943ad3b596..f7a0ef3095 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py @@ -32,6 +32,8 @@ class OuterEnumIntegerDefaultValue(object): _1 = "1" _2 = "2" + allowable_values = [_0, _1, _2] # noqa: E501 + """ Attributes: openapi_types (dict): The key is attribute name