[python-experimental] moves composed schemas into cls (#13255)

* Composed schemas moved into cls

* Fixes tests

* Other sample regenerated

* Reverts version files
This commit is contained in:
Justin Black 2022-08-22 16:50:46 -07:00 committed by GitHub
parent fac576a2bf
commit d6fb08d837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 1655 additions and 2248 deletions

View File

@ -1,7 +1,32 @@
{{#with composedSchemas}}
{{#each allOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#each oneOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#each anyOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#with not}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/with}}
{{/with}}
{{#with composedSchemas}}
{{#if allOf}}
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -9,82 +34,101 @@ def _composed_schemas(cls):
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
{{#with composedSchemas}} return [
{{#each allOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#each oneOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#each anyOf}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/each}}
{{#with not}}
{{#unless complexType}}
{{> model_templates/schema }}
{{/unless}}
{{/with}}
{{/with}}
return {
'allOf': [
{{#with composedSchemas}}
{{#each allOf}} {{#each allOf}}
{{#if complexType}} {{#if complexType}}
{{complexType}}, {{complexType}},
{{else}} {{else}}
{{#if nameInSnakeCase}} {{#if nameInSnakeCase}}
{{name}}, cls.{{name}},
{{else}} {{else}}
{{baseName}}, cls.{{baseName}},
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}
], ]
'oneOf': [ {{/if}}
{{#if oneOf}}
@classmethod
@property
@functools.cache
def _one_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
{{#each oneOf}} {{#each oneOf}}
{{#if complexType}} {{#if complexType}}
{{complexType}}, {{complexType}},
{{else}} {{else}}
{{#if nameInSnakeCase}} {{#if nameInSnakeCase}}
{{name}}, cls.{{name}},
{{else}} {{else}}
{{baseName}}, cls.{{baseName}},
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}
], ]
'anyOf': [ {{/if}}
{{#if anyOf}}
@classmethod
@property
@functools.cache
def _any_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
{{#each anyOf}} {{#each anyOf}}
{{#if complexType}} {{#if complexType}}
{{complexType}}, {{complexType}},
{{else}} {{else}}
{{#if nameInSnakeCase}} {{#if nameInSnakeCase}}
{{name}}, cls.{{name}},
{{else}} {{else}}
{{baseName}}, cls.{{baseName}},
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}
], ]
'not': {{/if}}
{{#if not}}
@classmethod
@property
@functools.cache
def _not(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return (
{{#with not}} {{#with not}}
{{#if complexType}} {{#if complexType}}
{{complexType}} {{complexType}}
{{else}} {{else}}
{{#if nameInSnakeCase}} {{#if nameInSnakeCase}}
{{name}} cls.{{name}}
{{else}} {{else}}
{{baseName}} cls.{{baseName}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{else}} {{else}}
None None
{{/with}} {{/with}}
)
{{/if}}
{{/with}} {{/with}}
}

View File

@ -942,20 +942,20 @@ class Discriminable:
discriminated_cls = disc[disc_property_name].get(disc_payload_value) discriminated_cls = disc[disc_property_name].get(disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
elif not hasattr(cls, '_composed_schemas'): elif not (hasattr(cls, '_all_of') or hasattr(cls, '_one_of') or hasattr(cls, '_any_of')):
return None return None
# TODO stop traveling if a cycle is hit # TODO stop traveling if a cycle is hit
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in getattr(cls, '_all_of', []):
discriminated_cls = allof_cls._get_discriminated_class( discriminated_cls = allof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in getattr(cls, '_one_of', []):
discriminated_cls = oneof_cls._get_discriminated_class( discriminated_cls = oneof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in getattr(cls, '_any_of', []):
discriminated_cls = anyof_cls._get_discriminated_class( discriminated_cls = anyof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
@ -1560,7 +1560,7 @@ class ComposedBase(Discriminable):
@classmethod @classmethod
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata): def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in cls._all_of:
if validation_metadata.validation_ran_earlier(allof_cls): if validation_metadata.validation_ran_earlier(allof_cls):
continue continue
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata) other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
@ -1576,7 +1576,7 @@ class ComposedBase(Discriminable):
): ):
oneof_classes = [] oneof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in cls._one_of:
if oneof_cls in path_to_schemas[validation_metadata.path_to_item]: if oneof_cls in path_to_schemas[validation_metadata.path_to_item]:
oneof_classes.append(oneof_cls) oneof_classes.append(oneof_cls)
continue continue
@ -1611,7 +1611,7 @@ class ComposedBase(Discriminable):
): ):
anyof_classes = [] anyof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in cls._any_of:
if validation_metadata.validation_ran_earlier(anyof_cls): if validation_metadata.validation_ran_earlier(anyof_cls):
anyof_classes.append(anyof_cls) anyof_classes.append(anyof_cls)
continue continue
@ -1683,24 +1683,24 @@ class ComposedBase(Discriminable):
) )
) )
if cls._composed_schemas['allOf']: if hasattr(cls, '_all_of'):
other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm) other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm)
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['oneOf']: if hasattr(cls, '_one_of'):
other_path_to_schemas = cls.__get_oneof_class( other_path_to_schemas = cls.__get_oneof_class(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['anyOf']: if hasattr(cls, '_any_of'):
other_path_to_schemas = cls.__get_anyof_classes( other_path_to_schemas = cls.__get_anyof_classes(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
not_cls = cls._composed_schemas['not'] not_cls = getattr(cls, '_not', None)
if not_cls: if not_cls:
other_path_to_schemas = None other_path_to_schemas = None
not_exception = ApiValueError( not_exception = ApiValueError(
@ -1994,27 +1994,10 @@ class BinarySchema(
BinaryBase, BinaryBase,
Schema, Schema,
): ):
_one_of = [
@classmethod BytesSchema,
@property FileSchema,
def _composed_schemas(cls): ]
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return {
'allOf': [],
'oneOf': [
BytesSchema,
FileSchema,
],
'anyOf': [
],
'not': None
}
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]): def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
return super().__new__(cls, arg) return super().__new__(cls, arg)

View File

@ -33,10 +33,32 @@ class AdditionalpropertiesShouldNotLookInApplicators(
""" """
_additional_properties = schemas.BoolSchema _additional_properties = schemas.BoolSchema
class all_of_0(
schemas.AnyTypeSchema,
):
foo = schemas.AnyTypeSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,38 +66,9 @@ class AdditionalpropertiesShouldNotLookInApplicators(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.AnyTypeSchema,
):
foo = schemas.AnyTypeSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,59 @@ class Allof(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_0(
schemas.AnyTypeSchema,
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,66 +92,10 @@ class Allof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( cls.all_of_1,
schemas.AnyTypeSchema, ]
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,68 @@ class AllofCombinedWithAnyofOneof(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_0(
schemas.AnyTypeSchema,
):
_multiple_of=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_0(
schemas.AnyTypeSchema,
):
_multiple_of=5
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class any_of_0(
schemas.AnyTypeSchema,
):
_multiple_of=3
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,76 +101,39 @@ class AllofCombinedWithAnyofOneof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
]
@classmethod
@property
@functools.cache
def _one_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
cls.one_of_0,
]
class all_of_0( @classmethod
schemas.AnyTypeSchema, @property
): @functools.cache
_multiple_of=2 def _any_of(cls):
# we need this here to make our import statements work
def __new__( # we must store _composed_schemas in here so the code is only run
cls, # when we invoke this method. If we kept this at the class
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], # level we would get an error because the class level
_configuration: typing.Optional[schemas.Configuration] = None, # code would be run when this module is imported, and these composed
**kwargs: typing.Type[schemas.Schema], # classes don't exist yet because their module has not finished
) -> 'all_of_0': # loading
return super().__new__( return [
cls, cls.any_of_0,
*args, ]
_configuration=_configuration,
**kwargs,
)
class one_of_0(
schemas.AnyTypeSchema,
):
_multiple_of=5
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class any_of_0(
schemas.AnyTypeSchema,
):
_multiple_of=3
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
],
'oneOf': [
one_of_0,
],
'anyOf': [
any_of_0,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,49 @@ class AllofSimpleTypes(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_0(
schemas.AnyTypeSchema,
):
_inclusive_maximum=30
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_inclusive_minimum=20
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,56 +82,10 @@ class AllofSimpleTypes(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( cls.all_of_1,
schemas.AnyTypeSchema, ]
):
_inclusive_maximum=30
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_inclusive_minimum=20
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -36,10 +36,59 @@ class AllofWithBaseSchema(
} }
bar = schemas.IntSchema bar = schemas.IntSchema
class all_of_0(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"baz",
}
baz = schemas.NoneSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
baz: baz,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
baz=baz,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -47,66 +96,10 @@ class AllofWithBaseSchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( cls.all_of_1,
schemas.AnyTypeSchema, ]
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
class all_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"baz",
}
baz = schemas.NoneSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
baz: baz,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
baz=baz,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,12 @@ class AllofWithOneEmptySchema(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,18 +45,9 @@ class AllofWithOneEmptySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,13 @@ class AllofWithTheFirstEmptySchema(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
all_of_1 = schemas.NumberSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +46,10 @@ class AllofWithTheFirstEmptySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
all_of_1 = schemas.NumberSchema cls.all_of_0,
return { cls.all_of_1,
'allOf': [ ]
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,13 @@ class AllofWithTheLastEmptySchema(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.NumberSchema
all_of_1 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +46,10 @@ class AllofWithTheLastEmptySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.NumberSchema return [
all_of_1 = schemas.AnyTypeSchema cls.all_of_0,
return { cls.all_of_1,
'allOf': [ ]
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,13 @@ class AllofWithTwoEmptySchemas(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
all_of_1 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +46,10 @@ class AllofWithTwoEmptySchemas(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
all_of_1 = schemas.AnyTypeSchema cls.all_of_0,
return { cls.all_of_1,
'allOf': [ ]
all_of_0,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,31 @@ class Anyof(
Do not edit the class manually. Do not edit the class manually.
""" """
any_of_0 = schemas.IntSchema
class any_of_1(
schemas.AnyTypeSchema,
):
_inclusive_minimum=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,38 +64,10 @@ class Anyof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
any_of_0 = schemas.IntSchema return [
cls.any_of_0,
cls.any_of_1,
class any_of_1( ]
schemas.AnyTypeSchema,
):
_inclusive_minimum=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
any_of_1,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,59 @@ class AnyofComplexTypes(
Do not edit the class manually. Do not edit the class manually.
""" """
class any_of_0(
schemas.AnyTypeSchema,
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class any_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,66 +92,10 @@ class AnyofComplexTypes(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.any_of_0,
class any_of_0( cls.any_of_1,
schemas.AnyTypeSchema, ]
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class any_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
any_of_1,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,49 @@ class AnyofWithBaseSchema(
Do not edit the class manually. Do not edit the class manually.
""" """
class any_of_0(
schemas.AnyTypeSchema,
):
_max_length=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class any_of_1(
schemas.AnyTypeSchema,
):
_min_length=4
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,56 +83,10 @@ class AnyofWithBaseSchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.any_of_0,
class any_of_0( cls.any_of_1,
schemas.AnyTypeSchema, ]
):
_max_length=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class any_of_1(
schemas.AnyTypeSchema,
):
_min_length=4
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
any_of_1,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,13 @@ class AnyofWithOneEmptySchema(
Do not edit the class manually. Do not edit the class manually.
""" """
any_of_0 = schemas.NumberSchema
any_of_1 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +46,10 @@ class AnyofWithOneEmptySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
any_of_0 = schemas.NumberSchema return [
any_of_1 = schemas.AnyTypeSchema cls.any_of_0,
return { cls.any_of_1,
'allOf': [ ]
],
'oneOf': [
],
'anyOf': [
any_of_0,
any_of_1,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -37,10 +37,12 @@ class ForbiddenProperty(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
not_schema = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -48,17 +50,9 @@ class ForbiddenProperty(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.AnyTypeSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,12 @@ class ModelNot(
Do not edit the class manually. Do not edit the class manually.
""" """
not_schema = schemas.IntSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +45,9 @@ class ModelNot(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.IntSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,46 @@ class NestedAllofToCheckValidationSemantics(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_0(
schemas.ComposedSchema,
):
all_of_0 = schemas.NoneSchema
@classmethod
@property
@functools.cache
def _all_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
cls.all_of_0,
]
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,59 +79,9 @@ class NestedAllofToCheckValidationSemantics(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.ComposedSchema,
):
@classmethod
@property
@functools.cache
def _composed_schemas(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
all_of_0 = schemas.NoneSchema
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,46 @@ class NestedAnyofToCheckValidationSemantics(
Do not edit the class manually. Do not edit the class manually.
""" """
class any_of_0(
schemas.ComposedSchema,
):
any_of_0 = schemas.NoneSchema
@classmethod
@property
@functools.cache
def _any_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
cls.any_of_0,
]
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,59 +79,9 @@ class NestedAnyofToCheckValidationSemantics(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.any_of_0,
class any_of_0( ]
schemas.ComposedSchema,
):
@classmethod
@property
@functools.cache
def _composed_schemas(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
any_of_0 = schemas.NoneSchema
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
],
'not':
None
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'any_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,46 @@ class NestedOneofToCheckValidationSemantics(
Do not edit the class manually. Do not edit the class manually.
""" """
class one_of_0(
schemas.ComposedSchema,
):
one_of_0 = schemas.NoneSchema
@classmethod
@property
@functools.cache
def _one_of(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return [
cls.one_of_0,
]
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,59 +79,9 @@ class NestedOneofToCheckValidationSemantics(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.one_of_0,
class one_of_0( ]
schemas.ComposedSchema,
):
@classmethod
@property
@functools.cache
def _composed_schemas(cls):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
one_of_0 = schemas.NoneSchema
return {
'allOf': [
],
'oneOf': [
one_of_0,
],
'anyOf': [
],
'not':
None
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
one_of_0,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,33 @@ class NotMoreComplexSchema(
Do not edit the class manually. Do not edit the class manually.
""" """
class not_schema(
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,38 +66,9 @@ class NotMoreComplexSchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return (
cls.not_schema
class not_schema( )
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,31 @@ class Oneof(
Do not edit the class manually. Do not edit the class manually.
""" """
one_of_0 = schemas.IntSchema
class one_of_1(
schemas.AnyTypeSchema,
):
_inclusive_minimum=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,38 +64,10 @@ class Oneof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_0 = schemas.IntSchema return [
cls.one_of_0,
cls.one_of_1,
class one_of_1( ]
schemas.AnyTypeSchema,
):
_inclusive_minimum=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
one_of_0,
one_of_1,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,59 @@ class OneofComplexTypes(
Do not edit the class manually. Do not edit the class manually.
""" """
class one_of_0(
schemas.AnyTypeSchema,
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,66 +92,10 @@ class OneofComplexTypes(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.one_of_0,
class one_of_0( cls.one_of_1,
schemas.AnyTypeSchema, ]
):
_required_property_names = {
"bar",
}
bar = schemas.IntSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
bar: bar,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
bar=bar,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
}
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
foo: foo,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
one_of_0,
one_of_1,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,49 @@ class OneofWithBaseSchema(
Do not edit the class manually. Do not edit the class manually.
""" """
class one_of_0(
schemas.AnyTypeSchema,
):
_min_length=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_max_length=4
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,56 +83,10 @@ class OneofWithBaseSchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.one_of_0,
class one_of_0( cls.one_of_1,
schemas.AnyTypeSchema, ]
):
_min_length=2
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_max_length=4
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
one_of_0,
one_of_1,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,13 @@ class OneofWithEmptySchema(
Do not edit the class manually. Do not edit the class manually.
""" """
one_of_0 = schemas.NumberSchema
one_of_1 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +46,10 @@ class OneofWithEmptySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_0 = schemas.NumberSchema return [
one_of_1 = schemas.AnyTypeSchema cls.one_of_0,
return { cls.one_of_1,
'allOf': [ ]
],
'oneOf': [
one_of_0,
one_of_1,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,55 @@ class OneofWithRequired(
Do not edit the class manually. Do not edit the class manually.
""" """
class one_of_0(
schemas.AnyTypeSchema,
):
_required_property_names = {
"bar",
"foo",
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
"baz",
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,62 +89,10 @@ class OneofWithRequired(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.one_of_0,
class one_of_0( cls.one_of_1,
schemas.AnyTypeSchema, ]
):
_required_property_names = {
"bar",
"foo",
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_0':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_1(
schemas.AnyTypeSchema,
):
_required_property_names = {
"foo",
"baz",
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_1':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
one_of_0,
one_of_1,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class RefInAllof(
Do not edit the class manually. Do not edit the class manually.
""" """
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +44,9 @@ class RefInAllof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ PropertyNamedRefThatIsNotAReference,
PropertyNamedRefThatIsNotAReference, ]
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class RefInAnyof(
Do not edit the class manually. Do not edit the class manually.
""" """
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +44,9 @@ class RefInAnyof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ PropertyNamedRefThatIsNotAReference,
], ]
'oneOf': [
],
'anyOf': [
PropertyNamedRefThatIsNotAReference,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class RefInNot(
Do not edit the class manually. Do not edit the class manually.
""" """
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,16 +44,9 @@ class RefInNot(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return (
'allOf': [ PropertyNamedRefThatIsNotAReference
], )
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class RefInOneof(
Do not edit the class manually. Do not edit the class manually.
""" """
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +44,9 @@ class RefInOneof(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ PropertyNamedRefThatIsNotAReference,
], ]
'oneOf': [
PropertyNamedRefThatIsNotAReference,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -30,10 +30,33 @@ class SchemaForRequestBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class not_schema(
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -41,38 +64,9 @@ class SchemaForRequestBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return (
cls.not_schema
class not_schema( )
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -30,10 +30,12 @@ class SchemaForRequestBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
not_schema = schemas.IntSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -41,17 +43,9 @@ class SchemaForRequestBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.IntSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class SchemaForRequestBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,16 +44,9 @@ class SchemaForRequestBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return (
'allOf': [ PropertyNamedRefThatIsNotAReference
], )
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__( def __new__(
cls, cls,

View File

@ -29,10 +29,33 @@ class SchemaFor200ResponseBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class not_schema(
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -40,38 +63,9 @@ class SchemaFor200ResponseBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return (
cls.not_schema
class not_schema( )
schemas.DictSchema
):
foo = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
foo: typing.Union[foo, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'not_schema':
return super().__new__(
cls,
*args,
foo=foo,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -29,10 +29,12 @@ class SchemaFor200ResponseBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
not_schema = schemas.IntSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -40,17 +42,9 @@ class SchemaFor200ResponseBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.IntSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -31,10 +31,11 @@ class SchemaFor200ResponseBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -42,16 +43,9 @@ class SchemaFor200ResponseBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return (
'allOf': [ PropertyNamedRefThatIsNotAReference
], )
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__( def __new__(
cls, cls,

View File

@ -949,20 +949,20 @@ class Discriminable:
discriminated_cls = disc[disc_property_name].get(disc_payload_value) discriminated_cls = disc[disc_property_name].get(disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
elif not hasattr(cls, '_composed_schemas'): elif not (hasattr(cls, '_all_of') or hasattr(cls, '_one_of') or hasattr(cls, '_any_of')):
return None return None
# TODO stop traveling if a cycle is hit # TODO stop traveling if a cycle is hit
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in getattr(cls, '_all_of', []):
discriminated_cls = allof_cls._get_discriminated_class( discriminated_cls = allof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in getattr(cls, '_one_of', []):
discriminated_cls = oneof_cls._get_discriminated_class( discriminated_cls = oneof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in getattr(cls, '_any_of', []):
discriminated_cls = anyof_cls._get_discriminated_class( discriminated_cls = anyof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
@ -1567,7 +1567,7 @@ class ComposedBase(Discriminable):
@classmethod @classmethod
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata): def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in cls._all_of:
if validation_metadata.validation_ran_earlier(allof_cls): if validation_metadata.validation_ran_earlier(allof_cls):
continue continue
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata) other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
@ -1583,7 +1583,7 @@ class ComposedBase(Discriminable):
): ):
oneof_classes = [] oneof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in cls._one_of:
if oneof_cls in path_to_schemas[validation_metadata.path_to_item]: if oneof_cls in path_to_schemas[validation_metadata.path_to_item]:
oneof_classes.append(oneof_cls) oneof_classes.append(oneof_cls)
continue continue
@ -1618,7 +1618,7 @@ class ComposedBase(Discriminable):
): ):
anyof_classes = [] anyof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in cls._any_of:
if validation_metadata.validation_ran_earlier(anyof_cls): if validation_metadata.validation_ran_earlier(anyof_cls):
anyof_classes.append(anyof_cls) anyof_classes.append(anyof_cls)
continue continue
@ -1690,24 +1690,24 @@ class ComposedBase(Discriminable):
) )
) )
if cls._composed_schemas['allOf']: if hasattr(cls, '_all_of'):
other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm) other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm)
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['oneOf']: if hasattr(cls, '_one_of'):
other_path_to_schemas = cls.__get_oneof_class( other_path_to_schemas = cls.__get_oneof_class(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['anyOf']: if hasattr(cls, '_any_of'):
other_path_to_schemas = cls.__get_anyof_classes( other_path_to_schemas = cls.__get_anyof_classes(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
not_cls = cls._composed_schemas['not'] not_cls = getattr(cls, '_not', None)
if not_cls: if not_cls:
other_path_to_schemas = None other_path_to_schemas = None
not_exception = ApiValueError( not_exception = ApiValueError(
@ -2001,27 +2001,10 @@ class BinarySchema(
BinaryBase, BinaryBase,
Schema, Schema,
): ):
_one_of = [
@classmethod BytesSchema,
@property FileSchema,
def _composed_schemas(cls): ]
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return {
'allOf': [],
'oneOf': [
BytesSchema,
FileSchema,
],
'anyOf': [
],
'not': None
}
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]): def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
return super().__new__(cls, arg) return super().__new__(cls, arg)

View File

@ -32,10 +32,12 @@ class AnyTypeNotString(
Do not edit the class manually. Do not edit the class manually.
""" """
not_schema = schemas.StrSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +45,9 @@ class AnyTypeNotString(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.StrSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,33 @@ class Cat(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
declawed = schemas.BoolSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
declawed: typing.Union[declawed, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
declawed=declawed,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,40 +66,10 @@ class Cat(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
Animal,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
declawed = schemas.BoolSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
declawed: typing.Union[declawed, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
declawed=declawed,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
Animal,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,33 @@ class ChildCat(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
name = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
name: typing.Union[name, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
name=name,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,40 +66,10 @@ class ChildCat(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
ParentPet,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
name = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
name: typing.Union[name, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
name=name,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
ParentPet,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,47 @@ class ComplexQuadrilateral(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
class quadrilateralType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"ComplexQuadrilateral": "COMPLEX_QUADRILATERAL",
}
),
schemas.StrSchema
):
@classmethod
@property
def COMPLEX_QUADRILATERAL(cls):
return cls("ComplexQuadrilateral")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
quadrilateralType: typing.Union[quadrilateralType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
quadrilateralType=quadrilateralType,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,54 +80,10 @@ class ComplexQuadrilateral(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
QuadrilateralInterface,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
class quadrilateralType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"ComplexQuadrilateral": "COMPLEX_QUADRILATERAL",
}
),
schemas.StrSchema
):
@classmethod
@property
def COMPLEX_QUADRILATERAL(cls):
return cls("ComplexQuadrilateral")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
quadrilateralType: typing.Union[quadrilateralType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
quadrilateralType=quadrilateralType,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
QuadrilateralInterface,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,32 @@ class ComposedAnyOfDifferentTypesNoValidations(
Do not edit the class manually. Do not edit the class manually.
""" """
any_of_0 = schemas.DictSchema
any_of_1 = schemas.DateSchema
any_of_2 = schemas.DateTimeSchema
any_of_3 = schemas.BinarySchema
any_of_4 = schemas.StrSchema
any_of_5 = schemas.StrSchema
any_of_6 = schemas.DictSchema
any_of_7 = schemas.BoolSchema
any_of_8 = schemas.NoneSchema
class any_of_9(
schemas.ListSchema
):
_items = schemas.AnyTypeSchema
any_of_10 = schemas.NumberSchema
any_of_11 = schemas.Float32Schema
any_of_12 = schemas.Float64Schema
any_of_13 = schemas.IntSchema
any_of_14 = schemas.Int32Schema
any_of_15 = schemas.Int64Schema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,53 +65,24 @@ class ComposedAnyOfDifferentTypesNoValidations(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
any_of_0 = schemas.DictSchema return [
any_of_1 = schemas.DateSchema cls.any_of_0,
any_of_2 = schemas.DateTimeSchema cls.any_of_1,
any_of_3 = schemas.BinarySchema cls.any_of_2,
any_of_4 = schemas.StrSchema cls.any_of_3,
any_of_5 = schemas.StrSchema cls.any_of_4,
any_of_6 = schemas.DictSchema cls.any_of_5,
any_of_7 = schemas.BoolSchema cls.any_of_6,
any_of_8 = schemas.NoneSchema cls.any_of_7,
cls.any_of_8,
cls.any_of_9,
class any_of_9( cls.any_of_10,
schemas.ListSchema cls.any_of_11,
): cls.any_of_12,
_items = schemas.AnyTypeSchema cls.any_of_13,
any_of_10 = schemas.NumberSchema cls.any_of_14,
any_of_11 = schemas.Float32Schema cls.any_of_15,
any_of_12 = schemas.Float64Schema ]
any_of_13 = schemas.IntSchema
any_of_14 = schemas.Int32Schema
any_of_15 = schemas.Int64Schema
return {
'allOf': [
],
'oneOf': [
],
'anyOf': [
any_of_0,
any_of_1,
any_of_2,
any_of_3,
any_of_4,
any_of_5,
any_of_6,
any_of_7,
any_of_8,
any_of_9,
any_of_10,
any_of_11,
any_of_12,
any_of_13,
any_of_14,
any_of_15,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,12 @@ class ComposedBool(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +46,9 @@ class ComposedBool(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,12 @@ class ComposedNone(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +46,9 @@ class ComposedNone(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,12 @@ class ComposedNumber(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +46,9 @@ class ComposedNumber(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,12 @@ class ComposedObject(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +46,9 @@ class ComposedObject(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -34,10 +34,51 @@ class ComposedOneOfDifferentTypes(
this is a model that allows payloads of type object or number this is a model that allows payloads of type object or number
""" """
one_of_2 = schemas.NoneSchema
one_of_3 = schemas.DateSchema
class one_of_4(
schemas.DictSchema
):
_max_properties=4
_min_properties=4
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_4':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_5(
schemas.ListSchema
):
_max_items=4
_min_items=4
_items = schemas.AnyTypeSchema
class one_of_6(
schemas.DateTimeSchema
):
_regex=[{
'pattern': r'^2020.*', # noqa: E501
}]
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -45,63 +86,15 @@ class ComposedOneOfDifferentTypes(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_2 = schemas.NoneSchema return [
one_of_3 = schemas.DateSchema NumberWithValidations,
Animal,
cls.one_of_2,
class one_of_4( cls.one_of_3,
schemas.DictSchema cls.one_of_4,
): cls.one_of_5,
_max_properties=4 cls.one_of_6,
_min_properties=4 ]
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'one_of_4':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
class one_of_5(
schemas.ListSchema
):
_max_items=4
_min_items=4
_items = schemas.AnyTypeSchema
class one_of_6(
schemas.DateTimeSchema
):
_regex=[{
'pattern': r'^2020.*', # noqa: E501
}]
pass
return {
'allOf': [
],
'oneOf': [
NumberWithValidations,
Animal,
one_of_2,
one_of_3,
one_of_4,
one_of_5,
one_of_6,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,12 @@ class ComposedString(
Do not edit the class manually. Do not edit the class manually.
""" """
all_of_0 = schemas.AnyTypeSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +46,9 @@ class ComposedString(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
all_of_0 = schemas.AnyTypeSchema return [
return { cls.all_of_0,
'allOf': [ ]
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,33 @@ class Dog(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
breed = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
breed: typing.Union[breed, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
breed=breed,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,40 +66,10 @@ class Dog(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
Animal,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
breed = schemas.StrSchema
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
breed: typing.Union[breed, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
breed=breed,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
Animal,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,47 @@ class EquilateralTriangle(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"EquilateralTriangle": "EQUILATERAL_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def EQUILATERAL_TRIANGLE(cls):
return cls("EquilateralTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,54 +80,10 @@ class EquilateralTriangle(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
TriangleInterface,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"EquilateralTriangle": "EQUILATERAL_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def EQUILATERAL_TRIANGLE(cls):
return cls("EquilateralTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
TriangleInterface,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,11 @@ class Fruit(
""" """
color = schemas.StrSchema color = schemas.StrSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +45,10 @@ class Fruit(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ Apple,
], Banana,
'oneOf': [ ]
Apple,
Banana,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,12 @@ class FruitReq(
Do not edit the class manually. Do not edit the class manually.
""" """
one_of_0 = schemas.NoneSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,20 +45,11 @@ class FruitReq(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_0 = schemas.NoneSchema return [
return { cls.one_of_0,
'allOf': [ AppleReq,
], BananaReq,
'oneOf': [ ]
one_of_0,
AppleReq,
BananaReq,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -33,10 +33,11 @@ class GmFruit(
""" """
color = schemas.StrSchema color = schemas.StrSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _any_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -44,18 +45,10 @@ class GmFruit(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ Apple,
], Banana,
'oneOf': [ ]
],
'anyOf': [
Apple,
Banana,
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,47 @@ class IsoscelesTriangle(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"IsoscelesTriangle": "ISOSCELES_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def ISOSCELES_TRIANGLE(cls):
return cls("IsoscelesTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,54 +80,10 @@ class IsoscelesTriangle(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
TriangleInterface,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"IsoscelesTriangle": "ISOSCELES_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def ISOSCELES_TRIANGLE(cls):
return cls("IsoscelesTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
TriangleInterface,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -43,10 +43,11 @@ class Mammal(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -54,19 +55,11 @@ class Mammal(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ Whale,
], Zebra,
'oneOf': [ Pig,
Whale, ]
Zebra,
Pig,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -34,10 +34,12 @@ class NullableShape(
The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0) The value may be a shape or the 'null' value. For a composed schema to validate a null payload, one of its chosen oneOf schemas must be type null or nullable (introduced in OAS schema >= 3.0)
""" """
one_of_2 = schemas.NoneSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -45,20 +47,11 @@ class NullableShape(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_2 = schemas.NoneSchema return [
return { Triangle,
'allOf': [ Quadrilateral,
], cls.one_of_2,
'oneOf': [ ]
Triangle,
Quadrilateral,
one_of_2,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -37,10 +37,18 @@ class ObjectWithInlineCompositionProperty(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -48,24 +56,9 @@ class ObjectWithInlineCompositionProperty(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -42,10 +42,11 @@ class ParentPet(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -53,17 +54,9 @@ class ParentPet(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ GrandparentAnimal,
GrandparentAnimal, ]
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -42,10 +42,11 @@ class Pig(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -53,18 +54,10 @@ class Pig(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ BasquePig,
], DanishPig,
'oneOf': [ ]
BasquePig,
DanishPig,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -42,10 +42,11 @@ class Quadrilateral(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -53,18 +54,10 @@ class Quadrilateral(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ SimpleQuadrilateral,
], ComplexQuadrilateral,
'oneOf': [ ]
SimpleQuadrilateral,
ComplexQuadrilateral,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,47 @@ class ScaleneTriangle(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"ScaleneTriangle": "SCALENE_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def SCALENE_TRIANGLE(cls):
return cls("ScaleneTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,54 +80,10 @@ class ScaleneTriangle(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
TriangleInterface,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
class triangleType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"ScaleneTriangle": "SCALENE_TRIANGLE",
}
),
schemas.StrSchema
):
@classmethod
@property
def SCALENE_TRIANGLE(cls):
return cls("ScaleneTriangle")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
triangleType: typing.Union[triangleType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
triangleType=triangleType,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
TriangleInterface,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -42,10 +42,11 @@ class Shape(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -53,18 +54,10 @@ class Shape(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ Triangle,
], Quadrilateral,
'oneOf': [ ]
Triangle,
Quadrilateral,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -44,10 +44,12 @@ class ShapeOrNull(
} }
} }
one_of_0 = schemas.NoneSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -55,20 +57,11 @@ class ShapeOrNull(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
one_of_0 = schemas.NoneSchema return [
return { cls.one_of_0,
'allOf': [ Triangle,
], Quadrilateral,
'oneOf': [ ]
one_of_0,
Triangle,
Quadrilateral,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,47 @@ class SimpleQuadrilateral(
Do not edit the class manually. Do not edit the class manually.
""" """
class all_of_1(
schemas.DictSchema
):
class quadrilateralType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"SimpleQuadrilateral": "SIMPLE_QUADRILATERAL",
}
),
schemas.StrSchema
):
@classmethod
@property
def SIMPLE_QUADRILATERAL(cls):
return cls("SimpleQuadrilateral")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
quadrilateralType: typing.Union[quadrilateralType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
quadrilateralType=quadrilateralType,
_configuration=_configuration,
**kwargs,
)
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,54 +80,10 @@ class SimpleQuadrilateral(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
QuadrilateralInterface,
class all_of_1( cls.all_of_1,
schemas.DictSchema ]
):
class quadrilateralType(
schemas.SchemaEnumMakerClsFactory(
enum_value_to_name={
"SimpleQuadrilateral": "SIMPLE_QUADRILATERAL",
}
),
schemas.StrSchema
):
@classmethod
@property
def SIMPLE_QUADRILATERAL(cls):
return cls("SimpleQuadrilateral")
def __new__(
cls,
*args: typing.Union[dict, frozendict, ],
quadrilateralType: typing.Union[quadrilateralType, schemas.Unset] = schemas.unset,
_configuration: typing.Optional[schemas.Configuration] = None,
**kwargs: typing.Type[schemas.Schema],
) -> 'all_of_1':
return super().__new__(
cls,
*args,
quadrilateralType=quadrilateralType,
_configuration=_configuration,
**kwargs,
)
return {
'allOf': [
QuadrilateralInterface,
all_of_1,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -32,10 +32,11 @@ class SomeObject(
Do not edit the class manually. Do not edit the class manually.
""" """
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -43,17 +44,9 @@ class SomeObject(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ ObjectInterface,
ObjectInterface, ]
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -43,10 +43,11 @@ class Triangle(
} }
} }
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _one_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -54,19 +55,11 @@ class Triangle(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return { return [
'allOf': [ EquilateralTriangle,
], IsoscelesTriangle,
'oneOf': [ ScaleneTriangle,
EquilateralTriangle, ]
IsoscelesTriangle,
ScaleneTriangle,
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -68,10 +68,12 @@ class User(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
not_schema = schemas.NoneSchema
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _not(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -79,17 +81,9 @@ class User(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
not_schema = schemas.NoneSchema return (
return { cls.not_schema
'allOf': [ )
],
'oneOf': [
],
'anyOf': [
],
'not':
not_schema
}
def __new__( def __new__(
cls, cls,

View File

@ -30,10 +30,18 @@ class CompositionAtRootSchema(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -41,24 +49,9 @@ class CompositionAtRootSchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,
@ -83,10 +76,18 @@ class CompositionInPropertySchema(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -94,24 +95,9 @@ class CompositionInPropertySchema(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,
@ -179,10 +165,18 @@ class SchemaForRequestBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -190,24 +184,9 @@ class SchemaForRequestBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,
@ -232,10 +211,18 @@ class SchemaForRequestBodyMultipartFormData(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -243,24 +230,9 @@ class SchemaForRequestBodyMultipartFormData(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,
@ -306,10 +278,18 @@ class SchemaFor200ResponseBodyApplicationJson(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -317,24 +297,9 @@ class SchemaFor200ResponseBodyApplicationJson(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,
@ -359,10 +324,18 @@ class SchemaFor200ResponseBodyMultipartFormData(
schemas.ComposedSchema, schemas.ComposedSchema,
): ):
class all_of_0(
schemas.StrSchema
):
_min_length=1
pass
@classmethod @classmethod
@property @property
@functools.cache @functools.cache
def _composed_schemas(cls): def _all_of(cls):
# we need this here to make our import statements work # we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run # we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class # when we invoke this method. If we kept this at the class
@ -370,24 +343,9 @@ class SchemaFor200ResponseBodyMultipartFormData(
# code would be run when this module is imported, and these composed # code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished # classes don't exist yet because their module has not finished
# loading # loading
return [
cls.all_of_0,
class all_of_0( ]
schemas.StrSchema
):
_min_length=1
pass
return {
'allOf': [
all_of_0,
],
'oneOf': [
],
'anyOf': [
],
'not':
None
}
def __new__( def __new__(
cls, cls,

View File

@ -949,20 +949,20 @@ class Discriminable:
discriminated_cls = disc[disc_property_name].get(disc_payload_value) discriminated_cls = disc[disc_property_name].get(disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
elif not hasattr(cls, '_composed_schemas'): elif not (hasattr(cls, '_all_of') or hasattr(cls, '_one_of') or hasattr(cls, '_any_of')):
return None return None
# TODO stop traveling if a cycle is hit # TODO stop traveling if a cycle is hit
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in getattr(cls, '_all_of', []):
discriminated_cls = allof_cls._get_discriminated_class( discriminated_cls = allof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in getattr(cls, '_one_of', []):
discriminated_cls = oneof_cls._get_discriminated_class( discriminated_cls = oneof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
return discriminated_cls return discriminated_cls
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in getattr(cls, '_any_of', []):
discriminated_cls = anyof_cls._get_discriminated_class( discriminated_cls = anyof_cls._get_discriminated_class(
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
if discriminated_cls is not None: if discriminated_cls is not None:
@ -1567,7 +1567,7 @@ class ComposedBase(Discriminable):
@classmethod @classmethod
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata): def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for allof_cls in cls._composed_schemas['allOf']: for allof_cls in cls._all_of:
if validation_metadata.validation_ran_earlier(allof_cls): if validation_metadata.validation_ran_earlier(allof_cls):
continue continue
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata) other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
@ -1583,7 +1583,7 @@ class ComposedBase(Discriminable):
): ):
oneof_classes = [] oneof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for oneof_cls in cls._composed_schemas['oneOf']: for oneof_cls in cls._one_of:
if oneof_cls in path_to_schemas[validation_metadata.path_to_item]: if oneof_cls in path_to_schemas[validation_metadata.path_to_item]:
oneof_classes.append(oneof_cls) oneof_classes.append(oneof_cls)
continue continue
@ -1618,7 +1618,7 @@ class ComposedBase(Discriminable):
): ):
anyof_classes = [] anyof_classes = []
path_to_schemas = defaultdict(set) path_to_schemas = defaultdict(set)
for anyof_cls in cls._composed_schemas['anyOf']: for anyof_cls in cls._any_of:
if validation_metadata.validation_ran_earlier(anyof_cls): if validation_metadata.validation_ran_earlier(anyof_cls):
anyof_classes.append(anyof_cls) anyof_classes.append(anyof_cls)
continue continue
@ -1690,24 +1690,24 @@ class ComposedBase(Discriminable):
) )
) )
if cls._composed_schemas['allOf']: if hasattr(cls, '_all_of'):
other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm) other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm)
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['oneOf']: if hasattr(cls, '_one_of'):
other_path_to_schemas = cls.__get_oneof_class( other_path_to_schemas = cls.__get_oneof_class(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
if cls._composed_schemas['anyOf']: if hasattr(cls, '_any_of'):
other_path_to_schemas = cls.__get_anyof_classes( other_path_to_schemas = cls.__get_anyof_classes(
arg, arg,
discriminated_cls=discriminated_cls, discriminated_cls=discriminated_cls,
validation_metadata=updated_vm validation_metadata=updated_vm
) )
update(path_to_schemas, other_path_to_schemas) update(path_to_schemas, other_path_to_schemas)
not_cls = cls._composed_schemas['not'] not_cls = getattr(cls, '_not', None)
if not_cls: if not_cls:
other_path_to_schemas = None other_path_to_schemas = None
not_exception = ApiValueError( not_exception = ApiValueError(
@ -2001,27 +2001,10 @@ class BinarySchema(
BinaryBase, BinaryBase,
Schema, Schema,
): ):
_one_of = [
@classmethod BytesSchema,
@property FileSchema,
def _composed_schemas(cls): ]
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return {
'allOf': [],
'oneOf': [
BytesSchema,
FileSchema,
],
'anyOf': [
],
'not': None
}
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]): def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
return super().__new__(cls, arg) return super().__new__(cls, arg)

View File

@ -42,7 +42,7 @@ class TestAnimal(unittest.TestCase):
assert isinstance(animal, Animal) assert isinstance(animal, Animal)
assert isinstance(animal, frozendict) assert isinstance(animal, frozendict)
assert isinstance(animal, Cat) assert isinstance(animal, Cat)
assert isinstance(animal, Cat._composed_schemas['allOf'][1]) assert isinstance(animal, Cat._all_of[1])
assert set(animal.keys()) == {'className', 'color'} assert set(animal.keys()) == {'className', 'color'}
assert animal.className == 'Cat' assert animal.className == 'Cat'
assert animal.color == 'black' assert animal.color == 'black'
@ -54,7 +54,7 @@ class TestAnimal(unittest.TestCase):
assert isinstance(animal, Animal) assert isinstance(animal, Animal)
assert isinstance(animal, frozendict) assert isinstance(animal, frozendict)
assert isinstance(animal, Cat) assert isinstance(animal, Cat)
assert isinstance(animal, Cat._composed_schemas['allOf'][1]) assert isinstance(animal, Cat._all_of[1])
assert set(animal.keys()) == {'className', 'color', 'declawed'} assert set(animal.keys()) == {'className', 'color', 'declawed'}
assert animal.className == 'Cat' assert animal.className == 'Cat'
assert animal.color == 'black' assert animal.color == 'black'
@ -68,7 +68,7 @@ class TestAnimal(unittest.TestCase):
assert isinstance(animal, Animal) assert isinstance(animal, Animal)
assert isinstance(animal, frozendict) assert isinstance(animal, frozendict)
assert isinstance(animal, Dog) assert isinstance(animal, Dog)
assert isinstance(animal, Dog._composed_schemas['allOf'][1]) assert isinstance(animal, Dog._all_of[1])
assert set(animal.keys()) == {'className', 'color'} assert set(animal.keys()) == {'className', 'color'}
assert animal.className == 'Dog' assert animal.className == 'Dog'
assert animal.color == 'black' assert animal.color == 'black'
@ -80,7 +80,7 @@ class TestAnimal(unittest.TestCase):
assert isinstance(animal, Animal) assert isinstance(animal, Animal)
assert isinstance(animal, frozendict) assert isinstance(animal, frozendict)
assert isinstance(animal, Dog) assert isinstance(animal, Dog)
assert isinstance(animal, Dog._composed_schemas['allOf'][1]) assert isinstance(animal, Dog._all_of[1])
assert set(animal.keys()) == {'className', 'color', 'breed'} assert set(animal.keys()) == {'className', 'color', 'breed'}
assert animal.className == 'Dog' assert animal.className == 'Dog'
assert animal.color == 'black' assert animal.color == 'black'

View File

@ -38,20 +38,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testDictSchema(self): def testDictSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): DictSchema,
return { ]
'allOf': [
AnyTypeSchema,
DictSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model(a=1, b='hi') m = Model(a=1, b='hi')
assert isinstance(m, Model) assert isinstance(m, Model)
@ -63,20 +53,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testListSchema(self): def testListSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): ListSchema,
return { ]
'allOf': [
AnyTypeSchema,
ListSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model([1, 'hi']) m = Model([1, 'hi'])
assert isinstance(m, Model) assert isinstance(m, Model)
@ -88,20 +68,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testStrSchema(self): def testStrSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): StrSchema,
return { ]
'allOf': [
AnyTypeSchema,
StrSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model('hi') m = Model('hi')
assert isinstance(m, Model) assert isinstance(m, Model)
@ -113,20 +83,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testNumberSchema(self): def testNumberSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): NumberSchema,
return { ]
'allOf': [
AnyTypeSchema,
NumberSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model(1) m = Model(1)
assert isinstance(m, Model) assert isinstance(m, Model)
@ -145,20 +105,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testIntSchema(self): def testIntSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): IntSchema,
return { ]
'allOf': [
AnyTypeSchema,
IntSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model(1) m = Model(1)
assert isinstance(m, Model) assert isinstance(m, Model)
@ -174,20 +124,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testBoolSchema(self): def testBoolSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): BoolSchema,
return { ]
'allOf': [
AnyTypeSchema,
BoolSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model(True) m = Model(True)
assert isinstance(m, Model) assert isinstance(m, Model)
@ -206,20 +146,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testNoneSchema(self): def testNoneSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): NoneSchema,
return { ]
'allOf': [
AnyTypeSchema,
NoneSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model(None) m = Model(None)
assert isinstance(m, Model) assert isinstance(m, Model)
@ -231,20 +161,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testDateSchema(self): def testDateSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): DateSchema,
return { ]
'allOf': [
AnyTypeSchema,
DateSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model('1970-01-01') m = Model('1970-01-01')
assert isinstance(m, Model) assert isinstance(m, Model)
@ -256,20 +176,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testDateTimeSchema(self): def testDateTimeSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): DateTimeSchema,
return { ]
'allOf': [
AnyTypeSchema,
DateTimeSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model('2020-01-01T00:00:00') m = Model('2020-01-01T00:00:00')
assert isinstance(m, Model) assert isinstance(m, Model)
@ -281,20 +191,10 @@ class TestAnyTypeSchema(unittest.TestCase):
def testDecimalSchema(self): def testDecimalSchema(self):
class Model(ComposedSchema): class Model(ComposedSchema):
@classmethod _all_of = [
@property AnyTypeSchema,
def _composed_schemas(cls): DecimalSchema,
return { ]
'allOf': [
AnyTypeSchema,
DecimalSchema,
],
'oneOf': [
],
'anyOf': [
],
'not': None
}
m = Model('12.34') m = Model('12.34')
assert isinstance(m, Model) assert isinstance(m, Model)

View File

@ -84,16 +84,11 @@ class TestFruit(unittest.TestCase):
# make sure that the ModelComposed class properties are correct # make sure that the ModelComposed class properties are correct
# model._composed_schemas stores the anyOf/allOf/oneOf info # model._composed_schemas stores the anyOf/allOf/oneOf info
self.assertEqual( self.assertEqual(
fruit._composed_schemas, fruit._one_of,
{ [
'anyOf': [], apple.Apple,
'allOf': [], banana.Banana,
'oneOf': [ ],
apple.Apple,
banana.Banana,
],
'not': None
}
) )
""" """

View File

@ -69,17 +69,12 @@ class TestFruitReq(unittest.TestCase):
# make sure that the ModelComposed class properties are correct # make sure that the ModelComposed class properties are correct
# model._composed_schemas stores the anyOf/allOf/oneOf info # model._composed_schemas stores the anyOf/allOf/oneOf info
self.assertEqual( self.assertEqual(
fruit._composed_schemas, fruit._one_of,
{ [
'anyOf': [], NoneSchema,
'allOf': [], apple_req.AppleReq,
'oneOf': [ banana_req.BananaReq,
NoneSchema, ],
apple_req.AppleReq,
banana_req.BananaReq,
],
'not': None
}
) )
# including extra parameters raises an exception # including extra parameters raises an exception

View File

@ -66,16 +66,11 @@ class TestGmFruit(unittest.TestCase):
# make sure that the ModelComposed class properties are correct # make sure that the ModelComposed class properties are correct
# model._composed_schemas stores the anyOf/allOf/oneOf info # model._composed_schemas stores the anyOf/allOf/oneOf info
self.assertEqual( self.assertEqual(
fruit._composed_schemas, fruit._any_of,
{ [
'anyOf': [ apple.Apple,
apple.Apple, banana.Banana,
banana.Banana, ],
],
'allOf': [],
'oneOf': [],
'not': None
}
) )
# including extra parameters works # including extra parameters works

View File

@ -100,7 +100,7 @@ class TestValidateResults(unittest.TestCase):
frozendict(className="Dog", color="black"), validation_metadata=vm frozendict(className="Dog", color="black"), validation_metadata=vm
) )
assert path_to_schemas == { assert path_to_schemas == {
("args[0]",): set([Animal, Dog, Dog._composed_schemas['allOf'][1], frozendict]), ("args[0]",): set([Animal, Dog, Dog._all_of[1], frozendict]),
("args[0]", "className"): set([StrSchema, AnyTypeSchema, str]), ("args[0]", "className"): set([StrSchema, AnyTypeSchema, str]),
("args[0]", "color"): set([StrSchema, AnyTypeSchema, str]), ("args[0]", "color"): set([StrSchema, AnyTypeSchema, str]),
} }