diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/dict_partial.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/dict_partial.handlebars index 956af82d2fd..18a88cbf971 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/dict_partial.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/dict_partial.handlebars @@ -25,6 +25,7 @@ def discriminator(cls): {{/with}} {{/if}} {{#if vars}} + class properties: {{#each vars}} {{#if complexType}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/list_partial.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/list_partial.handlebars new file mode 100644 index 00000000000..2830d9903e0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/list_partial.handlebars @@ -0,0 +1,11 @@ +{{#with items}} +{{#if complexType}} + +@classmethod +@property +def {{baseName}}(cls) -> typing.Type['{{complexType}}']: + return {{complexType}} +{{else}} +{{> model_templates/schema }} +{{/if}} +{{/with}} 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 0c4382484aa..a43d5c67e6e 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 @@ -11,9 +11,6 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}} schemas.AnyTypeSchema, {{/if}} {{else}} - {{#if getHasMultipleTypes}} - schemas.SchemaTypeCheckerClsFactory(typing.Union[{{#if isNull}}schemas.NoneClass, {{/if}}{{#if isMap}}frozendict.frozendict, {{/if}}{{#if isArray}}tuple, {{/if}}{{#if isString }}str, {{/if}}{{#or isInteger isNumber}}decimal.Decimal, {{/or}}{{#if isBoolean}}schemas.BoolClass, {{/if}}]), - {{/if}} {{#if composedSchemas}} schemas.ComposedBase, {{/if}} @@ -41,17 +38,9 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}} {{#if getFormat}} format = '{{getFormat}}' {{/if}} -{{#with items}} -{{#if complexType}} - - @classmethod - @property - def {{baseName}}(cls) -> typing.Type['{{complexType}}']: - return {{complexType}} -{{else}} - {{> model_templates/schema }} +{{#if getItems}} + {{> model_templates/list_partial }} {{/if}} -{{/with}} {{#or additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars}} {{> model_templates/dict_partial }} {{/or}} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_dict.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_dict.handlebars index 46073d372da..1bee51b3067 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_dict.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_dict.handlebars @@ -14,13 +14,22 @@ class {{> model_templates/classname }}( {{/if}} """ {{/if}} +{{#if isStub}} +{{#or additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars}} + + + class MetaOapg: + {{> model_templates/dict_partial }} +{{/or}} +{{else}} +{{#or additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars hasValidation}} class MetaOapg: {{> model_templates/dict_partial }} -{{#unless isStub}} {{> model_templates/validations }} -{{/unless}} +{{/or}} +{{/if}} {{> model_templates/property_type_hints }} {{> model_templates/new }} diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_list.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_list.handlebars index 2b6c045814c..ae52b3e923f 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_list.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/schema_list.handlebars @@ -14,23 +14,24 @@ class {{> model_templates/classname }}( {{/if}} """ {{/if}} +{{#if isStub}} +{{#if items}} class MetaOapg: -{{#unless isStub}} - {{> model_templates/validations }} -{{/unless}} -{{#with items}} -{{#if complexType}} - - @classmethod - @property - def {{baseName}}(cls) -> typing.Type['{{complexType}}']: - return {{complexType}} -{{else}} - {{> model_templates/schema }} + {{> model_templates/list_partial }} +{{/if}} +{{else}} +{{#or getItems hasValidation}} + + + class MetaOapg: +{{#if hasValidation}} + {{> model_templates/validations }} +{{/if}} + {{> model_templates/list_partial }} +{{/or}} {{/if}} -{{/with}} {{> model_templates/new }} 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 19c3308a198..e74015e511e 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/schemas.handlebars @@ -236,8 +236,60 @@ class Schema: the base class of all swagger/openapi schemas/models """ __inheritable_primitive_types_set = {decimal.Decimal, str, tuple, frozendict.frozendict, FileIO, bytes, BoolClass, NoneClass} + _types: typing.Set[typing.Type] MetaOapg = MetaOapgTyped + @staticmethod + def __get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed""" + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return "is {0}".format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + @classmethod + def __type_error_message( + cls, var_value=None, var_name=None, valid_classes=None, key_type=None + ): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a tuple + """ + key_or_value = "value" + if key_type: + key_or_value = "key" + valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) + msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + return msg + + @classmethod + def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): + error_msg = cls.__type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type, + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type, + ) + @classmethod def _validate_oapg( cls, @@ -246,21 +298,8 @@ class Schema: ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: """ Schema _validate_oapg - Runs all schema validation logic and - returns a dynamic class of different bases depending upon the input - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Use cases: - 1. inheritable type: string/decimal.Decimal/frozendict.frozendict/tuple - 2. singletons: bool/None -> uses the base classes BoolClass/NoneClass - - Required Steps: - 1. verify type of input is valid vs the allowed _types - 2. check validations that are applicable for this type of input - 3. if enums exist, check that the value exists in the enum + All keyword validation except for type checking was done in calling stack frames + If those validations passed, the validated classes are collected in path_to_schemas Returns: path_to_schemas: a map of path to schemas @@ -270,6 +309,14 @@ class Schema: ApiTypeError: when the input type is not in the list of allowed spec types """ base_class = type(arg) + if base_class not in cls._types: + raise cls.__get_type_error( + arg, + validation_metadata.path_to_item, + cls._types, + key_type=False, + ) + path_to_schemas = {validation_metadata.path_to_item: set()} path_to_schemas[validation_metadata.path_to_item].add(cls) path_to_schemas[validation_metadata.path_to_item].add(base_class) @@ -508,6 +555,8 @@ if typing.TYPE_CHECKING: StrMixin = str DecimalMixin = decimal.Decimal BoolMixin = BoolClass + BytesMixin = bytes + FileMixin = FileIO # qty 2 class BinaryMixin(bytes, FileIO): pass @@ -629,77 +678,151 @@ if typing.TYPE_CHECKING: # qty 6 class NoneFrozenDictTupleStrDecimalBoolMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass): pass + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes): + pass else: # qty 1 - NoneMixin = object - FrozenDictMixin = object - TupleMixin = object - StrMixin = object - DecimalMixin = object - BoolMixin = object + class NoneMixin: + _types = {NoneClass} + class FrozenDictMixin: + _types = {frozendict.frozendict} + class TupleMixin: + _types = {tuple} + class StrMixin: + _types = {str} + class DecimalMixin: + _types = {decimal.Decimal} + class BoolMixin: + _types = {BoolClass} + class BytesMixin: + _types = {bytes} + class FileMixin: + _types = {FileIO} # qty 2 - BinaryMixin = object - NoneFrozenDictMixin = object - NoneTupleMixin = object - NoneStrMixin = object - NoneDecimalMixin = object - NoneBoolMixin = object - FrozenDictTupleMixin = object - FrozenDictStrMixin = object - FrozenDictDecimalMixin = object - FrozenDictBoolMixin = object - TupleStrMixin = object - TupleDecimalMixin = object - TupleBoolMixin = object - StrDecimalMixin = object - StrBoolMixin = object - DecimalBoolMixin = object + class BinaryMixin: + _types = {bytes, FileIO} + class NoneFrozenDictMixin: + _types = {NoneClass, frozendict.frozendict} + class NoneTupleMixin: + _types = {NoneClass, tuple} + class NoneStrMixin: + _types = {NoneClass, str} + class NoneDecimalMixin: + _types = {NoneClass, decimal.Decimal} + class NoneBoolMixin: + _types = {NoneClass, BoolClass} + class FrozenDictTupleMixin: + _types = {frozendict.frozendict, tuple} + class FrozenDictStrMixin: + _types = {frozendict.frozendict, str} + class FrozenDictDecimalMixin: + _types = {frozendict.frozendict, decimal.Decimal} + class FrozenDictBoolMixin: + _types = {frozendict.frozendict, BoolClass} + class TupleStrMixin: + _types = {tuple, str} + class TupleDecimalMixin: + _types = {tuple, decimal.Decimal} + class TupleBoolMixin: + _types = {tuple, BoolClass} + class StrDecimalMixin: + _types = {str, decimal.Decimal} + class StrBoolMixin: + _types = {str, BoolClass} + class DecimalBoolMixin: + _types = {decimal.Decimal, BoolClass} # qty 3 - NoneFrozenDictTupleMixin = object - NoneFrozenDictStrMixin = object - NoneFrozenDictDecimalMixin = object - NoneFrozenDictBoolMixin = object - NoneTupleStrMixin = object - NoneTupleDecimalMixin = object - NoneTupleBoolMixin = object - NoneStrDecimalMixin = object - NoneStrBoolMixin = object - NoneDecimalBoolMixin = object - FrozenDictTupleStrMixin = object - FrozenDictTupleDecimalMixin = object - FrozenDictTupleBoolMixin = object - FrozenDictStrDecimalMixin = object - FrozenDictStrBoolMixin = object - FrozenDictDecimalBoolMixin = object - TupleStrDecimalMixin = object - TupleStrBoolMixin = object - TupleDecimalBoolMixin = object - StrDecimalBoolMixin = object + class NoneFrozenDictTupleMixin: + _types = {NoneClass, frozendict.frozendict, tuple} + class NoneFrozenDictStrMixin: + _types = {NoneClass, frozendict.frozendict, str} + class NoneFrozenDictDecimalMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal} + class NoneFrozenDictBoolMixin: + _types = {NoneClass, frozendict.frozendict, BoolClass} + class NoneTupleStrMixin: + _types = {NoneClass, tuple, str} + class NoneTupleDecimalMixin: + _types = {NoneClass, tuple, decimal.Decimal} + class NoneTupleBoolMixin: + _types = {NoneClass, tuple, BoolClass} + class NoneStrDecimalMixin: + _types = {NoneClass, str, decimal.Decimal} + class NoneStrBoolMixin: + _types = {NoneClass, str, BoolClass} + class NoneDecimalBoolMixin: + _types = {NoneClass, decimal.Decimal, BoolClass} + class FrozenDictTupleStrMixin: + _types = {frozendict.frozendict, tuple, str} + class FrozenDictTupleDecimalMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal} + class FrozenDictTupleBoolMixin: + _types = {frozendict.frozendict, tuple, BoolClass} + class FrozenDictStrDecimalMixin: + _types = {frozendict.frozendict, str, decimal.Decimal} + class FrozenDictStrBoolMixin: + _types = {frozendict.frozendict, str, BoolClass} + class FrozenDictDecimalBoolMixin: + _types = {frozendict.frozendict, decimal.Decimal, BoolClass} + class TupleStrDecimalMixin: + _types = {tuple, str, decimal.Decimal} + class TupleStrBoolMixin: + _types = {tuple, str, BoolClass} + class TupleDecimalBoolMixin: + _types = {tuple, decimal.Decimal, BoolClass} + class StrDecimalBoolMixin: + _types = {str, decimal.Decimal, BoolClass} # qty 4 - NoneFrozenDictTupleStrMixin = object - NoneFrozenDictTupleDecimalMixin = object - NoneFrozenDictTupleBoolMixin = object - NoneFrozenDictStrDecimalMixin = object - NoneFrozenDictStrBoolMixin = object - NoneFrozenDictDecimalBoolMixin = object - NoneTupleStrDecimalMixin = object - NoneTupleStrBoolMixin = object - NoneTupleDecimalBoolMixin = object - NoneStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalMixin = object - FrozenDictTupleStrBoolMixin = object - FrozenDictTupleDecimalBoolMixin = object - FrozenDictStrDecimalBoolMixin = object - TupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str} + class NoneFrozenDictTupleDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal} + class NoneFrozenDictTupleBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, BoolClass} + class NoneFrozenDictStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal} + class NoneFrozenDictStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, BoolClass} + class NoneFrozenDictDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalMixin: + _types = {NoneClass, tuple, str, decimal.Decimal} + class NoneTupleStrBoolMixin: + _types = {NoneClass, tuple, str, BoolClass} + class NoneTupleDecimalBoolMixin: + _types = {NoneClass, tuple, decimal.Decimal, BoolClass} + class NoneStrDecimalBoolMixin: + _types = {NoneClass, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal} + class FrozenDictTupleStrBoolMixin: + _types = {frozendict.frozendict, tuple, str, BoolClass} + class FrozenDictTupleDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class FrozenDictStrDecimalBoolMixin: + _types = {frozendict.frozendict, str, decimal.Decimal, BoolClass} + class TupleStrDecimalBoolMixin: + _types = {tuple, str, decimal.Decimal, BoolClass} # qty 5 - NoneFrozenDictTupleStrDecimalMixin = object - NoneFrozenDictTupleStrBoolMixin = object - NoneFrozenDictTupleDecimalBoolMixin = object - NoneFrozenDictStrDecimalBoolMixin = object - NoneTupleStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal} + class NoneFrozenDictTupleStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, BoolClass} + class NoneFrozenDictTupleDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class NoneFrozenDictStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalBoolMixin: + _types = {NoneClass, tuple, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} # qty 6 - NoneFrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes} class ValidatorBase: @@ -743,92 +866,6 @@ class Validator(typing.Protocol): pass -def SchemaTypeCheckerClsFactory(union_type_cls: typing.Any) -> Validator: - if typing.get_origin(union_type_cls) is typing.Union: - union_classes = typing.get_args(union_type_cls) - else: - # note: when a union of a single class is passed in, the union disappears - union_classes = tuple([union_type_cls]) - """ - I want the type hint... union_type_cls - and to use it as a base class but when I do, I get - TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - """ - class SchemaTypeChecker: - @staticmethod - def __get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed""" - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return "is {0}".format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - @classmethod - def __type_error_message( - cls, var_value=None, var_name=None, valid_classes=None, key_type=None - ): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a tuple - """ - key_or_value = "value" - if key_type: - key_or_value = "key" - valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) - msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - return msg - - @classmethod - def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): - error_msg = cls.__type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type, - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type, - ) - - @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]]]: - """ - SchemaTypeChecker _validate_oapg - Validates arg's type - """ - arg_type = type(arg) - if arg_type in union_classes: - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - raise cls.__get_type_error( - arg, - validation_metadata.path_to_item, - union_classes, - key_type=False, - ) - - return SchemaTypeChecker - - class EnumMakerBase: pass @@ -1989,7 +2026,6 @@ class ComposedBase(Discriminable): # DictBase, ListBase, NumberBase, StrBase, BoolBase, NoneBase class ComposedSchema( - SchemaTypeCheckerClsFactory(typing.Union[NoneClass, str, decimal.Decimal, BoolClass, tuple, frozendict.frozendict]), ComposedBase, DictBase, ListBase, @@ -2010,7 +2046,6 @@ class ComposedSchema( class ListSchema( - SchemaTypeCheckerClsFactory(tuple), ListBase, Schema, TupleMixin @@ -2025,7 +2060,6 @@ class ListSchema( class NoneSchema( - SchemaTypeCheckerClsFactory(NoneClass), NoneBase, Schema, NoneMixin @@ -2040,7 +2074,6 @@ class NoneSchema( class NumberSchema( - SchemaTypeCheckerClsFactory(decimal.Decimal), NumberBase, Schema, DecimalMixin @@ -2236,7 +2269,6 @@ class Float64Schema( class StrSchema( - SchemaTypeCheckerClsFactory(str), StrBase, Schema, StrMixin @@ -2289,8 +2321,8 @@ class DecimalSchema(DecimalBase, StrSchema): class BytesSchema( - SchemaTypeCheckerClsFactory(bytes), Schema, + BytesMixin ): """ this class will subclass bytes and is immutable @@ -2300,8 +2332,8 @@ class BytesSchema( class FileSchema( - SchemaTypeCheckerClsFactory(FileIO), Schema, + FileMixin ): """ This class is NOT immutable @@ -2329,7 +2361,6 @@ class BinaryBase: class BinarySchema( - SchemaTypeCheckerClsFactory(typing.Union[bytes, FileIO]), ComposedBase, BinaryBase, Schema, @@ -2346,7 +2377,6 @@ class BinarySchema( class BoolSchema( - SchemaTypeCheckerClsFactory(BoolClass), BoolBase, Schema, BoolMixin @@ -2361,9 +2391,6 @@ class BoolSchema( class AnyTypeSchema( - SchemaTypeCheckerClsFactory( - typing.Union[frozendict.frozendict, tuple, decimal.Decimal, str, BoolClass, NoneClass, bytes, FileIO] - ), DictBase, ListBase, NumberBase, @@ -2371,7 +2398,7 @@ class AnyTypeSchema( BoolBase, NoneBase, Schema, - NoneFrozenDictTupleStrDecimalBoolMixin + NoneFrozenDictTupleStrDecimalBoolFileBytesMixin ): # Python representation of a schema defined as true or {} pass @@ -2407,7 +2434,6 @@ class NotAnyTypeSchema( class DictSchema( - SchemaTypeCheckerClsFactory(frozendict.frozendict), DictBase, Schema, FrozenDictMixin diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py index 4843215db63..b0fb32bcbe0 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py @@ -33,6 +33,7 @@ class AdditionalpropertiesAllowsASchemaWhichShouldValidate( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi index 4843215db63..b0fb32bcbe0 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi @@ -33,6 +33,7 @@ class AdditionalpropertiesAllowsASchemaWhichShouldValidate( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py index 26a1c9da9f7..a7fdf31909d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py @@ -33,6 +33,7 @@ class AdditionalpropertiesAreAllowedByDefault( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi index 26a1c9da9f7..a7fdf31909d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi @@ -33,6 +33,7 @@ class AdditionalpropertiesAreAllowedByDefault( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py index 2c732a2d725..b429330b0b3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py @@ -42,6 +42,7 @@ class AdditionalpropertiesShouldNotLookInApplicators( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi index 2c732a2d725..b429330b0b3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi @@ -42,6 +42,7 @@ class AdditionalpropertiesShouldNotLookInApplicators( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py index 05e2462f90d..ef06ea09fa7 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py @@ -44,6 +44,7 @@ class Allof( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class Allof( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi index 05e2462f90d..ef06ea09fa7 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi @@ -44,6 +44,7 @@ class Allof( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class Allof( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py index 17b6414d23c..60ddefa88a1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py @@ -36,6 +36,7 @@ class AllofWithBaseSchema( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -52,6 +53,7 @@ class AllofWithBaseSchema( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { @@ -107,6 +109,7 @@ class AllofWithBaseSchema( required = { "baz", } + class properties: baz = schemas.NoneSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi index 17b6414d23c..60ddefa88a1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi @@ -36,6 +36,7 @@ class AllofWithBaseSchema( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -52,6 +53,7 @@ class AllofWithBaseSchema( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { @@ -107,6 +109,7 @@ class AllofWithBaseSchema( required = { "baz", } + class properties: baz = schemas.NoneSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py index 232cbbd75e9..58bd52e2c14 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py @@ -44,6 +44,7 @@ class AnyofComplexTypes( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class AnyofComplexTypes( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi index 232cbbd75e9..58bd52e2c14 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi @@ -44,6 +44,7 @@ class AnyofComplexTypes( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class AnyofComplexTypes( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { 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 d8a9b2af88d..e53d26ced7c 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 @@ -36,6 +36,7 @@ class EnumsInProperties( required = { "bar", } + class properties: 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 d8a9b2af88d..e53d26ced7c 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 @@ -36,6 +36,7 @@ class EnumsInProperties( required = { "bar", } + class properties: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py index e618d6ac445..60bfa190347 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py @@ -33,6 +33,7 @@ class ForbiddenProperty( class MetaOapg: + class properties: foo = schemas.NotAnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi index e618d6ac445..60bfa190347 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi @@ -33,6 +33,7 @@ class ForbiddenProperty( class MetaOapg: + class properties: foo = schemas.NotAnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py index 1153af38eee..14d18346080 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py @@ -33,6 +33,7 @@ class InvalidStringValueForDefault( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi index b540640fd76..3da47e6ed10 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi @@ -33,6 +33,7 @@ class InvalidStringValueForDefault( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py index 75a6ab1f3b5..4d365a2ff96 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py @@ -41,6 +41,7 @@ class NotMoreComplexSchema( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi index 75a6ab1f3b5..4d365a2ff96 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi @@ -41,6 +41,7 @@ class NotMoreComplexSchema( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py index 3dad8cdb4fb..5ffd7ee6d38 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py @@ -33,6 +33,7 @@ class ObjectPropertiesValidation( class MetaOapg: + class properties: foo = schemas.IntSchema bar = schemas.StrSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi index 3dad8cdb4fb..5ffd7ee6d38 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi @@ -33,6 +33,7 @@ class ObjectPropertiesValidation( class MetaOapg: + class properties: foo = schemas.IntSchema bar = schemas.StrSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py index 90a815099f0..529ee03d28e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py @@ -44,6 +44,7 @@ class OneofComplexTypes( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class OneofComplexTypes( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi index 90a815099f0..529ee03d28e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi @@ -44,6 +44,7 @@ class OneofComplexTypes( required = { "bar", } + class properties: bar = schemas.IntSchema __annotations__ = { @@ -99,6 +100,7 @@ class OneofComplexTypes( required = { "foo", } + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py index 34e359fe0dd..b535b256e03 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py @@ -33,6 +33,7 @@ class PropertiesWithEscapedCharacters( class MetaOapg: + class properties: foo_nbar = schemas.NumberSchema foo_bar = schemas.NumberSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi index 34e359fe0dd..b535b256e03 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi @@ -33,6 +33,7 @@ class PropertiesWithEscapedCharacters( class MetaOapg: + class properties: foo_nbar = schemas.NumberSchema foo_bar = schemas.NumberSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py index 3149363ad5f..678e8df9115 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py @@ -33,6 +33,7 @@ class PropertyNamedRefThatIsNotAReference( class MetaOapg: + class properties: ref = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi index 3149363ad5f..678e8df9115 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi @@ -33,6 +33,7 @@ class PropertyNamedRefThatIsNotAReference( class MetaOapg: + class properties: ref = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.py index e61028535c4..4336f90122b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.py @@ -33,7 +33,7 @@ class RefInItems( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['PropertyNamedRefThatIsNotAReference']: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.pyi index e61028535c4..4336f90122b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_items.pyi @@ -33,7 +33,7 @@ class RefInItems( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['PropertyNamedRefThatIsNotAReference']: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py index 0058a91856a..3040ca95fd1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py @@ -33,6 +33,7 @@ class RefInProperty( class MetaOapg: + class properties: @classmethod diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi index 0058a91856a..3040ca95fd1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi @@ -33,6 +33,7 @@ class RefInProperty( class MetaOapg: + class properties: @classmethod diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py index 58745efdd2c..0da030d1e44 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py @@ -33,6 +33,7 @@ class RequiredDefaultValidation( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi index 58745efdd2c..0da030d1e44 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi @@ -33,6 +33,7 @@ class RequiredDefaultValidation( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py index 093dd9fa845..a61940a0fc8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py @@ -36,6 +36,7 @@ class RequiredValidation( required = { "foo", } + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi index 093dd9fa845..a61940a0fc8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi @@ -36,6 +36,7 @@ class RequiredValidation( required = { "foo", } + class properties: foo = schemas.AnyTypeSchema bar = schemas.AnyTypeSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py index 75ff2ba9604..a829b287ebf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py @@ -33,6 +33,7 @@ class RequiredWithEmptyArray( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi index 75ff2ba9604..a829b287ebf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi @@ -33,6 +33,7 @@ class RequiredWithEmptyArray( class MetaOapg: + class properties: foo = schemas.AnyTypeSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py index ee3c3a469c4..3d1202dab39 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py @@ -33,6 +33,7 @@ class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi index 10dd6f778a6..f4cbc0f77e9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi @@ -33,6 +33,7 @@ class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py index a4440d906f2..56cd3c9a3b6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py @@ -42,6 +42,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi index 2d426cf9d6b..302f24c636a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi @@ -40,6 +40,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py index 96bfe71c3e8..22f7b4cdc3d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py @@ -41,6 +41,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi index 6b62ea18069..e792097700f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi @@ -39,6 +39,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: + class properties: foo = schemas.StrSchema __annotations__ = { 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 dfb23d62e84..42f72945672 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 @@ -243,8 +243,60 @@ class Schema: the base class of all swagger/openapi schemas/models """ __inheritable_primitive_types_set = {decimal.Decimal, str, tuple, frozendict.frozendict, FileIO, bytes, BoolClass, NoneClass} + _types: typing.Set[typing.Type] MetaOapg = MetaOapgTyped + @staticmethod + def __get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed""" + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return "is {0}".format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + @classmethod + def __type_error_message( + cls, var_value=None, var_name=None, valid_classes=None, key_type=None + ): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a tuple + """ + key_or_value = "value" + if key_type: + key_or_value = "key" + valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) + msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + return msg + + @classmethod + def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): + error_msg = cls.__type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type, + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type, + ) + @classmethod def _validate_oapg( cls, @@ -253,21 +305,8 @@ class Schema: ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: """ Schema _validate_oapg - Runs all schema validation logic and - returns a dynamic class of different bases depending upon the input - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Use cases: - 1. inheritable type: string/decimal.Decimal/frozendict.frozendict/tuple - 2. singletons: bool/None -> uses the base classes BoolClass/NoneClass - - Required Steps: - 1. verify type of input is valid vs the allowed _types - 2. check validations that are applicable for this type of input - 3. if enums exist, check that the value exists in the enum + All keyword validation except for type checking was done in calling stack frames + If those validations passed, the validated classes are collected in path_to_schemas Returns: path_to_schemas: a map of path to schemas @@ -277,6 +316,14 @@ class Schema: ApiTypeError: when the input type is not in the list of allowed spec types """ base_class = type(arg) + if base_class not in cls._types: + raise cls.__get_type_error( + arg, + validation_metadata.path_to_item, + cls._types, + key_type=False, + ) + path_to_schemas = {validation_metadata.path_to_item: set()} path_to_schemas[validation_metadata.path_to_item].add(cls) path_to_schemas[validation_metadata.path_to_item].add(base_class) @@ -515,6 +562,8 @@ if typing.TYPE_CHECKING: StrMixin = str DecimalMixin = decimal.Decimal BoolMixin = BoolClass + BytesMixin = bytes + FileMixin = FileIO # qty 2 class BinaryMixin(bytes, FileIO): pass @@ -636,77 +685,151 @@ if typing.TYPE_CHECKING: # qty 6 class NoneFrozenDictTupleStrDecimalBoolMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass): pass + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes): + pass else: # qty 1 - NoneMixin = object - FrozenDictMixin = object - TupleMixin = object - StrMixin = object - DecimalMixin = object - BoolMixin = object + class NoneMixin: + _types = {NoneClass} + class FrozenDictMixin: + _types = {frozendict.frozendict} + class TupleMixin: + _types = {tuple} + class StrMixin: + _types = {str} + class DecimalMixin: + _types = {decimal.Decimal} + class BoolMixin: + _types = {BoolClass} + class BytesMixin: + _types = {bytes} + class FileMixin: + _types = {FileIO} # qty 2 - BinaryMixin = object - NoneFrozenDictMixin = object - NoneTupleMixin = object - NoneStrMixin = object - NoneDecimalMixin = object - NoneBoolMixin = object - FrozenDictTupleMixin = object - FrozenDictStrMixin = object - FrozenDictDecimalMixin = object - FrozenDictBoolMixin = object - TupleStrMixin = object - TupleDecimalMixin = object - TupleBoolMixin = object - StrDecimalMixin = object - StrBoolMixin = object - DecimalBoolMixin = object + class BinaryMixin: + _types = {bytes, FileIO} + class NoneFrozenDictMixin: + _types = {NoneClass, frozendict.frozendict} + class NoneTupleMixin: + _types = {NoneClass, tuple} + class NoneStrMixin: + _types = {NoneClass, str} + class NoneDecimalMixin: + _types = {NoneClass, decimal.Decimal} + class NoneBoolMixin: + _types = {NoneClass, BoolClass} + class FrozenDictTupleMixin: + _types = {frozendict.frozendict, tuple} + class FrozenDictStrMixin: + _types = {frozendict.frozendict, str} + class FrozenDictDecimalMixin: + _types = {frozendict.frozendict, decimal.Decimal} + class FrozenDictBoolMixin: + _types = {frozendict.frozendict, BoolClass} + class TupleStrMixin: + _types = {tuple, str} + class TupleDecimalMixin: + _types = {tuple, decimal.Decimal} + class TupleBoolMixin: + _types = {tuple, BoolClass} + class StrDecimalMixin: + _types = {str, decimal.Decimal} + class StrBoolMixin: + _types = {str, BoolClass} + class DecimalBoolMixin: + _types = {decimal.Decimal, BoolClass} # qty 3 - NoneFrozenDictTupleMixin = object - NoneFrozenDictStrMixin = object - NoneFrozenDictDecimalMixin = object - NoneFrozenDictBoolMixin = object - NoneTupleStrMixin = object - NoneTupleDecimalMixin = object - NoneTupleBoolMixin = object - NoneStrDecimalMixin = object - NoneStrBoolMixin = object - NoneDecimalBoolMixin = object - FrozenDictTupleStrMixin = object - FrozenDictTupleDecimalMixin = object - FrozenDictTupleBoolMixin = object - FrozenDictStrDecimalMixin = object - FrozenDictStrBoolMixin = object - FrozenDictDecimalBoolMixin = object - TupleStrDecimalMixin = object - TupleStrBoolMixin = object - TupleDecimalBoolMixin = object - StrDecimalBoolMixin = object + class NoneFrozenDictTupleMixin: + _types = {NoneClass, frozendict.frozendict, tuple} + class NoneFrozenDictStrMixin: + _types = {NoneClass, frozendict.frozendict, str} + class NoneFrozenDictDecimalMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal} + class NoneFrozenDictBoolMixin: + _types = {NoneClass, frozendict.frozendict, BoolClass} + class NoneTupleStrMixin: + _types = {NoneClass, tuple, str} + class NoneTupleDecimalMixin: + _types = {NoneClass, tuple, decimal.Decimal} + class NoneTupleBoolMixin: + _types = {NoneClass, tuple, BoolClass} + class NoneStrDecimalMixin: + _types = {NoneClass, str, decimal.Decimal} + class NoneStrBoolMixin: + _types = {NoneClass, str, BoolClass} + class NoneDecimalBoolMixin: + _types = {NoneClass, decimal.Decimal, BoolClass} + class FrozenDictTupleStrMixin: + _types = {frozendict.frozendict, tuple, str} + class FrozenDictTupleDecimalMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal} + class FrozenDictTupleBoolMixin: + _types = {frozendict.frozendict, tuple, BoolClass} + class FrozenDictStrDecimalMixin: + _types = {frozendict.frozendict, str, decimal.Decimal} + class FrozenDictStrBoolMixin: + _types = {frozendict.frozendict, str, BoolClass} + class FrozenDictDecimalBoolMixin: + _types = {frozendict.frozendict, decimal.Decimal, BoolClass} + class TupleStrDecimalMixin: + _types = {tuple, str, decimal.Decimal} + class TupleStrBoolMixin: + _types = {tuple, str, BoolClass} + class TupleDecimalBoolMixin: + _types = {tuple, decimal.Decimal, BoolClass} + class StrDecimalBoolMixin: + _types = {str, decimal.Decimal, BoolClass} # qty 4 - NoneFrozenDictTupleStrMixin = object - NoneFrozenDictTupleDecimalMixin = object - NoneFrozenDictTupleBoolMixin = object - NoneFrozenDictStrDecimalMixin = object - NoneFrozenDictStrBoolMixin = object - NoneFrozenDictDecimalBoolMixin = object - NoneTupleStrDecimalMixin = object - NoneTupleStrBoolMixin = object - NoneTupleDecimalBoolMixin = object - NoneStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalMixin = object - FrozenDictTupleStrBoolMixin = object - FrozenDictTupleDecimalBoolMixin = object - FrozenDictStrDecimalBoolMixin = object - TupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str} + class NoneFrozenDictTupleDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal} + class NoneFrozenDictTupleBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, BoolClass} + class NoneFrozenDictStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal} + class NoneFrozenDictStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, BoolClass} + class NoneFrozenDictDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalMixin: + _types = {NoneClass, tuple, str, decimal.Decimal} + class NoneTupleStrBoolMixin: + _types = {NoneClass, tuple, str, BoolClass} + class NoneTupleDecimalBoolMixin: + _types = {NoneClass, tuple, decimal.Decimal, BoolClass} + class NoneStrDecimalBoolMixin: + _types = {NoneClass, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal} + class FrozenDictTupleStrBoolMixin: + _types = {frozendict.frozendict, tuple, str, BoolClass} + class FrozenDictTupleDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class FrozenDictStrDecimalBoolMixin: + _types = {frozendict.frozendict, str, decimal.Decimal, BoolClass} + class TupleStrDecimalBoolMixin: + _types = {tuple, str, decimal.Decimal, BoolClass} # qty 5 - NoneFrozenDictTupleStrDecimalMixin = object - NoneFrozenDictTupleStrBoolMixin = object - NoneFrozenDictTupleDecimalBoolMixin = object - NoneFrozenDictStrDecimalBoolMixin = object - NoneTupleStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal} + class NoneFrozenDictTupleStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, BoolClass} + class NoneFrozenDictTupleDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class NoneFrozenDictStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalBoolMixin: + _types = {NoneClass, tuple, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} # qty 6 - NoneFrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes} class ValidatorBase: @@ -750,92 +873,6 @@ class Validator(typing.Protocol): pass -def SchemaTypeCheckerClsFactory(union_type_cls: typing.Any) -> Validator: - if typing.get_origin(union_type_cls) is typing.Union: - union_classes = typing.get_args(union_type_cls) - else: - # note: when a union of a single class is passed in, the union disappears - union_classes = tuple([union_type_cls]) - """ - I want the type hint... union_type_cls - and to use it as a base class but when I do, I get - TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - """ - class SchemaTypeChecker: - @staticmethod - def __get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed""" - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return "is {0}".format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - @classmethod - def __type_error_message( - cls, var_value=None, var_name=None, valid_classes=None, key_type=None - ): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a tuple - """ - key_or_value = "value" - if key_type: - key_or_value = "key" - valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) - msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - return msg - - @classmethod - def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): - error_msg = cls.__type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type, - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type, - ) - - @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]]]: - """ - SchemaTypeChecker _validate_oapg - Validates arg's type - """ - arg_type = type(arg) - if arg_type in union_classes: - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - raise cls.__get_type_error( - arg, - validation_metadata.path_to_item, - union_classes, - key_type=False, - ) - - return SchemaTypeChecker - - class EnumMakerBase: pass @@ -1996,7 +2033,6 @@ class ComposedBase(Discriminable): # DictBase, ListBase, NumberBase, StrBase, BoolBase, NoneBase class ComposedSchema( - SchemaTypeCheckerClsFactory(typing.Union[NoneClass, str, decimal.Decimal, BoolClass, tuple, frozendict.frozendict]), ComposedBase, DictBase, ListBase, @@ -2017,7 +2053,6 @@ class ComposedSchema( class ListSchema( - SchemaTypeCheckerClsFactory(tuple), ListBase, Schema, TupleMixin @@ -2032,7 +2067,6 @@ class ListSchema( class NoneSchema( - SchemaTypeCheckerClsFactory(NoneClass), NoneBase, Schema, NoneMixin @@ -2047,7 +2081,6 @@ class NoneSchema( class NumberSchema( - SchemaTypeCheckerClsFactory(decimal.Decimal), NumberBase, Schema, DecimalMixin @@ -2243,7 +2276,6 @@ class Float64Schema( class StrSchema( - SchemaTypeCheckerClsFactory(str), StrBase, Schema, StrMixin @@ -2296,8 +2328,8 @@ class DecimalSchema(DecimalBase, StrSchema): class BytesSchema( - SchemaTypeCheckerClsFactory(bytes), Schema, + BytesMixin ): """ this class will subclass bytes and is immutable @@ -2307,8 +2339,8 @@ class BytesSchema( class FileSchema( - SchemaTypeCheckerClsFactory(FileIO), Schema, + FileMixin ): """ This class is NOT immutable @@ -2336,7 +2368,6 @@ class BinaryBase: class BinarySchema( - SchemaTypeCheckerClsFactory(typing.Union[bytes, FileIO]), ComposedBase, BinaryBase, Schema, @@ -2353,7 +2384,6 @@ class BinarySchema( class BoolSchema( - SchemaTypeCheckerClsFactory(BoolClass), BoolBase, Schema, BoolMixin @@ -2368,9 +2398,6 @@ class BoolSchema( class AnyTypeSchema( - SchemaTypeCheckerClsFactory( - typing.Union[frozendict.frozendict, tuple, decimal.Decimal, str, BoolClass, NoneClass, bytes, FileIO] - ), DictBase, ListBase, NumberBase, @@ -2378,7 +2405,7 @@ class AnyTypeSchema( BoolBase, NoneBase, Schema, - NoneFrozenDictTupleStrDecimalBoolMixin + NoneFrozenDictTupleStrDecimalBoolFileBytesMixin ): # Python representation of a schema defined as true or {} pass @@ -2414,7 +2441,6 @@ class NotAnyTypeSchema( class DictSchema( - SchemaTypeCheckerClsFactory(frozendict.frozendict), DictBase, Schema, FrozenDictMixin diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py index ca186d71f3a..828b4d14beb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py @@ -33,6 +33,7 @@ class AdditionalPropertiesClass( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi index ca186d71f3a..828b4d14beb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi @@ -33,6 +33,7 @@ class AdditionalPropertiesClass( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py index 5eeb899dd37..ded03383223 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py @@ -41,7 +41,7 @@ class AdditionalPropertiesWithArrayOfEnums( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['EnumClass']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi index 5eeb899dd37..ded03383223 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi @@ -41,7 +41,7 @@ class AdditionalPropertiesWithArrayOfEnums( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['EnumClass']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py index a1857838d73..54684b754cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py @@ -46,6 +46,7 @@ class Animal( 'Dog': Dog, } } + class properties: className = schemas.StrSchema color = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi index a1857838d73..54684b754cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi @@ -46,6 +46,7 @@ class Animal( 'Dog': Dog, } } + class properties: className = schemas.StrSchema color = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.py index ca24b7233e6..32ba10fdab3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.py @@ -33,7 +33,7 @@ class AnimalFarm( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Animal']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.pyi index ca24b7233e6..32ba10fdab3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal_farm.pyi @@ -33,7 +33,7 @@ class AnimalFarm( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Animal']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.py index da639f1cc38..27f4c78af2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.py @@ -33,6 +33,7 @@ class AnyTypeAndFormat( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.pyi index da639f1cc38..27f4c78af2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_and_format.pyi @@ -33,6 +33,7 @@ class AnyTypeAndFormat( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py index 984f9bad474..3377076f6fd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py @@ -33,6 +33,7 @@ class ApiResponse( class MetaOapg: + class properties: code = schemas.Int32Schema type = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi index 984f9bad474..3377076f6fd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi @@ -33,6 +33,7 @@ class ApiResponse( class MetaOapg: + class properties: code = schemas.Int32Schema type = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py index 3742c207f68..648bd127aec 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class Apple( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -40,6 +39,7 @@ class Apple( required = { "cultivar", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi index 771606f8ba3..497e50744ee 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class Apple( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -40,6 +39,7 @@ class Apple( required = { "cultivar", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py index 7e6b8bc8a12..d5e04fef1e4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py @@ -36,6 +36,7 @@ class AppleReq( required = { "cultivar", } + class properties: cultivar = schemas.StrSchema mealy = schemas.BoolSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi index 7e6b8bc8a12..d5e04fef1e4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi @@ -36,6 +36,7 @@ class AppleReq( required = { "cultivar", } + class properties: cultivar = schemas.StrSchema mealy = schemas.BoolSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py index c9b55552d82..2a29ef22abd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py @@ -33,6 +33,7 @@ class ArrayOfArrayOfNumberOnly( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi index c9b55552d82..2a29ef22abd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi @@ -33,6 +33,7 @@ class ArrayOfArrayOfNumberOnly( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.py index c6bbdd1c090..c1bef141be5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.py @@ -33,7 +33,7 @@ class ArrayOfEnums( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['StringEnum']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.pyi index c6bbdd1c090..c1bef141be5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_enums.pyi @@ -33,7 +33,7 @@ class ArrayOfEnums( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['StringEnum']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py index b0cd59e9d97..79a6eb0e74c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py @@ -33,6 +33,7 @@ class ArrayOfNumberOnly( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi index b0cd59e9d97..79a6eb0e74c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi @@ -33,6 +33,7 @@ class ArrayOfNumberOnly( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py index 89e23ceff2b..e3a3e997bfd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -33,6 +33,7 @@ class ArrayTest( class MetaOapg: + class properties: @@ -118,7 +119,7 @@ class ArrayTest( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['ReadOnlyFirst']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi index 89e23ceff2b..e3a3e997bfd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi @@ -33,6 +33,7 @@ class ArrayTest( class MetaOapg: + class properties: @@ -118,7 +119,7 @@ class ArrayTest( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['ReadOnlyFirst']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py index 859569eece7..87ae6a8c08a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py @@ -36,6 +36,7 @@ class Banana( required = { "lengthCm", } + class properties: lengthCm = schemas.NumberSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi index 859569eece7..87ae6a8c08a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi @@ -36,6 +36,7 @@ class Banana( required = { "lengthCm", } + class properties: lengthCm = schemas.NumberSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py index 14b8a0d8e08..48fde4d4941 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py @@ -36,6 +36,7 @@ class BananaReq( required = { "lengthCm", } + class properties: lengthCm = schemas.NumberSchema sweet = schemas.BoolSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi index 14b8a0d8e08..48fde4d4941 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi @@ -36,6 +36,7 @@ class BananaReq( required = { "lengthCm", } + class properties: lengthCm = schemas.NumberSchema sweet = schemas.BoolSchema 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 85fbeb04df1..ea00a644d5c 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 @@ -36,6 +36,7 @@ class BasquePig( required = { "className", } + class properties: 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 85fbeb04df1..ea00a644d5c 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 @@ -36,6 +36,7 @@ class BasquePig( required = { "className", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py index aa5e2603648..830138af4a1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py @@ -33,6 +33,7 @@ class Capitalization( class MetaOapg: + class properties: smallCamel = schemas.StrSchema CapitalCamel = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi index aa5e2603648..830138af4a1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi @@ -33,6 +33,7 @@ class Capitalization( class MetaOapg: + class properties: smallCamel = schemas.StrSchema CapitalCamel = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py index 1b190ab5610..73065d68f2f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py @@ -41,6 +41,7 @@ class Cat( class MetaOapg: + class properties: declawed = schemas.BoolSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi index 1b190ab5610..73065d68f2f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi @@ -41,6 +41,7 @@ class Cat( class MetaOapg: + class properties: declawed = schemas.BoolSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py index 8f6f8a01055..237f5a3c60b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py @@ -36,6 +36,7 @@ class Category( required = { "name", } + class properties: name = schemas.StrSchema id = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi index 8f6f8a01055..237f5a3c60b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi @@ -36,6 +36,7 @@ class Category( required = { "name", } + class properties: name = schemas.StrSchema id = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py index 1461c4ed61c..d27651c3a81 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -41,6 +41,7 @@ class ChildCat( class MetaOapg: + class properties: name = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi index 1461c4ed61c..d27651c3a81 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi @@ -41,6 +41,7 @@ class ChildCat( class MetaOapg: + class properties: name = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py index 5376be093c1..79faf908927 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py @@ -35,6 +35,7 @@ class ClassModel( class MetaOapg: + class properties: _class = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi index 5376be093c1..79faf908927 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi @@ -35,6 +35,7 @@ class ClassModel( class MetaOapg: + class properties: _class = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py index 2b610d4c3ad..19584b4c5bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py @@ -33,6 +33,7 @@ class Client( class MetaOapg: + class properties: client = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi index 2b610d4c3ad..19584b4c5bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi @@ -33,6 +33,7 @@ class Client( class MetaOapg: + class properties: client = schemas.StrSchema __annotations__ = { 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 91f5f08cd8d..c8180bddfe8 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 @@ -41,6 +41,7 @@ class ComplexQuadrilateral( class MetaOapg: + class properties: 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 91f5f08cd8d..c8180bddfe8 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 @@ -41,6 +41,7 @@ class ComplexQuadrilateral( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi index 64061e80cb7..ba4d07ecdeb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi @@ -43,9 +43,6 @@ class ComposedOneOfDifferentTypes( schemas.DictSchema ): - - class MetaOapg: - def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], 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 d2c6c4f2256..a377ff111a7 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 @@ -36,6 +36,7 @@ class DanishPig( required = { "className", } + class properties: 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 d2c6c4f2256..a377ff111a7 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 @@ -36,6 +36,7 @@ class DanishPig( required = { "className", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py index 376ccfb547e..37eeee0545c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py @@ -41,6 +41,7 @@ class Dog( class MetaOapg: + class properties: breed = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi index 376ccfb547e..37eeee0545c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi @@ -41,6 +41,7 @@ class Dog( class MetaOapg: + class properties: breed = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py index aa2c340b06a..4224baeef88 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py @@ -33,6 +33,7 @@ class Drawing( class MetaOapg: + class properties: @classmethod @@ -57,7 +58,7 @@ class Drawing( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Shape']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi index aa2c340b06a..4224baeef88 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi @@ -33,6 +33,7 @@ class Drawing( class MetaOapg: + class properties: @classmethod @@ -57,7 +58,7 @@ class Drawing( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Shape']: 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 a5fccf79871..c5e7418ea56 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 @@ -33,6 +33,7 @@ class EnumArrays( class MetaOapg: + class properties: 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 a5fccf79871..c5e7418ea56 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 @@ -33,6 +33,7 @@ class EnumArrays( class MetaOapg: + class properties: 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 85b57140ad8..154e0af15e2 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 @@ -36,6 +36,7 @@ class EnumTest( required = { "enum_string_required", } + class properties: 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 85b57140ad8..154e0af15e2 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 @@ -36,6 +36,7 @@ class EnumTest( required = { "enum_string_required", } + class properties: 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 df3897bf06c..84a6b847a9b 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 @@ -41,6 +41,7 @@ class EquilateralTriangle( class MetaOapg: + class properties: 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 df3897bf06c..84a6b847a9b 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 @@ -41,6 +41,7 @@ class EquilateralTriangle( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py index 94a9b394f3c..0e227719815 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py @@ -35,6 +35,7 @@ class File( class MetaOapg: + class properties: sourceURI = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi index 94a9b394f3c..0e227719815 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi @@ -35,6 +35,7 @@ class File( class MetaOapg: + class properties: sourceURI = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 1dfed220ac1..88b6bac002e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -33,6 +33,7 @@ class FileSchemaTestClass( class MetaOapg: + class properties: @classmethod @@ -47,7 +48,7 @@ class FileSchemaTestClass( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['File']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi index 1dfed220ac1..88b6bac002e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi @@ -33,6 +33,7 @@ class FileSchemaTestClass( class MetaOapg: + class properties: @classmethod @@ -47,7 +48,7 @@ class FileSchemaTestClass( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['File']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py index 9e712339db9..ffbe1dea830 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py @@ -33,6 +33,7 @@ class Foo( class MetaOapg: + class properties: bar = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi index 9e712339db9..ffbe1dea830 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi @@ -33,6 +33,7 @@ class Foo( class MetaOapg: + class properties: bar = schemas.StrSchema __annotations__ = { 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 6ac3fd370a8..10d70cacab5 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 @@ -39,6 +39,7 @@ class FormatTest( "password", "byte", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi index 88078622031..3c748990c77 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi @@ -39,6 +39,7 @@ class FormatTest( "password", "byte", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py index 4101b811486..b8c99842fa6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py @@ -33,6 +33,7 @@ class Fruit( class MetaOapg: + class properties: color = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi index 4101b811486..b8c99842fa6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi @@ -33,6 +33,7 @@ class Fruit( class MetaOapg: + class properties: color = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py index 218b7661524..ba5fc7adfe6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py @@ -33,6 +33,7 @@ class GmFruit( class MetaOapg: + class properties: color = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi index 218b7661524..ba5fc7adfe6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi @@ -33,6 +33,7 @@ class GmFruit( class MetaOapg: + class properties: color = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index 3fe29c75f11..cb55a7f0de2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -46,6 +46,7 @@ class GrandparentAnimal( 'ParentPet': ParentPet, } } + class properties: pet_type = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi index 3fe29c75f11..cb55a7f0de2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi @@ -46,6 +46,7 @@ class GrandparentAnimal( 'ParentPet': ParentPet, } } + class properties: pet_type = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py index 8eb5667104e..9307f505f3d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py @@ -33,6 +33,7 @@ class HasOnlyReadOnly( class MetaOapg: + class properties: bar = schemas.StrSchema foo = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi index 8eb5667104e..9307f505f3d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi @@ -33,6 +33,7 @@ class HasOnlyReadOnly( class MetaOapg: + class properties: bar = schemas.StrSchema foo = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py index cfe2ecd5e0c..1b21b55a65a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py @@ -35,11 +35,11 @@ class HealthCheckResult( class MetaOapg: + class properties: class NullableMessage( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi index cfe2ecd5e0c..1b21b55a65a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi @@ -35,11 +35,11 @@ class HealthCheckResult( class MetaOapg: + class properties: class NullableMessage( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, 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 d9996ddb37d..3f176c2c961 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 @@ -41,6 +41,7 @@ class IsoscelesTriangle( class MetaOapg: + class properties: 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 d9996ddb37d..3f176c2c961 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 @@ -41,6 +41,7 @@ class IsoscelesTriangle( class MetaOapg: + class properties: 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 880a7854810..bb7bc4a74bb 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 @@ -38,6 +38,7 @@ class JSONPatchRequestAddReplaceTest( "path", "value", } + class properties: path = schemas.StrSchema value = schemas.AnyTypeSchema 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 880a7854810..bb7bc4a74bb 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 @@ -38,6 +38,7 @@ class JSONPatchRequestAddReplaceTest( "path", "value", } + class properties: path = schemas.StrSchema value = schemas.AnyTypeSchema 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 cd3a4bd1406..8ad5a648b3c 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 @@ -38,6 +38,7 @@ class JSONPatchRequestMoveCopy( "path", "from", } + class properties: path = schemas.StrSchema 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 cd3a4bd1406..8ad5a648b3c 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 @@ -38,6 +38,7 @@ class JSONPatchRequestMoveCopy( "path", "from", } + class properties: path = 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 066b1284db5..9ab2b78ae15 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 @@ -37,6 +37,7 @@ class JSONPatchRequestRemove( "op", "path", } + class properties: path = schemas.StrSchema 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 066b1284db5..9ab2b78ae15 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 @@ -37,6 +37,7 @@ class JSONPatchRequestRemove( "op", "path", } + class properties: path = 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 05afd9361b8..140faaa42f2 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 @@ -33,6 +33,7 @@ class MapTest( class MetaOapg: + class properties: 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 05afd9361b8..140faaa42f2 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 @@ -33,6 +33,7 @@ class MapTest( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index 4e978e0dbd6..e5bea736b37 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -33,6 +33,7 @@ class MixedPropertiesAndAdditionalPropertiesClass( class MetaOapg: + class properties: uuid = schemas.UUIDSchema dateTime = schemas.DateTimeSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi index 4e978e0dbd6..e5bea736b37 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi @@ -33,6 +33,7 @@ class MixedPropertiesAndAdditionalPropertiesClass( class MetaOapg: + class properties: uuid = schemas.UUIDSchema dateTime = schemas.DateTimeSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py index c548c5116f7..3704f600734 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py @@ -35,6 +35,7 @@ class Model200Response( class MetaOapg: + class properties: name = schemas.Int32Schema _class = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi index c548c5116f7..3704f600734 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi @@ -35,6 +35,7 @@ class Model200Response( class MetaOapg: + class properties: name = schemas.Int32Schema _class = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py index 35b48b80ff8..72515e5b777 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py @@ -35,6 +35,7 @@ class ModelReturn( class MetaOapg: + class properties: _return = schemas.Int32Schema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi index 35b48b80ff8..72515e5b777 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi @@ -35,6 +35,7 @@ class ModelReturn( class MetaOapg: + class properties: _return = schemas.Int32Schema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py index 484fe30ba36..d17a419c70d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py @@ -37,6 +37,7 @@ class Money( "amount", "currency", } + class properties: amount = schemas.DecimalSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi index 484fe30ba36..d17a419c70d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi @@ -37,6 +37,7 @@ class Money( "amount", "currency", } + class properties: amount = schemas.DecimalSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py index c16194ea1c2..ad63c7f4bad 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py @@ -38,6 +38,7 @@ class Name( required = { "name", } + class properties: name = schemas.Int32Schema snake_case = schemas.Int32Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi index c16194ea1c2..ad63c7f4bad 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi @@ -38,6 +38,7 @@ class Name( required = { "name", } + class properties: name = schemas.Int32Schema snake_case = schemas.Int32Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py index 2e4b670d702..b91e8230739 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py @@ -36,6 +36,7 @@ class NoAdditionalProperties( required = { "id", } + class properties: id = schemas.Int64Schema petId = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi index 2e4b670d702..b91e8230739 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi @@ -36,6 +36,7 @@ class NoAdditionalProperties( required = { "id", } + class properties: id = schemas.Int64Schema petId = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py index f9c1b5a16d9..bc88a27883e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py @@ -33,11 +33,11 @@ class NullableClass( class MetaOapg: + class properties: class integer_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, decimal.Decimal, ]), schemas.IntBase, schemas.NoneBase, schemas.Schema, @@ -58,7 +58,6 @@ class NullableClass( class number_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, decimal.Decimal, ]), schemas.NumberBase, schemas.NoneBase, schemas.Schema, @@ -79,7 +78,6 @@ class NullableClass( class boolean_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, schemas.BoolClass, ]), schemas.BoolBase, schemas.NoneBase, schemas.Schema, @@ -100,7 +98,6 @@ class NullableClass( class string_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, @@ -121,7 +118,6 @@ class NullableClass( class date_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.DateBase, schemas.StrBase, schemas.NoneBase, @@ -147,7 +143,6 @@ class NullableClass( class datetime_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.DateTimeBase, schemas.StrBase, schemas.NoneBase, @@ -173,7 +168,6 @@ class NullableClass( class array_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, tuple, ]), schemas.ListBase, schemas.NoneBase, schemas.Schema, @@ -198,7 +192,6 @@ class NullableClass( class array_and_items_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, tuple, ]), schemas.ListBase, schemas.NoneBase, schemas.Schema, @@ -210,7 +203,6 @@ class NullableClass( class items( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -253,7 +245,6 @@ class NullableClass( class items( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -290,7 +281,6 @@ class NullableClass( class object_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -324,7 +314,6 @@ class NullableClass( class object_and_items_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -336,7 +325,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -388,7 +376,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -445,7 +432,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi index f9c1b5a16d9..bc88a27883e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi @@ -33,11 +33,11 @@ class NullableClass( class MetaOapg: + class properties: class integer_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, decimal.Decimal, ]), schemas.IntBase, schemas.NoneBase, schemas.Schema, @@ -58,7 +58,6 @@ class NullableClass( class number_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, decimal.Decimal, ]), schemas.NumberBase, schemas.NoneBase, schemas.Schema, @@ -79,7 +78,6 @@ class NullableClass( class boolean_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, schemas.BoolClass, ]), schemas.BoolBase, schemas.NoneBase, schemas.Schema, @@ -100,7 +98,6 @@ class NullableClass( class string_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, @@ -121,7 +118,6 @@ class NullableClass( class date_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.DateBase, schemas.StrBase, schemas.NoneBase, @@ -147,7 +143,6 @@ class NullableClass( class datetime_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.DateTimeBase, schemas.StrBase, schemas.NoneBase, @@ -173,7 +168,6 @@ class NullableClass( class array_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, tuple, ]), schemas.ListBase, schemas.NoneBase, schemas.Schema, @@ -198,7 +192,6 @@ class NullableClass( class array_and_items_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, tuple, ]), schemas.ListBase, schemas.NoneBase, schemas.Schema, @@ -210,7 +203,6 @@ class NullableClass( class items( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -253,7 +245,6 @@ class NullableClass( class items( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -290,7 +281,6 @@ class NullableClass( class object_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -324,7 +314,6 @@ class NullableClass( class object_and_items_nullable_prop( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -336,7 +325,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -388,7 +376,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, @@ -445,7 +432,6 @@ class NullableClass( class additional_properties( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.py index 11e7142f3a8..3823a869e7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.py @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class NullableString( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.pyi index 11e7142f3a8..3823a869e7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_string.pyi @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class NullableString( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.StrBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py index a945ef7b5c8..819c65f8f7a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py @@ -33,6 +33,7 @@ class NumberOnly( class MetaOapg: + class properties: JustNumber = schemas.NumberSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi index a945ef7b5c8..819c65f8f7a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi @@ -33,6 +33,7 @@ class NumberOnly( class MetaOapg: + class properties: JustNumber = schemas.NumberSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py index ead27a3ce01..5f1131e8eb6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py @@ -35,6 +35,7 @@ class ObjectModelWithRefProps( class MetaOapg: + class properties: @classmethod diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi index ead27a3ce01..5f1131e8eb6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi @@ -35,6 +35,7 @@ class ObjectModelWithRefProps( class MetaOapg: + class properties: @classmethod diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py index c9cbcf70076..31b628c87ea 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py @@ -33,6 +33,7 @@ class ObjectWithDecimalProperties( class MetaOapg: + class properties: length = schemas.DecimalSchema width = schemas.DecimalSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi index c9cbcf70076..31b628c87ea 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi @@ -33,6 +33,7 @@ class ObjectWithDecimalProperties( class MetaOapg: + class properties: length = schemas.DecimalSchema width = schemas.DecimalSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py index db568c0423c..12523ceafe5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py @@ -38,6 +38,7 @@ class ObjectWithDifficultlyNamedProps( required = { "123-list", } + class properties: _123_list = schemas.StrSchema special_property_name = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi index db568c0423c..12523ceafe5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi @@ -38,6 +38,7 @@ class ObjectWithDifficultlyNamedProps( required = { "123-list", } + class properties: _123_list = schemas.StrSchema special_property_name = schemas.Int64Schema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py index 480f1e19420..26b580767c3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py @@ -33,6 +33,7 @@ class ObjectWithInlineCompositionProperty( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi index 5538fbb15fa..69292d8b433 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi @@ -33,6 +33,7 @@ class ObjectWithInlineCompositionProperty( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi index c393cea4bbb..a0a059188e8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi @@ -31,9 +31,6 @@ class ObjectWithValidations( Do not edit the class manually. """ - - class MetaOapg: - def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], 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 2aaabab1d46..e6ebd27e891 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 @@ -33,6 +33,7 @@ class Order( class MetaOapg: + class properties: id = schemas.Int64Schema petId = schemas.Int64Schema 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 2aaabab1d46..e6ebd27e891 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 @@ -33,6 +33,7 @@ class Order( class MetaOapg: + class properties: id = schemas.Int64Schema petId = schemas.Int64Schema 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 5c5ce500ffb..b54347039f7 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 @@ -39,6 +39,7 @@ class Pet( "photoUrls", "name", } + class properties: name = schemas.StrSchema @@ -78,7 +79,7 @@ class Pet( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Tag']: 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 5c5ce500ffb..b54347039f7 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 @@ -39,6 +39,7 @@ class Pet( "photoUrls", "name", } + class properties: name = schemas.StrSchema @@ -78,7 +79,7 @@ class Pet( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Tag']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py index a0d8057ba1b..15ae3178b94 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py @@ -35,6 +35,7 @@ class Player( class MetaOapg: + class properties: name = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi index a0d8057ba1b..15ae3178b94 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi @@ -35,6 +35,7 @@ class Player( class MetaOapg: + class properties: name = 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 05fca98eabd..26e260d8181 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 @@ -37,6 +37,7 @@ class QuadrilateralInterface( "shapeType", "quadrilateralType", } + class properties: 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 05fca98eabd..26e260d8181 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 @@ -37,6 +37,7 @@ class QuadrilateralInterface( "shapeType", "quadrilateralType", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py index 260a4ebab24..1fe928ef01a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py @@ -33,6 +33,7 @@ class ReadOnlyFirst( class MetaOapg: + class properties: bar = schemas.StrSchema baz = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi index 260a4ebab24..1fe928ef01a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi @@ -33,6 +33,7 @@ class ReadOnlyFirst( class MetaOapg: + class properties: bar = schemas.StrSchema baz = 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 88030c080ef..6f7e3f7fba9 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 @@ -41,6 +41,7 @@ class ScaleneTriangle( class MetaOapg: + class properties: 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 88030c080ef..6f7e3f7fba9 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 @@ -41,6 +41,7 @@ class ScaleneTriangle( class MetaOapg: + class properties: 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 26fe63146b2..9fe6af737e3 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 @@ -41,6 +41,7 @@ class SimpleQuadrilateral( class MetaOapg: + class properties: 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 26fe63146b2..9fe6af737e3 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 @@ -41,6 +41,7 @@ class SimpleQuadrilateral( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py index a4e25649bc1..824466a0f84 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py @@ -35,6 +35,7 @@ class SpecialModelName( class MetaOapg: + class properties: a = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi index a4e25649bc1..824466a0f84 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi @@ -35,6 +35,7 @@ class SpecialModelName( class MetaOapg: + class properties: a = schemas.StrSchema __annotations__ = { 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 79e97f99ecf..2667afb8f87 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 @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class StringEnum( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.SchemaEnumMakerClsFactory( enum_value_to_name={ schemas.NoneClass.NONE: "NONE", 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 79e97f99ecf..2667afb8f87 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 @@ -23,7 +23,6 @@ from petstore_api import schemas # noqa: F401 class StringEnum( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, str, ]), schemas.SchemaEnumMakerClsFactory( enum_value_to_name={ schemas.NoneClass.NONE: "NONE", diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py index a3d97f46eb5..508e8377740 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py @@ -33,6 +33,7 @@ class Tag( class MetaOapg: + class properties: id = schemas.Int64Schema name = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi index a3d97f46eb5..508e8377740 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi @@ -33,6 +33,7 @@ class Tag( class MetaOapg: + class properties: id = schemas.Int64Schema name = schemas.StrSchema 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 6b6dd717947..b91e26f79ad 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 @@ -37,6 +37,7 @@ class TriangleInterface( "shapeType", "triangleType", } + class properties: 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 6b6dd717947..b91e26f79ad 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 @@ -37,6 +37,7 @@ class TriangleInterface( "shapeType", "triangleType", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py index 69381e19e73..4c35fda5b33 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py @@ -33,6 +33,7 @@ class User( class MetaOapg: + class properties: id = schemas.Int64Schema username = schemas.StrSchema @@ -46,7 +47,6 @@ class User( class objectWithNoDeclaredPropsNullable( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi index 69381e19e73..4c35fda5b33 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi @@ -33,6 +33,7 @@ class User( class MetaOapg: + class properties: id = schemas.Int64Schema username = schemas.StrSchema @@ -46,7 +47,6 @@ class User( class objectWithNoDeclaredPropsNullable( - schemas.SchemaTypeCheckerClsFactory(typing.Union[schemas.NoneClass, frozendict.frozendict, ]), schemas.DictBase, schemas.NoneBase, schemas.Schema, 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 2cf1ab5a622..48783bcd351 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 @@ -36,6 +36,7 @@ class Whale( required = { "className", } + class properties: 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 2cf1ab5a622..48783bcd351 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 @@ -36,6 +36,7 @@ class Whale( required = { "className", } + class properties: 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 2661136f869..c2f8dd424ee 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 @@ -36,6 +36,7 @@ class Zebra( required = { "className", } + class properties: 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 2661136f869..c2f8dd424ee 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 @@ -36,6 +36,7 @@ class Zebra( required = { "className", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py index a5c52b75eca..88f630abbe2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py @@ -40,6 +40,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( "byte", "double", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi index bb294290a04..254c4087e58 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi @@ -38,6 +38,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( "byte", "double", } + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py index eea70d69073..01854082472 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py @@ -292,6 +292,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi index 6ee005d60ff..5e96fed5908 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi @@ -216,6 +216,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py index 5d4227379fd..ce59b86fb43 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py @@ -80,6 +80,7 @@ class CompositionInPropertySchema( class MetaOapg: + class properties: @@ -252,6 +253,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: @@ -402,6 +404,7 @@ class SchemaFor200ResponseBodyMultipartFormData( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi index 4f97c27a695..34412cce21e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi @@ -75,6 +75,7 @@ class CompositionInPropertySchema( class MetaOapg: + class properties: @@ -210,6 +211,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: @@ -344,6 +346,7 @@ class SchemaFor200ResponseBodyMultipartFormData( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py index 4ade6e559fb..283cc5cf178 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py @@ -38,6 +38,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( "param", "param2", } + class properties: param = schemas.StrSchema param2 = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi index 958f141a279..1bbde21cfd2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi @@ -36,6 +36,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( "param", "param2", } + class properties: param = schemas.StrSchema param2 = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py index c1107d886da..eeae1e9e216 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py @@ -33,6 +33,7 @@ class MapBeanSchema( class MetaOapg: + class properties: keyword = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi index c769a91570d..f51bb30f541 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi @@ -31,6 +31,7 @@ class MapBeanSchema( class MetaOapg: + class properties: keyword = schemas.StrSchema __annotations__ = { diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py index 1cbd43c618c..7cffcf61079 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py @@ -65,6 +65,7 @@ class SchemaForRequestBodyMultipartFormData( required = { "requiredFile", } + class properties: additionalMetadata = schemas.StrSchema requiredFile = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi index bfdc83189ed..7a9677c5187 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi @@ -39,6 +39,7 @@ class SchemaForRequestBodyMultipartFormData( required = { "requiredFile", } + class properties: additionalMetadata = schemas.StrSchema requiredFile = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py index 0c8a10fdee5..e11344e9dbf 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py @@ -39,6 +39,7 @@ class SchemaForRequestBodyMultipartFormData( required = { "file", } + class properties: additionalMetadata = schemas.StrSchema file = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi index f15b1a1a452..ab1e21c65f9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi @@ -37,6 +37,7 @@ class SchemaForRequestBodyMultipartFormData( required = { "file", } + class properties: additionalMetadata = schemas.StrSchema file = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py index 4372632a0a5..32f9927c036 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py @@ -36,6 +36,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi index 65660558a9d..0b68c63d36a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi @@ -34,6 +34,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py index 4a2c3d29577..6506bcb6db7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py @@ -35,6 +35,7 @@ class SchemaFor0ResponseBodyApplicationJson( class MetaOapg: + class properties: @classmethod diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi index 946ef318e81..0ee92bc160b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi @@ -33,6 +33,7 @@ class SchemaFor0ResponseBodyApplicationJson( class MetaOapg: + class properties: @classmethod 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 df457d00faa..0cfe3e59000 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 @@ -113,7 +113,7 @@ class SchemaFor200ResponseBodyApplicationXml( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: @@ -140,7 +140,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: 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 1d024c1813b..6297993908a 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 @@ -83,7 +83,7 @@ class SchemaFor200ResponseBodyApplicationXml( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: @@ -110,7 +110,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.py index 5deb4598c0d..a0004174f2a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.py @@ -87,7 +87,7 @@ class SchemaFor200ResponseBodyApplicationXml( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: @@ -114,7 +114,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.pyi index a85947839ee..1c95c84496a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_find_by_tags/get.pyi @@ -57,7 +57,7 @@ class SchemaFor200ResponseBodyApplicationXml( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: @@ -84,7 +84,7 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['Pet']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py index 0b984b4f7ba..5f8722c7ddb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py @@ -60,6 +60,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class MetaOapg: + class properties: name = schemas.StrSchema status = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi index 000ae848d19..6ba44f24819 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi @@ -34,6 +34,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( class MetaOapg: + class properties: name = schemas.StrSchema status = schemas.StrSchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py index 32bef56299c..373ff78dafb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py @@ -62,6 +62,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: additionalMetadata = schemas.StrSchema file = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi index e18e2f4cc20..041a327eb6b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi @@ -36,6 +36,7 @@ class SchemaForRequestBodyMultipartFormData( class MetaOapg: + class properties: additionalMetadata = schemas.StrSchema file = schemas.BinarySchema diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.py index 73c764bdf0b..36333467e3b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.py @@ -36,7 +36,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['User']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.pyi index 52de2f5d5e4..561320c69d4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_array/post.pyi @@ -34,7 +34,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['User']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.py index 6403844311d..6ad6fe0f7ba 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.py @@ -36,7 +36,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['User']: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.pyi index 1050b2e6a6d..6b588699813 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/user_create_with_list/post.pyi @@ -34,7 +34,7 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: - + @classmethod @property def items(cls) -> typing.Type['User']: 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 7b4fff772de..4e13043fca6 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/schemas.py @@ -243,8 +243,60 @@ class Schema: the base class of all swagger/openapi schemas/models """ __inheritable_primitive_types_set = {decimal.Decimal, str, tuple, frozendict.frozendict, FileIO, bytes, BoolClass, NoneClass} + _types: typing.Set[typing.Type] MetaOapg = MetaOapgTyped + @staticmethod + def __get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed""" + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return "is {0}".format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + @classmethod + def __type_error_message( + cls, var_value=None, var_name=None, valid_classes=None, key_type=None + ): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a tuple + """ + key_or_value = "value" + if key_type: + key_or_value = "key" + valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) + msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + return msg + + @classmethod + def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): + error_msg = cls.__type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type, + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type, + ) + @classmethod def _validate_oapg( cls, @@ -253,21 +305,8 @@ class Schema: ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: """ Schema _validate_oapg - Runs all schema validation logic and - returns a dynamic class of different bases depending upon the input - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Use cases: - 1. inheritable type: string/decimal.Decimal/frozendict.frozendict/tuple - 2. singletons: bool/None -> uses the base classes BoolClass/NoneClass - - Required Steps: - 1. verify type of input is valid vs the allowed _types - 2. check validations that are applicable for this type of input - 3. if enums exist, check that the value exists in the enum + All keyword validation except for type checking was done in calling stack frames + If those validations passed, the validated classes are collected in path_to_schemas Returns: path_to_schemas: a map of path to schemas @@ -277,6 +316,14 @@ class Schema: ApiTypeError: when the input type is not in the list of allowed spec types """ base_class = type(arg) + if base_class not in cls._types: + raise cls.__get_type_error( + arg, + validation_metadata.path_to_item, + cls._types, + key_type=False, + ) + path_to_schemas = {validation_metadata.path_to_item: set()} path_to_schemas[validation_metadata.path_to_item].add(cls) path_to_schemas[validation_metadata.path_to_item].add(base_class) @@ -515,6 +562,8 @@ if typing.TYPE_CHECKING: StrMixin = str DecimalMixin = decimal.Decimal BoolMixin = BoolClass + BytesMixin = bytes + FileMixin = FileIO # qty 2 class BinaryMixin(bytes, FileIO): pass @@ -636,77 +685,151 @@ if typing.TYPE_CHECKING: # qty 6 class NoneFrozenDictTupleStrDecimalBoolMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass): pass + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes): + pass else: # qty 1 - NoneMixin = object - FrozenDictMixin = object - TupleMixin = object - StrMixin = object - DecimalMixin = object - BoolMixin = object + class NoneMixin: + _types = {NoneClass} + class FrozenDictMixin: + _types = {frozendict.frozendict} + class TupleMixin: + _types = {tuple} + class StrMixin: + _types = {str} + class DecimalMixin: + _types = {decimal.Decimal} + class BoolMixin: + _types = {BoolClass} + class BytesMixin: + _types = {bytes} + class FileMixin: + _types = {FileIO} # qty 2 - BinaryMixin = object - NoneFrozenDictMixin = object - NoneTupleMixin = object - NoneStrMixin = object - NoneDecimalMixin = object - NoneBoolMixin = object - FrozenDictTupleMixin = object - FrozenDictStrMixin = object - FrozenDictDecimalMixin = object - FrozenDictBoolMixin = object - TupleStrMixin = object - TupleDecimalMixin = object - TupleBoolMixin = object - StrDecimalMixin = object - StrBoolMixin = object - DecimalBoolMixin = object + class BinaryMixin: + _types = {bytes, FileIO} + class NoneFrozenDictMixin: + _types = {NoneClass, frozendict.frozendict} + class NoneTupleMixin: + _types = {NoneClass, tuple} + class NoneStrMixin: + _types = {NoneClass, str} + class NoneDecimalMixin: + _types = {NoneClass, decimal.Decimal} + class NoneBoolMixin: + _types = {NoneClass, BoolClass} + class FrozenDictTupleMixin: + _types = {frozendict.frozendict, tuple} + class FrozenDictStrMixin: + _types = {frozendict.frozendict, str} + class FrozenDictDecimalMixin: + _types = {frozendict.frozendict, decimal.Decimal} + class FrozenDictBoolMixin: + _types = {frozendict.frozendict, BoolClass} + class TupleStrMixin: + _types = {tuple, str} + class TupleDecimalMixin: + _types = {tuple, decimal.Decimal} + class TupleBoolMixin: + _types = {tuple, BoolClass} + class StrDecimalMixin: + _types = {str, decimal.Decimal} + class StrBoolMixin: + _types = {str, BoolClass} + class DecimalBoolMixin: + _types = {decimal.Decimal, BoolClass} # qty 3 - NoneFrozenDictTupleMixin = object - NoneFrozenDictStrMixin = object - NoneFrozenDictDecimalMixin = object - NoneFrozenDictBoolMixin = object - NoneTupleStrMixin = object - NoneTupleDecimalMixin = object - NoneTupleBoolMixin = object - NoneStrDecimalMixin = object - NoneStrBoolMixin = object - NoneDecimalBoolMixin = object - FrozenDictTupleStrMixin = object - FrozenDictTupleDecimalMixin = object - FrozenDictTupleBoolMixin = object - FrozenDictStrDecimalMixin = object - FrozenDictStrBoolMixin = object - FrozenDictDecimalBoolMixin = object - TupleStrDecimalMixin = object - TupleStrBoolMixin = object - TupleDecimalBoolMixin = object - StrDecimalBoolMixin = object + class NoneFrozenDictTupleMixin: + _types = {NoneClass, frozendict.frozendict, tuple} + class NoneFrozenDictStrMixin: + _types = {NoneClass, frozendict.frozendict, str} + class NoneFrozenDictDecimalMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal} + class NoneFrozenDictBoolMixin: + _types = {NoneClass, frozendict.frozendict, BoolClass} + class NoneTupleStrMixin: + _types = {NoneClass, tuple, str} + class NoneTupleDecimalMixin: + _types = {NoneClass, tuple, decimal.Decimal} + class NoneTupleBoolMixin: + _types = {NoneClass, tuple, BoolClass} + class NoneStrDecimalMixin: + _types = {NoneClass, str, decimal.Decimal} + class NoneStrBoolMixin: + _types = {NoneClass, str, BoolClass} + class NoneDecimalBoolMixin: + _types = {NoneClass, decimal.Decimal, BoolClass} + class FrozenDictTupleStrMixin: + _types = {frozendict.frozendict, tuple, str} + class FrozenDictTupleDecimalMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal} + class FrozenDictTupleBoolMixin: + _types = {frozendict.frozendict, tuple, BoolClass} + class FrozenDictStrDecimalMixin: + _types = {frozendict.frozendict, str, decimal.Decimal} + class FrozenDictStrBoolMixin: + _types = {frozendict.frozendict, str, BoolClass} + class FrozenDictDecimalBoolMixin: + _types = {frozendict.frozendict, decimal.Decimal, BoolClass} + class TupleStrDecimalMixin: + _types = {tuple, str, decimal.Decimal} + class TupleStrBoolMixin: + _types = {tuple, str, BoolClass} + class TupleDecimalBoolMixin: + _types = {tuple, decimal.Decimal, BoolClass} + class StrDecimalBoolMixin: + _types = {str, decimal.Decimal, BoolClass} # qty 4 - NoneFrozenDictTupleStrMixin = object - NoneFrozenDictTupleDecimalMixin = object - NoneFrozenDictTupleBoolMixin = object - NoneFrozenDictStrDecimalMixin = object - NoneFrozenDictStrBoolMixin = object - NoneFrozenDictDecimalBoolMixin = object - NoneTupleStrDecimalMixin = object - NoneTupleStrBoolMixin = object - NoneTupleDecimalBoolMixin = object - NoneStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalMixin = object - FrozenDictTupleStrBoolMixin = object - FrozenDictTupleDecimalBoolMixin = object - FrozenDictStrDecimalBoolMixin = object - TupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str} + class NoneFrozenDictTupleDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal} + class NoneFrozenDictTupleBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, BoolClass} + class NoneFrozenDictStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal} + class NoneFrozenDictStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, BoolClass} + class NoneFrozenDictDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalMixin: + _types = {NoneClass, tuple, str, decimal.Decimal} + class NoneTupleStrBoolMixin: + _types = {NoneClass, tuple, str, BoolClass} + class NoneTupleDecimalBoolMixin: + _types = {NoneClass, tuple, decimal.Decimal, BoolClass} + class NoneStrDecimalBoolMixin: + _types = {NoneClass, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal} + class FrozenDictTupleStrBoolMixin: + _types = {frozendict.frozendict, tuple, str, BoolClass} + class FrozenDictTupleDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class FrozenDictStrDecimalBoolMixin: + _types = {frozendict.frozendict, str, decimal.Decimal, BoolClass} + class TupleStrDecimalBoolMixin: + _types = {tuple, str, decimal.Decimal, BoolClass} # qty 5 - NoneFrozenDictTupleStrDecimalMixin = object - NoneFrozenDictTupleStrBoolMixin = object - NoneFrozenDictTupleDecimalBoolMixin = object - NoneFrozenDictStrDecimalBoolMixin = object - NoneTupleStrDecimalBoolMixin = object - FrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal} + class NoneFrozenDictTupleStrBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, BoolClass} + class NoneFrozenDictTupleDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal, BoolClass} + class NoneFrozenDictStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal, BoolClass} + class NoneTupleStrDecimalBoolMixin: + _types = {NoneClass, tuple, str, decimal.Decimal, BoolClass} + class FrozenDictTupleStrDecimalBoolMixin: + _types = {frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} # qty 6 - NoneFrozenDictTupleStrDecimalBoolMixin = object + class NoneFrozenDictTupleStrDecimalBoolMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} + # qty 8 + class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin: + _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes} class ValidatorBase: @@ -750,92 +873,6 @@ class Validator(typing.Protocol): pass -def SchemaTypeCheckerClsFactory(union_type_cls: typing.Any) -> Validator: - if typing.get_origin(union_type_cls) is typing.Union: - union_classes = typing.get_args(union_type_cls) - else: - # note: when a union of a single class is passed in, the union disappears - union_classes = tuple([union_type_cls]) - """ - I want the type hint... union_type_cls - and to use it as a base class but when I do, I get - TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - """ - class SchemaTypeChecker: - @staticmethod - def __get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed""" - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return "is {0}".format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - @classmethod - def __type_error_message( - cls, var_value=None, var_name=None, valid_classes=None, key_type=None - ): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a tuple - """ - key_or_value = "value" - if key_type: - key_or_value = "key" - valid_classes_phrase = cls.__get_valid_classes_phrase(valid_classes) - msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - return msg - - @classmethod - def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): - error_msg = cls.__type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type, - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type, - ) - - @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]]]: - """ - SchemaTypeChecker _validate_oapg - Validates arg's type - """ - arg_type = type(arg) - if arg_type in union_classes: - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - raise cls.__get_type_error( - arg, - validation_metadata.path_to_item, - union_classes, - key_type=False, - ) - - return SchemaTypeChecker - - class EnumMakerBase: pass @@ -1996,7 +2033,6 @@ class ComposedBase(Discriminable): # DictBase, ListBase, NumberBase, StrBase, BoolBase, NoneBase class ComposedSchema( - SchemaTypeCheckerClsFactory(typing.Union[NoneClass, str, decimal.Decimal, BoolClass, tuple, frozendict.frozendict]), ComposedBase, DictBase, ListBase, @@ -2017,7 +2053,6 @@ class ComposedSchema( class ListSchema( - SchemaTypeCheckerClsFactory(tuple), ListBase, Schema, TupleMixin @@ -2032,7 +2067,6 @@ class ListSchema( class NoneSchema( - SchemaTypeCheckerClsFactory(NoneClass), NoneBase, Schema, NoneMixin @@ -2047,7 +2081,6 @@ class NoneSchema( class NumberSchema( - SchemaTypeCheckerClsFactory(decimal.Decimal), NumberBase, Schema, DecimalMixin @@ -2243,7 +2276,6 @@ class Float64Schema( class StrSchema( - SchemaTypeCheckerClsFactory(str), StrBase, Schema, StrMixin @@ -2296,8 +2328,8 @@ class DecimalSchema(DecimalBase, StrSchema): class BytesSchema( - SchemaTypeCheckerClsFactory(bytes), Schema, + BytesMixin ): """ this class will subclass bytes and is immutable @@ -2307,8 +2339,8 @@ class BytesSchema( class FileSchema( - SchemaTypeCheckerClsFactory(FileIO), Schema, + FileMixin ): """ This class is NOT immutable @@ -2336,7 +2368,6 @@ class BinaryBase: class BinarySchema( - SchemaTypeCheckerClsFactory(typing.Union[bytes, FileIO]), ComposedBase, BinaryBase, Schema, @@ -2353,7 +2384,6 @@ class BinarySchema( class BoolSchema( - SchemaTypeCheckerClsFactory(BoolClass), BoolBase, Schema, BoolMixin @@ -2368,9 +2398,6 @@ class BoolSchema( class AnyTypeSchema( - SchemaTypeCheckerClsFactory( - typing.Union[frozendict.frozendict, tuple, decimal.Decimal, str, BoolClass, NoneClass, bytes, FileIO] - ), DictBase, ListBase, NumberBase, @@ -2378,7 +2405,7 @@ class AnyTypeSchema( BoolBase, NoneBase, Schema, - NoneFrozenDictTupleStrDecimalBoolMixin + NoneFrozenDictTupleStrDecimalBoolFileBytesMixin ): # Python representation of a schema defined as true or {} pass @@ -2414,7 +2441,6 @@ class NotAnyTypeSchema( class DictSchema( - SchemaTypeCheckerClsFactory(frozendict.frozendict), DictBase, Schema, FrozenDictMixin