From d5cd653aaa0748bde8f14bead24791a8ae4a66fb Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 21 Sep 2022 22:36:54 -0700 Subject: [PATCH 1/2] Movs enum info, changes cls factory to base class + updates samples --- .../PythonExperimentalClientCodegen.java | 93 ++++++++++++++---- .../enum_value_to_name.handlebars | 12 --- .../model_templates/enums.handlebars | 18 ++-- .../schema_composed_or_anytype.handlebars | 13 ++- .../model_templates/schema_simple.handlebars | 16 ++- .../python-experimental/schemas.handlebars | 53 ++++------ ...odels-for-testing-with-http-signature.yaml | 1 + .../model/enum_with0_does_not_match_false.py | 12 ++- .../model/enum_with0_does_not_match_false.pyi | 6 +- .../model/enum_with1_does_not_match_true.py | 12 ++- .../model/enum_with1_does_not_match_true.pyi | 6 +- .../model/enum_with_escaped_characters.py | 14 +-- .../model/enum_with_escaped_characters.pyi | 7 +- .../model/enum_with_false_does_not_match0.py | 14 +-- .../model/enum_with_false_does_not_match0.pyi | 8 +- .../model/enum_with_true_does_not_match1.py | 14 +-- .../model/enum_with_true_does_not_match1.pyi | 8 +- .../model/enums_in_properties.py | 24 +++-- .../model/enums_in_properties.pyi | 12 +-- .../model/nul_characters_in_strings.py | 12 ++- .../model/nul_characters_in_strings.pyi | 6 +- .../model/simple_enum_validation.py | 16 +-- .../model/simple_enum_validation.pyi | 8 +- .../unit_test_api/schemas.py | 53 ++++------ .../docs/models/StringEnum.md | 2 +- .../model/array_with_validations_in_items.py | 1 + .../petstore_api/model/basque_pig.py | 12 ++- .../petstore_api/model/basque_pig.pyi | 6 +- .../petstore_api/model/boolean_enum.py | 14 +-- .../petstore_api/model/boolean_enum.pyi | 8 +- .../model/complex_quadrilateral.py | 12 ++- .../model/complex_quadrilateral.pyi | 6 +- .../model/composed_one_of_different_types.py | 1 + .../petstore_api/model/currency.py | 14 +-- .../petstore_api/model/currency.pyi | 7 +- .../petstore_api/model/danish_pig.py | 12 ++- .../petstore_api/model/danish_pig.pyi | 6 +- .../model/date_time_with_validations.py | 1 + .../model/date_with_validations.py | 1 + .../petstore_api/model/enum_arrays.py | 24 +++-- .../petstore_api/model/enum_arrays.pyi | 14 +-- .../petstore_api/model/enum_class.py | 20 ++-- .../petstore_api/model/enum_class.pyi | 10 +- .../petstore_api/model/enum_test.py | 50 ++++++---- .../petstore_api/model/enum_test.pyi | 30 +----- .../model/equilateral_triangle.py | 12 ++- .../model/equilateral_triangle.pyi | 6 +- .../petstore_api/model/format_test.py | 4 + .../petstore_api/model/integer_enum.py | 16 +-- .../petstore_api/model/integer_enum.pyi | 8 +- .../petstore_api/model/integer_enum_big.py | 16 +-- .../petstore_api/model/integer_enum_big.pyi | 8 +- .../model/integer_enum_one_value.py | 12 ++- .../model/integer_enum_one_value.pyi | 6 +- .../model/integer_enum_with_default_value.py | 16 +-- .../model/integer_enum_with_default_value.pyi | 8 +- .../petstore_api/model/integer_max10.py | 1 + .../petstore_api/model/integer_min15.py | 1 + .../petstore_api/model/isosceles_triangle.py | 12 ++- .../petstore_api/model/isosceles_triangle.pyi | 6 +- .../json_patch_request_add_replace_test.py | 12 ++- .../json_patch_request_add_replace_test.pyi | 8 +- .../model/json_patch_request_move_copy.py | 12 ++- .../model/json_patch_request_move_copy.pyi | 7 +- .../model/json_patch_request_remove.py | 12 ++- .../model/json_patch_request_remove.pyi | 6 +- .../petstore_api/model/map_test.py | 12 ++- .../petstore_api/model/map_test.pyi | 7 +- .../petstore_api/model/order.py | 12 ++- .../petstore_api/model/order.pyi | 8 +- .../petstore_api/model/pet.py | 12 ++- .../petstore_api/model/pet.pyi | 8 +- .../model/quadrilateral_interface.py | 12 ++- .../model/quadrilateral_interface.pyi | 6 +- .../petstore_api/model/scalene_triangle.py | 12 ++- .../petstore_api/model/scalene_triangle.pyi | 6 +- .../model/simple_quadrilateral.py | 12 ++- .../model/simple_quadrilateral.pyi | 6 +- .../petstore_api/model/string_enum.py | 32 +++--- .../petstore_api/model/string_enum.pyi | 32 +++--- .../model/string_enum_with_default_value.py | 16 +-- .../model/string_enum_with_default_value.pyi | 8 +- .../petstore_api/model/triangle_interface.py | 12 ++- .../petstore_api/model/triangle_interface.pyi | 6 +- .../petstore_api/model/uuid_string.py | 1 + .../petstore_api/model/whale.py | 12 ++- .../petstore_api/model/whale.pyi | 6 +- .../petstore_api/model/zebra.py | 24 +++-- .../petstore_api/model/zebra.pyi | 14 +-- .../petstore_api/paths/fake/get.py | 98 +++++++++++-------- .../petstore_api/paths/fake/get.pyi | 59 ++--------- .../petstore_api/paths/fake/post.py | 4 + .../paths/pet_find_by_status/get.py | 12 ++- .../paths/pet_find_by_status/get.pyi | 8 +- .../paths/store_order_order_id/get.py | 1 + .../petstore_api/schemas.py | 53 ++++------ .../tests_manual/test_combine_schemas.py | 18 +--- 97 files changed, 643 insertions(+), 764 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/python-experimental/model_templates/enum_value_to_name.handlebars diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java index 442bb8bb466b..391d1d823dab 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonExperimentalClientCodegen.java @@ -55,6 +55,7 @@ import java.io.File; import java.io.IOException; +import java.math.BigDecimal; import java.nio.file.Path; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -1226,6 +1227,8 @@ public String toEnumVarName(String value, String datatype) { // our enum var names are keys in a python dict, so change spaces to underscores if (value.length() == 0) { return "EMPTY"; + } else if (value.equals("null")) { + return "NONE"; } String intPattern = "^[-\\+]?\\d+$"; @@ -1289,26 +1292,80 @@ private String charNameToVarName(String charName) { return varName; } - /** - * Return the enum value in the language specified format - * e.g. status becomes "status" - * - * @param value enum variable name - * @param datatype data type - * @return the sanitized value for enum - */ - public String toEnumValue(String value, String datatype) { - if ("int".equals(datatype) || "float".equals(datatype) || datatype.equals("int, float")) { - return value; - } else if ("bool".equals(datatype)) { - if (value.equals("true")) { - return "schemas.BoolClass.TRUE"; + protected List> buildEnumVars(List values, String dataType) { + List> enumVars = new ArrayList<>(); + int truncateIdx = 0; + + if (isRemoveEnumValuePrefix()) { + String commonPrefix = findCommonPrefixOfVars(values); + truncateIdx = commonPrefix.length(); + } + + for (Object value : values) { + Map enumVar = new HashMap<>(); + String enumName; + if (truncateIdx == 0) { + enumName = String.valueOf(value); + } else { + enumName = value.toString().substring(truncateIdx); + if (enumName.isEmpty()) { + enumName = value.toString(); + } } - return "schemas.BoolClass.FALSE"; - } else { - String fixedValue = (String) processTestExampleData(value); - return ensureQuotes(fixedValue); + + enumVar.put("name", toEnumVarName(enumName, dataType)); + if (value instanceof Integer) { + enumVar.put("value", value); + } else if (value instanceof Double) { + enumVar.put("value", value); + } else if (value instanceof Long) { + enumVar.put("value", value); + } else if (value instanceof Float) { + enumVar.put("value", value); + } else if (value instanceof BigDecimal) { + enumVar.put("value", value); + } else if (value == null) { + enumVar.put("value", "schemas.NoneClass.NONE"); + } else if (value instanceof Boolean) { + if (value.equals(Boolean.TRUE)) { + enumVar.put("value", "schemas.BoolClass.TRUE"); + } else { + enumVar.put("value", "schemas.BoolClass.FALSE"); + } + } else { + String fixedValue = (String) processTestExampleData(value); + enumVar.put("value", ensureQuotes(fixedValue)); + } + enumVar.put("isString", isDataTypeString(dataType)); + enumVars.add(enumVar); + } + + if (enumUnknownDefaultCase) { + // If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. + // With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case. + Map enumVar = new HashMap<>(); + String enumName = enumUnknownDefaultCaseName; + + String enumValue; + if (isDataTypeString(dataType)) { + enumValue = enumUnknownDefaultCaseName; + } else { + // This is a dummy value that attempts to avoid collisions with previously specified cases. + // Int.max / 192 + // The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums. + // [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md) + // Since this functionality was born in the Swift 5 generator and latter on broth to all generators + // https://github.com/OpenAPITools/openapi-generator/pull/11013 + enumValue = String.valueOf(11184809); + } + + enumVar.put("name", toEnumVarName(enumName, dataType)); + enumVar.put("value", toEnumValue(enumValue, dataType)); + enumVar.put("isString", isDataTypeString(dataType)); + enumVars.add(enumVar); } + + return enumVars; } @Override diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enum_value_to_name.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enum_value_to_name.handlebars deleted file mode 100644 index 2ed517385a21..000000000000 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enum_value_to_name.handlebars +++ /dev/null @@ -1,12 +0,0 @@ -schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ -{{#if isNull}} - schemas.NoneClass.NONE: "NONE", -{{/if}} -{{#with allowableValues}} -{{#each enumVars}} - {{{value}}}: "{{name}}", -{{/each}} -{{/with}} - } -), diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enums.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enums.handlebars index 72861be45d60..8c3108e4257a 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enums.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/enums.handlebars @@ -1,14 +1,20 @@ -{{#if isNull}} - -@schemas.classproperty -def NONE(cls): - return cls(None) -{{/if}} {{#with allowableValues}} {{#each enumVars}} @schemas.classproperty def {{name}}(cls): + {{#eq value "schemas.NoneClass.NONE"}} + return cls(None) + {{else}} + {{#eq value "schemas.BoolClass.TRUE"}} + return cls(True) + {{else}} + {{#eq value "schemas.BoolClass.FALSE"}} + return cls(False) + {{else}} return cls({{{value}}}) + {{/eq}} + {{/eq}} + {{/eq}} {{/each}} {{/with}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_composed_or_anytype.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_composed_or_anytype.handlebars index a43d5c67e6e8..8c7b667493f8 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_composed_or_anytype.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_composed_or_anytype.handlebars @@ -15,7 +15,7 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}} schemas.ComposedBase, {{/if}} {{#if isEnum}} - {{> model_templates/enum_value_to_name }} + schemas.EnumBase, {{/if}} {{> model_templates/xbase_schema }} {{/if}} @@ -31,13 +31,22 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}} {{/if}} """ {{/if}} -{{#or hasValidation composedSchemas getItems additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars getFormat}} +{{#or hasValidation composedSchemas getItems additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars getFormat isEnum}} class MetaOapg: {{#if getFormat}} format = '{{getFormat}}' {{/if}} +{{#if isEnum}} +{{#with allowableValues}} + enum_value_to_name = { +{{#each enumVars}} + {{{value}}}: "{{name}}", +{{/each}} + } +{{/with}} +{{/if}} {{#if getItems}} {{> model_templates/list_partial }} {{/if}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_simple.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_simple.handlebars index b5e7ee24269f..0d880043e4f2 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_simple.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_simple.handlebars @@ -2,7 +2,7 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}{{/if}}( {{#if isEnum}} - {{> model_templates/enum_value_to_name }} + schemas.EnumBase, {{/if}} {{> model_templates/xbase_schema }} ): @@ -18,12 +18,24 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}} """ {{/if}} {{#unless isStub}} -{{#if hasValidation}} +{{#or hasValidation isEnum getFormat}} class MetaOapg: +{{#if getFormat}} + format = '{{getFormat}}' +{{/if}} {{> model_templates/validations }} +{{#if isEnum}} +{{#with allowableValues}} + enum_value_to_name = { +{{#each enumVars}} + {{{value}}}: "{{name}}", +{{/each}} + } +{{/with}} {{/if}} +{{/or}} {{/unless}} {{#if isEnum}} {{> model_templates/enums }} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars index 7da16df22697..c251e24552c0 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars @@ -404,7 +404,7 @@ class Schema: """ cls._process_schema_classes_oapg(schema_classes) enum_schema = any( - hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes) + issubclass(this_cls, EnumBase) for this_cls in schema_classes) inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set) chosen_schema_classes = schema_classes - inheritable_primitive_type suffix = tuple(inheritable_primitive_type) @@ -873,41 +873,22 @@ class ValidatorBase: ) -class EnumMakerBase: - pass - - -def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker': - class SchemaEnumMaker(EnumMakerBase): - @classmethod - def _enum_value_to_name( - cls - ) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]: - pass - try: - super_enum_value_to_name = super()._enum_value_to_name() - except AttributeError: - return enum_value_to_name - intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items()) - return intersection - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - SchemaEnumMaker _validate_oapg - Validates that arg is in the enum's allowed values - """ - try: - cls._enum_value_to_name()[arg] - except KeyError: - raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name())) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - return SchemaEnumMaker +class EnumBase: + @classmethod + def _validate_oapg( + cls, + arg, + validation_metadata: ValidationMetadata, + ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: + """ + EnumBase _validate_oapg + Validates that arg is in the enum's allowed values + """ + try: + cls.MetaOapg.enum_value_to_name[arg] + except KeyError: + raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys())) + return super()._validate_oapg(arg, validation_metadata=validation_metadata) class BoolBase: 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 index 8868f6023891..3357b0ae1180 100644 --- 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 @@ -2224,6 +2224,7 @@ components: multiple lines - "double quote \n with newline" + - null IntegerEnum: type: integer enum: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.py index 8a04dd018df8..2f77c5996f4e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.py @@ -24,11 +24,7 @@ class EnumWith0DoesNotMatchFalse( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,6 +32,12 @@ class EnumWith0DoesNotMatchFalse( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 0: "POSITIVE_0", + } @schemas.classproperty def POSITIVE_0(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.pyi index 8a04dd018df8..337edc4956d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with0_does_not_match_false.pyi @@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401 class EnumWith0DoesNotMatchFalse( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.py index 078b9e19aa65..2acbb376d63c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.py @@ -24,11 +24,7 @@ class EnumWith1DoesNotMatchTrue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,6 +32,12 @@ class EnumWith1DoesNotMatchTrue( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 1: "POSITIVE_1", + } @schemas.classproperty def POSITIVE_1(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.pyi index 078b9e19aa65..8664a7f747fe 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with1_does_not_match_true.pyi @@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401 class EnumWith1DoesNotMatchTrue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.py index bf03d2da8b4b..c8f68c1000db 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.py @@ -24,12 +24,7 @@ class EnumWithEscapedCharacters( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "foo\nbar": "FOO_BAR", - "foo\rbar": "FOO_BAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -37,6 +32,13 @@ class EnumWithEscapedCharacters( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + "foo\nbar": "FOO_BAR", + "foo\rbar": "FOO_BAR", + } @schemas.classproperty def FOO_BAR(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.pyi index bf03d2da8b4b..6fb1827e441f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_escaped_characters.pyi @@ -24,12 +24,7 @@ from unit_test_api import schemas # noqa: F401 class EnumWithEscapedCharacters( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "foo\nbar": "FOO_BAR", - "foo\rbar": "FOO_BAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.py index 232e3dc37b88..c4992b57a35d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.py @@ -24,11 +24,7 @@ class EnumWithFalseDoesNotMatch0( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.FALSE: "FALSE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,7 +32,13 @@ class EnumWithFalseDoesNotMatch0( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + schemas.BoolClass.FALSE: "FALSE", + } @schemas.classproperty def FALSE(cls): - return cls(schemas.BoolClass.FALSE) + return cls(False) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.pyi index 232e3dc37b88..35ef43076cea 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_false_does_not_match0.pyi @@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401 class EnumWithFalseDoesNotMatch0( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.FALSE: "FALSE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -39,4 +35,4 @@ class EnumWithFalseDoesNotMatch0( @schemas.classproperty def FALSE(cls): - return cls(schemas.BoolClass.FALSE) + return cls(False) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.py index f2dd03ea78e5..a8e80747103b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.py @@ -24,11 +24,7 @@ class EnumWithTrueDoesNotMatch1( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.TRUE: "TRUE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,7 +32,13 @@ class EnumWithTrueDoesNotMatch1( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + schemas.BoolClass.TRUE: "TRUE", + } @schemas.classproperty def TRUE(cls): - return cls(schemas.BoolClass.TRUE) + return cls(True) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.pyi index f2dd03ea78e5..f86fc0d28102 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enum_with_true_does_not_match1.pyi @@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401 class EnumWithTrueDoesNotMatch1( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.TRUE: "TRUE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -39,4 +35,4 @@ class EnumWithTrueDoesNotMatch1( @schemas.classproperty def TRUE(cls): - return cls(schemas.BoolClass.TRUE) + return cls(True) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py index 87c87f94b6d0..0010f712aba8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py @@ -42,13 +42,15 @@ class properties: class bar( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "bar": "BAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "bar": "BAR", + } @schemas.classproperty def BAR(cls): @@ -56,13 +58,15 @@ def BAR(cls): class foo( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "foo": "FOO", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "foo": "FOO", + } @schemas.classproperty def FOO(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi index 87c87f94b6d0..d45a82aad04f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi @@ -42,11 +42,7 @@ class EnumsInProperties( class bar( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "bar": "BAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -56,11 +52,7 @@ class EnumsInProperties( class foo( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "foo": "FOO", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.py index 02c363ec5f49..3aa6a9fe9bac 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.py @@ -24,11 +24,7 @@ class NulCharactersInStrings( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "hello\x00there": "HELLOTHERE", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,6 +32,12 @@ class NulCharactersInStrings( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + "hello\x00there": "HELLOTHERE", + } @schemas.classproperty def HELLOTHERE(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.pyi index 02c363ec5f49..eb9d42800cf6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nul_characters_in_strings.pyi @@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401 class NulCharactersInStrings( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "hello\x00there": "HELLOTHERE", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.py index bfa9cd3e29c3..26641b8c99fc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.py @@ -24,13 +24,7 @@ class SimpleEnumValidation( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - 2: "POSITIVE_2", - 3: "POSITIVE_3", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,6 +32,14 @@ class SimpleEnumValidation( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 1: "POSITIVE_1", + 2: "POSITIVE_2", + 3: "POSITIVE_3", + } @schemas.classproperty def POSITIVE_1(cls): diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.pyi index bfa9cd3e29c3..61ed175912c2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/simple_enum_validation.pyi @@ -24,13 +24,7 @@ from unit_test_api import schemas # noqa: F401 class SimpleEnumValidation( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - 2: "POSITIVE_2", - 3: "POSITIVE_3", - } - ), + schemas.EnumBase, schemas.NumberSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/schemas.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/schemas.py index b9539f2c2442..3ffd38e7cf94 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/schemas.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/schemas.py @@ -411,7 +411,7 @@ def __get_new_cls( """ cls._process_schema_classes_oapg(schema_classes) enum_schema = any( - hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes) + issubclass(this_cls, EnumBase) for this_cls in schema_classes) inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set) chosen_schema_classes = schema_classes - inheritable_primitive_type suffix = tuple(inheritable_primitive_type) @@ -880,41 +880,22 @@ def _raise_validation_errror_message_oapg(value, constraint_msg, constraint_valu ) -class EnumMakerBase: - pass - - -def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker': - class SchemaEnumMaker(EnumMakerBase): - @classmethod - def _enum_value_to_name( - cls - ) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]: - pass - try: - super_enum_value_to_name = super()._enum_value_to_name() - except AttributeError: - return enum_value_to_name - intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items()) - return intersection - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - SchemaEnumMaker _validate_oapg - Validates that arg is in the enum's allowed values - """ - try: - cls._enum_value_to_name()[arg] - except KeyError: - raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name())) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - return SchemaEnumMaker +class EnumBase: + @classmethod + def _validate_oapg( + cls, + arg, + validation_metadata: ValidationMetadata, + ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: + """ + EnumBase _validate_oapg + Validates that arg is in the enum's allowed values + """ + try: + cls.MetaOapg.enum_value_to_name[arg] + except KeyError: + raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys())) + return super()._validate_oapg(arg, validation_metadata=validation_metadata) class BoolBase: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md b/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md index 219962d20541..4a41fc69917e 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md @@ -3,7 +3,7 @@ ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- -None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", ] +None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", schemas.NoneClass.NONE, ] [[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/model/array_with_validations_in_items.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_with_validations_in_items.py index bfa5fe4afc9b..f68cb1a4c278 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_with_validations_in_items.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_with_validations_in_items.py @@ -43,6 +43,7 @@ class items( class MetaOapg: + format = 'int64' inclusive_maximum = 7 def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py index 761184a89c45..528cfa498b0d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py @@ -42,13 +42,15 @@ class properties: class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "BasquePig": "BASQUE_PIG", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "BasquePig": "BASQUE_PIG", + } @schemas.classproperty def BASQUE_PIG(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi index 761184a89c45..8b36451f8498 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi @@ -42,11 +42,7 @@ class BasquePig( class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "BasquePig": "BASQUE_PIG", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.py index 7f98942e76d4..66d5be713125 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.py @@ -24,11 +24,7 @@ class BooleanEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.TRUE: "TRUE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,7 +32,13 @@ class BooleanEnum( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + schemas.BoolClass.TRUE: "TRUE", + } @schemas.classproperty def TRUE(cls): - return cls(schemas.BoolClass.TRUE) + return cls(True) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.pyi index 7f98942e76d4..69fe2e6af4e6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/boolean_enum.pyi @@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401 class BooleanEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.BoolClass.TRUE: "TRUE", - } - ), + schemas.EnumBase, schemas.BoolSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -39,4 +35,4 @@ class BooleanEnum( @schemas.classproperty def TRUE(cls): - return cls(schemas.BoolClass.TRUE) + return cls(True) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py index 4cf54c5ff04d..434c2c0c77ae 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py @@ -47,13 +47,15 @@ class properties: class quadrilateralType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "ComplexQuadrilateral": "COMPLEX_QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "ComplexQuadrilateral": "COMPLEX_QUADRILATERAL", + } @schemas.classproperty def COMPLEX_QUADRILATERAL(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi index 4cf54c5ff04d..43d8724caa80 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi @@ -47,11 +47,7 @@ class ComplexQuadrilateral( class quadrilateralType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "ComplexQuadrilateral": "COMPLEX_QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py index 790afa263ea4..b3cf4aea1c4f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py @@ -94,6 +94,7 @@ class one_of_6( class MetaOapg: + format = 'date-time' regex=[{ 'pattern': r'^2020.*', # noqa: E501 }] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.py index e1869aac84e5..8714c9adcc79 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.py @@ -24,12 +24,7 @@ class Currency( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "eur": "EUR", - "usd": "USD", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -37,6 +32,13 @@ class Currency( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + "eur": "EUR", + "usd": "USD", + } @schemas.classproperty def EUR(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.pyi index e1869aac84e5..7706629add2b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/currency.pyi @@ -24,12 +24,7 @@ from petstore_api import schemas # noqa: F401 class Currency( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "eur": "EUR", - "usd": "USD", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py index 119950e031d0..bcffd8ff006d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py @@ -42,13 +42,15 @@ class properties: class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "DanishPig": "DANISH_PIG", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "DanishPig": "DANISH_PIG", + } @schemas.classproperty def DANISH_PIG(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi index 119950e031d0..9f64db82744f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi @@ -42,11 +42,7 @@ class DanishPig( class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "DanishPig": "DANISH_PIG", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_time_with_validations.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_time_with_validations.py index 8d9eaf992be5..a5a7858195a8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_time_with_validations.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_time_with_validations.py @@ -34,6 +34,7 @@ class DateTimeWithValidations( class MetaOapg: + format = 'date-time' regex=[{ 'pattern': r'^2020.*', # noqa: E501 }] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_with_validations.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_with_validations.py index 45d5ba994595..82d0122a2793 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_with_validations.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/date_with_validations.py @@ -34,6 +34,7 @@ class DateWithValidations( class MetaOapg: + format = 'date' regex=[{ 'pattern': r'^2020.*', # noqa: E501 }] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py index 0c2e685bcaf9..1e7e0843da1a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py @@ -39,14 +39,16 @@ class properties: class just_symbol( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { ">=": "GREATER_THAN_EQUALS", "$": "DOLLAR", } - ), - schemas.StrSchema - ): @schemas.classproperty def GREATER_THAN_EQUALS(cls): @@ -66,14 +68,16 @@ class MetaOapg: class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "fish": "FISH", "crab": "CRAB", } - ), - schemas.StrSchema - ): @schemas.classproperty def FISH(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi index 0c2e685bcaf9..31b854f7d165 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi @@ -39,12 +39,7 @@ class EnumArrays( class just_symbol( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - ">=": "GREATER_THAN_EQUALS", - "$": "DOLLAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -66,12 +61,7 @@ class EnumArrays( class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "fish": "FISH", - "crab": "CRAB", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py index 8addfe28920d..27018e19a6d4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py @@ -24,15 +24,7 @@ class EnumClass( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - "COUNT_1M": "COUNT_1M", - "COUNT_50M": "COUNT_50M", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,6 +32,16 @@ class EnumClass( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + "_abc": "_ABC", + "-efg": "EFG", + "(xyz)": "XYZ", + "COUNT_1M": "COUNT_1M", + "COUNT_50M": "COUNT_50M", + } @schemas.classproperty def _ABC(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.pyi index 8addfe28920d..7d43347fd84a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.pyi @@ -24,15 +24,7 @@ from petstore_api import schemas # noqa: F401 class EnumClass( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - "COUNT_1M": "COUNT_1M", - "COUNT_50M": "COUNT_50M", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py index d96902e0d121..094073cddc7f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -42,15 +42,17 @@ class properties: class enum_string_required( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "UPPER": "UPPER", "lower": "LOWER", "": "EMPTY", } - ), - schemas.StrSchema - ): @schemas.classproperty def UPPER(cls): @@ -66,15 +68,17 @@ def EMPTY(cls): class enum_string( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "UPPER": "UPPER", "lower": "LOWER", "": "EMPTY", } - ), - schemas.StrSchema - ): @schemas.classproperty def UPPER(cls): @@ -90,14 +94,17 @@ def EMPTY(cls): class enum_integer( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.Int32Schema + ): + + + class MetaOapg: + format = 'int32' + enum_value_to_name = { 1: "POSITIVE_1", -1: "NEGATIVE_1", } - ), - schemas.Int32Schema - ): @schemas.classproperty def POSITIVE_1(cls): @@ -109,14 +116,17 @@ def NEGATIVE_1(cls): class enum_number( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.Float64Schema + ): + + + class MetaOapg: + format = 'double' + enum_value_to_name = { 1.1: "POSITIVE_1_PT_1", -1.2: "NEGATIVE_1_PT_2", } - ), - schemas.Float64Schema - ): @schemas.classproperty def POSITIVE_1_PT_1(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi index d96902e0d121..1f885dcf3613 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi @@ -42,13 +42,7 @@ class EnumTest( class enum_string_required( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "UPPER": "UPPER", - "lower": "LOWER", - "": "EMPTY", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -66,13 +60,7 @@ class EnumTest( class enum_string( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "UPPER": "UPPER", - "lower": "LOWER", - "": "EMPTY", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -90,12 +78,7 @@ class EnumTest( class enum_integer( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - -1: "NEGATIVE_1", - } - ), + schemas.EnumBase, schemas.Int32Schema ): @@ -109,12 +92,7 @@ class EnumTest( class enum_number( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1.1: "POSITIVE_1_PT_1", - -1.2: "NEGATIVE_1_PT_2", - } - ), + schemas.EnumBase, schemas.Float64Schema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py index c184a9de47e2..a45ac99de806 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py @@ -47,13 +47,15 @@ class properties: class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "EquilateralTriangle": "EQUILATERAL_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "EquilateralTriangle": "EQUILATERAL_TRIANGLE", + } @schemas.classproperty def EQUILATERAL_TRIANGLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi index c184a9de47e2..7e9d4d38025b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi @@ -47,11 +47,7 @@ class EquilateralTriangle( class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "EquilateralTriangle": "EQUILATERAL_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py index 7f99f5b51ec3..b16b10a0488f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py @@ -63,6 +63,7 @@ class password( class MetaOapg: + format = 'password' max_length = 64 min_length = 10 @@ -85,6 +86,7 @@ class int32withValidations( class MetaOapg: + format = 'int32' inclusive_maximum = 200 inclusive_minimum = 20 int64 = schemas.Int64Schema @@ -96,6 +98,7 @@ class _float( class MetaOapg: + format = 'float' inclusive_maximum = 987.6 inclusive_minimum = 54.3 float32 = schemas.Float32Schema @@ -107,6 +110,7 @@ class double( class MetaOapg: + format = 'double' inclusive_maximum = 123.4 inclusive_minimum = 67.8 float64 = schemas.Float64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.py index fa53ad2959ff..18cd8df6434d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.py @@ -24,13 +24,7 @@ class IntegerEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - 1: "POSITIVE_1", - 2: "POSITIVE_2", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,6 +32,14 @@ class IntegerEnum( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 0: "POSITIVE_0", + 1: "POSITIVE_1", + 2: "POSITIVE_2", + } @schemas.classproperty def POSITIVE_0(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.pyi index fa53ad2959ff..5f88412337f6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum.pyi @@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401 class IntegerEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - 1: "POSITIVE_1", - 2: "POSITIVE_2", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.py index 6e931d02fd45..615680bd126b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.py @@ -24,13 +24,7 @@ class IntegerEnumBig( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 10: "POSITIVE_10", - 11: "POSITIVE_11", - 12: "POSITIVE_12", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,6 +32,14 @@ class IntegerEnumBig( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 10: "POSITIVE_10", + 11: "POSITIVE_11", + 12: "POSITIVE_12", + } @schemas.classproperty def POSITIVE_10(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.pyi index 6e931d02fd45..939443fcaaab 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.pyi @@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401 class IntegerEnumBig( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 10: "POSITIVE_10", - 11: "POSITIVE_11", - 12: "POSITIVE_12", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.py index 29e4afe94164..6ab7f2f21302 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.py @@ -24,11 +24,7 @@ class IntegerEnumOneValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -36,6 +32,12 @@ class IntegerEnumOneValue( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 0: "POSITIVE_0", + } @schemas.classproperty def POSITIVE_0(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.pyi index 29e4afe94164..1e911e5f24b5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_one_value.pyi @@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401 class IntegerEnumOneValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.py index 11f2d028bef7..87b44b36f166 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.py @@ -24,13 +24,7 @@ class IntegerEnumWithDefaultValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - 1: "POSITIVE_1", - 2: "POSITIVE_2", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,6 +32,14 @@ class IntegerEnumWithDefaultValue( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + 0: "POSITIVE_0", + 1: "POSITIVE_1", + 2: "POSITIVE_2", + } @schemas.classproperty def POSITIVE_0(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.pyi index 11f2d028bef7..9ecbb8d1630d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_with_default_value.pyi @@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401 class IntegerEnumWithDefaultValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 0: "POSITIVE_0", - 1: "POSITIVE_1", - 2: "POSITIVE_2", - } - ), + schemas.EnumBase, schemas.IntSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_max10.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_max10.py index c39215af60fa..ac4541fad1ff 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_max10.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_max10.py @@ -34,4 +34,5 @@ class IntegerMax10( class MetaOapg: + format = 'int64' inclusive_maximum = 10 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_min15.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_min15.py index 7430ad6f5e49..8424c1012a08 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_min15.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_min15.py @@ -34,4 +34,5 @@ class IntegerMin15( class MetaOapg: + format = 'int64' inclusive_minimum = 15 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py index 408ba30ae8a9..ddce91c9b96e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py @@ -47,13 +47,15 @@ class properties: class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "IsoscelesTriangle": "ISOSCELES_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "IsoscelesTriangle": "ISOSCELES_TRIANGLE", + } @schemas.classproperty def ISOSCELES_TRIANGLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi index 408ba30ae8a9..5addd1416026 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi @@ -47,11 +47,7 @@ class IsoscelesTriangle( class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "IsoscelesTriangle": "ISOSCELES_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.py index d013295fd990..bf95ea98af7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.py @@ -46,15 +46,17 @@ class properties: class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "add": "ADD", "replace": "REPLACE", "test": "TEST", } - ), - schemas.StrSchema - ): @schemas.classproperty def ADD(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.pyi index d013295fd990..50e1a870bdc6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_add_replace_test.pyi @@ -46,13 +46,7 @@ class JSONPatchRequestAddReplaceTest( class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "add": "ADD", - "replace": "REPLACE", - "test": "TEST", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.py index 7ff6a7bcfd94..0b84fba0970a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.py @@ -46,14 +46,16 @@ class properties: class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "move": "MOVE", "copy": "COPY", } - ), - schemas.StrSchema - ): @schemas.classproperty def MOVE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.pyi index 7ff6a7bcfd94..0654ee60fb87 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_move_copy.pyi @@ -46,12 +46,7 @@ class JSONPatchRequestMoveCopy( class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "move": "MOVE", - "copy": "COPY", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.py index ebe64d5ee090..4e15b41cefbd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.py @@ -44,13 +44,15 @@ class properties: class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "remove": "REMOVE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "remove": "REMOVE", + } @schemas.classproperty def REMOVE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.pyi index ebe64d5ee090..325cbe8a98e9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/json_patch_request_remove.pyi @@ -44,11 +44,7 @@ class JSONPatchRequestRemove( class op( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "remove": "REMOVE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py index c5d70ab8075e..031503142c6b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -104,14 +104,16 @@ class MetaOapg: class additional_properties( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "UPPER": "UPPER", "lower": "LOWER", } - ), - schemas.StrSchema - ): @schemas.classproperty def UPPER(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi index c5d70ab8075e..a89ebb2fc834 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi @@ -104,12 +104,7 @@ class MapTest( class additional_properties( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "UPPER": "UPPER", - "lower": "LOWER", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py index 817fb58ac797..6d653b0ab07e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py @@ -43,15 +43,17 @@ class properties: class status( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "placed": "PLACED", "approved": "APPROVED", "delivered": "DELIVERED", } - ), - schemas.StrSchema - ): @schemas.classproperty def PLACED(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi index 817fb58ac797..ccbca89e0823 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi @@ -43,13 +43,7 @@ class Order( class status( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py index cc5bd6a5a7e8..5b1b6b8275e2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py @@ -100,15 +100,17 @@ def __getitem__(self, i: int) -> 'Tag': class status( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "available": "AVAILABLE", "pending": "PENDING", "sold": "SOLD", } - ), - schemas.StrSchema - ): @schemas.classproperty def AVAILABLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi index cc5bd6a5a7e8..01529098ea03 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi @@ -100,13 +100,7 @@ class Pet( class status( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "available": "AVAILABLE", - "pending": "PENDING", - "sold": "SOLD", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py index a1cf375d2a0c..90c85c2388f7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py @@ -43,13 +43,15 @@ class properties: class shapeType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "Quadrilateral": "QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "Quadrilateral": "QUADRILATERAL", + } @schemas.classproperty def QUADRILATERAL(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi index a1cf375d2a0c..92505429048f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi @@ -43,11 +43,7 @@ class QuadrilateralInterface( class shapeType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "Quadrilateral": "QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py index e08d1d098b9f..46083ad56443 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py @@ -47,13 +47,15 @@ class properties: class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "ScaleneTriangle": "SCALENE_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "ScaleneTriangle": "SCALENE_TRIANGLE", + } @schemas.classproperty def SCALENE_TRIANGLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi index e08d1d098b9f..b602ba62d538 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi @@ -47,11 +47,7 @@ class ScaleneTriangle( class triangleType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "ScaleneTriangle": "SCALENE_TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py index 6490d3a57234..93d3c1f9325a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py @@ -47,13 +47,15 @@ class properties: class quadrilateralType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "SimpleQuadrilateral": "SIMPLE_QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "SimpleQuadrilateral": "SIMPLE_QUADRILATERAL", + } @schemas.classproperty def SIMPLE_QUADRILATERAL(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi index 6490d3a57234..59505edad859 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi @@ -47,11 +47,7 @@ class SimpleQuadrilateral( class quadrilateralType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "SimpleQuadrilateral": "SIMPLE_QUADRILATERAL", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.py index 94ee17b59afd..abc1696bc148 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.py @@ -24,17 +24,7 @@ class StringEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.NoneClass.NONE: "NONE", - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - "single quoted": "SINGLE_QUOTED", - "multiple\nlines": "MULTIPLE_LINES", - "double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE", - } - ), + schemas.EnumBase, schemas.StrBase, schemas.NoneBase, schemas.Schema, @@ -45,10 +35,18 @@ class StringEnum( Do not edit the class manually. """ - - @schemas.classproperty - def NONE(cls): - return cls(None) + + + class MetaOapg: + enum_value_to_name = { + "placed": "PLACED", + "approved": "APPROVED", + "delivered": "DELIVERED", + "single quoted": "SINGLE_QUOTED", + "multiple\nlines": "MULTIPLE_LINES", + "double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE", + schemas.NoneClass.NONE: "NONE", + } @schemas.classproperty def PLACED(cls): @@ -73,6 +71,10 @@ def MULTIPLE_LINES(cls): @schemas.classproperty def DOUBLE_QUOTE_WITH_NEWLINE(cls): return cls("double quote \n with newline") + + @schemas.classproperty + def NONE(cls): + return cls(None) def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.pyi index 94ee17b59afd..abc1696bc148 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum.pyi @@ -24,17 +24,7 @@ from petstore_api import schemas # noqa: F401 class StringEnum( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - schemas.NoneClass.NONE: "NONE", - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - "single quoted": "SINGLE_QUOTED", - "multiple\nlines": "MULTIPLE_LINES", - "double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE", - } - ), + schemas.EnumBase, schemas.StrBase, schemas.NoneBase, schemas.Schema, @@ -45,10 +35,18 @@ class StringEnum( Do not edit the class manually. """ - - @schemas.classproperty - def NONE(cls): - return cls(None) + + + class MetaOapg: + enum_value_to_name = { + "placed": "PLACED", + "approved": "APPROVED", + "delivered": "DELIVERED", + "single quoted": "SINGLE_QUOTED", + "multiple\nlines": "MULTIPLE_LINES", + "double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE", + schemas.NoneClass.NONE: "NONE", + } @schemas.classproperty def PLACED(cls): @@ -73,6 +71,10 @@ class StringEnum( @schemas.classproperty def DOUBLE_QUOTE_WITH_NEWLINE(cls): return cls("double quote \n with newline") + + @schemas.classproperty + def NONE(cls): + return cls(None) def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.py index 33976873a611..852600965552 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.py @@ -24,13 +24,7 @@ class StringEnumWithDefaultValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,6 +32,14 @@ class StringEnumWithDefaultValue( Do not edit the class manually. """ + + + class MetaOapg: + enum_value_to_name = { + "placed": "PLACED", + "approved": "APPROVED", + "delivered": "DELIVERED", + } @schemas.classproperty def PLACED(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.pyi index 33976873a611..e51581c628f0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_enum_with_default_value.pyi @@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401 class StringEnumWithDefaultValue( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - } - ), + schemas.EnumBase, schemas.StrSchema ): """NOTE: This class is auto generated by OpenAPI Generator. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py index 6653983329a4..7ac28c0031c6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py @@ -43,13 +43,15 @@ class properties: class shapeType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "Triangle": "TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "Triangle": "TRIANGLE", + } @schemas.classproperty def TRIANGLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi index 6653983329a4..86b525d359a7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi @@ -43,11 +43,7 @@ class TriangleInterface( class shapeType( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "Triangle": "TRIANGLE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/uuid_string.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/uuid_string.py index 106a9f3cd59b..92a3825e3764 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/uuid_string.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/uuid_string.py @@ -34,4 +34,5 @@ class UUIDString( class MetaOapg: + format = 'uuid' min_length = 1 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py index d470f2901a8f..b645789bd151 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py @@ -42,13 +42,15 @@ class properties: class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "whale": "WHALE", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "whale": "WHALE", + } @schemas.classproperty def WHALE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi index d470f2901a8f..48e2538cb8c3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi @@ -42,11 +42,7 @@ class Whale( class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "whale": "WHALE", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py index 1cf74de59e90..960a43f5921e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py @@ -42,13 +42,15 @@ class properties: class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "zebra": "ZEBRA", - } - ), + schemas.EnumBase, schemas.StrSchema ): + + + class MetaOapg: + enum_value_to_name = { + "zebra": "ZEBRA", + } @schemas.classproperty def ZEBRA(cls): @@ -56,15 +58,17 @@ def ZEBRA(cls): class type( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "plains": "PLAINS", "mountain": "MOUNTAIN", "grevys": "GREVYS", } - ), - schemas.StrSchema - ): @schemas.classproperty def PLAINS(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi index 1cf74de59e90..3666395b3134 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi @@ -42,11 +42,7 @@ class Zebra( class className( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "zebra": "ZEBRA", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -56,13 +52,7 @@ class Zebra( class type( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "plains": "PLAINS", - "mountain": "MOUNTAIN", - "grevys": "GREVYS", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.py index 6c9c94cccfd7..d69fbec4c6b7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.py @@ -39,14 +39,16 @@ class MetaOapg: class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { ">": "GREATER_THAN", "$": "DOLLAR", } - ), - schemas.StrSchema - ): @schemas.classproperty def GREATER_THAN(cls): @@ -72,15 +74,17 @@ def __getitem__(self, i: int) -> MetaOapg.items: class EnumQueryStringSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema +): + + + class MetaOapg: + enum_value_to_name = { "_abc": "_ABC", "-efg": "EFG", "(xyz)": "XYZ", } - ), - schemas.StrSchema -): @schemas.classproperty def _ABC(cls): @@ -96,14 +100,17 @@ def XYZ(cls): class EnumQueryIntegerSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.Int32Schema +): + + + class MetaOapg: + format = 'int32' + enum_value_to_name = { 1: "POSITIVE_1", -2: "NEGATIVE_2", } - ), - schemas.Int32Schema -): @schemas.classproperty def POSITIVE_1(cls): @@ -115,14 +122,17 @@ def NEGATIVE_2(cls): class EnumQueryDoubleSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.Float64Schema +): + + + class MetaOapg: + format = 'double' + enum_value_to_name = { 1.1: "POSITIVE_1_PT_1", -1.2: "NEGATIVE_1_PT_2", } - ), - schemas.Float64Schema -): @schemas.classproperty def POSITIVE_1_PT_1(cls): @@ -188,14 +198,16 @@ class MetaOapg: class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { ">": "GREATER_THAN", "$": "DOLLAR", } - ), - schemas.StrSchema - ): @schemas.classproperty def GREATER_THAN(cls): @@ -221,15 +233,17 @@ def __getitem__(self, i: int) -> MetaOapg.items: class EnumHeaderStringSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema +): + + + class MetaOapg: + enum_value_to_name = { "_abc": "_ABC", "-efg": "EFG", "(xyz)": "XYZ", } - ), - schemas.StrSchema -): @schemas.classproperty def _ABC(cls): @@ -293,14 +307,16 @@ class MetaOapg: class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { ">": "GREATER_THAN", "$": "DOLLAR", } - ), - schemas.StrSchema - ): @schemas.classproperty def GREATER_THAN(cls): @@ -326,15 +342,17 @@ def __getitem__(self, i: int) -> MetaOapg.items: class enum_form_string( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "_abc": "_ABC", "-efg": "EFG", "(xyz)": "XYZ", } - ), - schemas.StrSchema - ): @schemas.classproperty def _ABC(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.pyi index b6ceae7b8ef8..7db648567989 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/get.pyi @@ -37,12 +37,7 @@ class EnumQueryStringArraySchema( class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - ">": "GREATER_THAN", - "$": "DOLLAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -70,13 +65,7 @@ class EnumQueryStringArraySchema( class EnumQueryStringSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -94,12 +83,7 @@ class EnumQueryStringSchema( class EnumQueryIntegerSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1: "POSITIVE_1", - -2: "NEGATIVE_2", - } - ), + schemas.EnumBase, schemas.Int32Schema ): @@ -113,12 +97,7 @@ class EnumQueryIntegerSchema( class EnumQueryDoubleSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - 1.1: "POSITIVE_1_PT_1", - -1.2: "NEGATIVE_1_PT_2", - } - ), + schemas.EnumBase, schemas.Float64Schema ): @@ -141,12 +120,7 @@ class EnumHeaderStringArraySchema( class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - ">": "GREATER_THAN", - "$": "DOLLAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -174,13 +148,7 @@ class EnumHeaderStringArraySchema( class EnumHeaderStringSchema( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -217,12 +185,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - ">": "GREATER_THAN", - "$": "DOLLAR", - } - ), + schemas.EnumBase, schemas.StrSchema ): @@ -250,13 +213,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class enum_form_string( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/post.py index 54172de750cd..b732e5d61003 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake/post.py @@ -62,6 +62,7 @@ class int32( class MetaOapg: + format = 'int32' inclusive_maximum = 200 inclusive_minimum = 20 int64 = schemas.Int64Schema @@ -83,6 +84,7 @@ class _float( class MetaOapg: + format = 'float' inclusive_maximum = 987.6 @@ -92,6 +94,7 @@ class double( class MetaOapg: + format = 'double' inclusive_maximum = 123.4 inclusive_minimum = 67.8 @@ -131,6 +134,7 @@ class password( class MetaOapg: + format = 'password' max_length = 64 min_length = 10 callback = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.py index 3f9a2430f0e1..b8b945f54fa4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.py @@ -41,15 +41,17 @@ class MetaOapg: class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { "available": "AVAILABLE", "pending": "PENDING", "sold": "SOLD", } - ), - schemas.StrSchema - ): @schemas.classproperty def AVAILABLE(cls): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.pyi index 77db139f321c..c626e911a770 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_status/get.pyi @@ -39,13 +39,7 @@ class StatusSchema( class items( - schemas.SchemaEnumMakerClsFactory( - enum_value_to_name={ - "available": "AVAILABLE", - "pending": "PENDING", - "sold": "SOLD", - } - ), + schemas.EnumBase, schemas.StrSchema ): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_order_order_id/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_order_order_id/get.py index eed2c94e672a..cae807ed63c2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_order_order_id/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_order_order_id/get.py @@ -38,6 +38,7 @@ class OrderIdSchema( class MetaOapg: + format = 'int64' inclusive_maximum = 5 inclusive_minimum = 1 RequestRequiredPathParams = typing_extensions.TypedDict( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py index 80ee17062a50..5628de732ace 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py @@ -411,7 +411,7 @@ def __get_new_cls( """ cls._process_schema_classes_oapg(schema_classes) enum_schema = any( - hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes) + issubclass(this_cls, EnumBase) for this_cls in schema_classes) inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set) chosen_schema_classes = schema_classes - inheritable_primitive_type suffix = tuple(inheritable_primitive_type) @@ -880,41 +880,22 @@ def _raise_validation_errror_message_oapg(value, constraint_msg, constraint_valu ) -class EnumMakerBase: - pass - - -def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker': - class SchemaEnumMaker(EnumMakerBase): - @classmethod - def _enum_value_to_name( - cls - ) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]: - pass - try: - super_enum_value_to_name = super()._enum_value_to_name() - except AttributeError: - return enum_value_to_name - intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items()) - return intersection - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - SchemaEnumMaker _validate_oapg - Validates that arg is in the enum's allowed values - """ - try: - cls._enum_value_to_name()[arg] - except KeyError: - raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name())) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - return SchemaEnumMaker +class EnumBase: + @classmethod + def _validate_oapg( + cls, + arg, + validation_metadata: ValidationMetadata, + ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: + """ + EnumBase _validate_oapg + Validates that arg is in the enum's allowed values + """ + try: + cls.MetaOapg.enum_value_to_name[arg] + except KeyError: + raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys())) + return super()._validate_oapg(arg, validation_metadata=validation_metadata) class BoolBase: diff --git a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_combine_schemas.py b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_combine_schemas.py index 13e4ba88f9ad..f77f71ec46a3 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_combine_schemas.py +++ b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_combine_schemas.py @@ -32,14 +32,10 @@ def test_valid_enum_plus_prim(self): class EnumPlusPrim(IntegerMax10, IntegerEnumOneValue): pass - assert EnumPlusPrim._enum_value_to_name() == {0: "POSITIVE_0"} - # order of base classes does not matter class EnumPlusPrim(IntegerEnumOneValue, IntegerMax10): pass - assert EnumPlusPrim._enum_value_to_name() == {0: "POSITIVE_0"} - enum_value = EnumPlusPrim.POSITIVE_0 assert isinstance(enum_value, EnumPlusPrim) assert isinstance(enum_value, Singleton) @@ -59,17 +55,13 @@ class EnumPlusPrim(IntegerEnumOneValue, IntegerMax10): assert isinstance(val, decimal.Decimal) def test_valid_enum_plus_enum(self): - class IntegerOneEnum(IntegerEnum, IntegerEnumOneValue): + class IntegerOneEnum(IntegerEnumOneValue, IntegerEnum): pass - assert IntegerOneEnum._enum_value_to_name() == {0: "POSITIVE_0"} - # order of base classes does not matter - class IntegerOneEnum(IntegerEnumOneValue, IntegerEnum): + class IntegerOneEnum(IntegerEnum, IntegerEnumOneValue): pass - assert IntegerOneEnum._enum_value_to_name() == {0: "POSITIVE_0"} - enum_value = IntegerOneEnum.POSITIVE_0 assert isinstance(enum_value, IntegerOneEnum) assert isinstance(enum_value, Singleton) @@ -77,12 +69,6 @@ class IntegerOneEnum(IntegerEnumOneValue, IntegerEnum): # we can access this enum from our class assert IntegerOneEnum.POSITIVE_0 == 0 - # accessing invalid enum throws an exception - invalid_enums = ['POSITIVE_1', 'POSITIVE_2'] - for invalid_enum in invalid_enums: - with self.assertRaises(petstore_api.ApiValueError): - getattr(IntegerOneEnum, invalid_enum) - if __name__ == '__main__': unittest.main() From 38262bf295176f1a715f51f70954b74230a7097d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 22 Sep 2022 10:59:00 -0700 Subject: [PATCH 2/2] Fixed docs for enums, they show the allowed bool and None values now --- .../python-experimental/model_templates/notes_msg.handlebars | 2 +- .../docs/models/EnumWithFalseDoesNotMatch0.md | 2 +- .../docs/models/EnumWithTrueDoesNotMatch1.md | 2 +- .../petstore/python-experimental/docs/models/BooleanEnum.md | 2 +- .../petstore/python-experimental/docs/models/StringEnum.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/notes_msg.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/notes_msg.handlebars index d5d0092ee8f8..43d1163b5c04 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/notes_msg.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/notes_msg.handlebars @@ -1 +1 @@ -{{#unless isArray}}{{#unless complexType}}{{#with allowableValues}}must be one of [{{#each enumVars}}{{{value}}}, {{/each}}] {{/with}}{{#if defaultValue}}{{#unless hasRequired}}if omitted the server will use the default value of {{{defaultValue}}}{{/unless}}{{/if}}{{#eq getFormat "uuid"}}value must be a uuid{{/eq}}{{#eq getFormat "date"}}value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq getFormat "date-time"}}value must conform to RFC-3339 date-time{{/eq}}{{#eq getFormat "number"}}value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq getFormat "int32"}}value must be a 32 bit integer{{/eq}}{{#eq getFormat "int64"}}value must be a 64 bit integer{{/eq}}{{#eq getFormat "double"}}value must be a 64 bit float{{/eq}}{{#eq getFormat "float"}}value must be a 32 bit float{{/eq}}{{/unless}}{{/unless}} \ No newline at end of file +{{#unless isArray}}{{#unless complexType}}{{#with allowableValues}}must be one of [{{#each enumVars}}{{#eq value "schemas.NoneClass.NONE"}}None{{else}}{{#eq value "schemas.BoolClass.TRUE"}}True{{else}}{{#eq value "schemas.BoolClass.FALSE"}}False{{else}}{{{value}}}{{/eq}}{{/eq}}{{/eq}}, {{/each}}] {{/with}}{{#if defaultValue}}{{#unless hasRequired}}if omitted the server will use the default value of {{{defaultValue}}}{{/unless}}{{/if}}{{#eq getFormat "uuid"}}value must be a uuid{{/eq}}{{#eq getFormat "date"}}value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq getFormat "date-time"}}value must conform to RFC-3339 date-time{{/eq}}{{#eq getFormat "number"}}value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq getFormat "int32"}}value must be a 32 bit integer{{/eq}}{{#eq getFormat "int64"}}value must be a 64 bit integer{{/eq}}{{#eq getFormat "double"}}value must be a 64 bit float{{/eq}}{{#eq getFormat "float"}}value must be a 32 bit float{{/eq}}{{/unless}}{{/unless}} \ No newline at end of file diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithFalseDoesNotMatch0.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithFalseDoesNotMatch0.md index 1b689953a350..19b1b49815dd 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithFalseDoesNotMatch0.md +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithFalseDoesNotMatch0.md @@ -3,7 +3,7 @@ ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- -bool, | BoolClass, | | must be one of [schemas.BoolClass.FALSE, ] +bool, | BoolClass, | | must be one of [False, ] [[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/3_0_3_unit_test/python-experimental/docs/models/EnumWithTrueDoesNotMatch1.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithTrueDoesNotMatch1.md index 4ddd5d9093a7..469529fa8412 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithTrueDoesNotMatch1.md +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/models/EnumWithTrueDoesNotMatch1.md @@ -3,7 +3,7 @@ ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- -bool, | BoolClass, | | must be one of [schemas.BoolClass.TRUE, ] +bool, | BoolClass, | | must be one of [True, ] [[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/models/BooleanEnum.md b/samples/openapi3/client/petstore/python-experimental/docs/models/BooleanEnum.md index 5d807cf82d5e..a84330415cbe 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/models/BooleanEnum.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/models/BooleanEnum.md @@ -3,7 +3,7 @@ ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- -bool, | BoolClass, | | must be one of [schemas.BoolClass.TRUE, ] +bool, | BoolClass, | | must be one of [True, ] [[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/models/StringEnum.md b/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md index 4a41fc69917e..06c26a7a1ac6 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/models/StringEnum.md @@ -3,7 +3,7 @@ ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- -None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", schemas.NoneClass.NONE, ] +None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", None, ] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)