forked from loafle/openapi-generator-original
[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:
parent
fac576a2bf
commit
d6fb08d837
@ -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
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -9,82 +34,101 @@ def _composed_schemas(cls):
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
{{#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}}
|
||||
return {
|
||||
'allOf': [
|
||||
{{#with composedSchemas}}
|
||||
return [
|
||||
{{#each allOf}}
|
||||
{{#if complexType}}
|
||||
{{complexType}},
|
||||
{{else}}
|
||||
{{#if nameInSnakeCase}}
|
||||
{{name}},
|
||||
cls.{{name}},
|
||||
{{else}}
|
||||
{{baseName}},
|
||||
cls.{{baseName}},
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/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}}
|
||||
{{#if complexType}}
|
||||
{{complexType}},
|
||||
{{else}}
|
||||
{{#if nameInSnakeCase}}
|
||||
{{name}},
|
||||
cls.{{name}},
|
||||
{{else}}
|
||||
{{baseName}},
|
||||
cls.{{baseName}},
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/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}}
|
||||
{{#if complexType}}
|
||||
{{complexType}},
|
||||
{{else}}
|
||||
{{#if nameInSnakeCase}}
|
||||
{{name}},
|
||||
cls.{{name}},
|
||||
{{else}}
|
||||
{{baseName}},
|
||||
cls.{{baseName}},
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/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}}
|
||||
{{#if complexType}}
|
||||
{{complexType}}
|
||||
{{else}}
|
||||
{{#if nameInSnakeCase}}
|
||||
{{name}}
|
||||
cls.{{name}}
|
||||
{{else}}
|
||||
{{baseName}}
|
||||
cls.{{baseName}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
None
|
||||
{{/with}}
|
||||
)
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
}
|
||||
|
@ -942,20 +942,20 @@ class Discriminable:
|
||||
discriminated_cls = disc[disc_property_name].get(disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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
|
||||
# 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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
@ -1560,7 +1560,7 @@ class ComposedBase(Discriminable):
|
||||
@classmethod
|
||||
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
|
||||
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):
|
||||
continue
|
||||
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
|
||||
@ -1576,7 +1576,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
oneof_classes = []
|
||||
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]:
|
||||
oneof_classes.append(oneof_cls)
|
||||
continue
|
||||
@ -1611,7 +1611,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
anyof_classes = []
|
||||
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):
|
||||
anyof_classes.append(anyof_cls)
|
||||
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)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
update(path_to_schemas, other_path_to_schemas)
|
||||
not_cls = cls._composed_schemas['not']
|
||||
not_cls = getattr(cls, '_not', None)
|
||||
if not_cls:
|
||||
other_path_to_schemas = None
|
||||
not_exception = ApiValueError(
|
||||
@ -1994,27 +1994,10 @@ class BinarySchema(
|
||||
BinaryBase,
|
||||
Schema,
|
||||
):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
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': [
|
||||
_one_of = [
|
||||
BytesSchema,
|
||||
FileSchema,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
|
||||
return super().__new__(cls, arg)
|
||||
|
@ -33,17 +33,6 @@ class AdditionalpropertiesShouldNotLookInApplicators(
|
||||
"""
|
||||
_additional_properties = schemas.BoolSchema
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -65,17 +54,21 @@ class AdditionalpropertiesShouldNotLookInApplicators(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -32,17 +32,6 @@ class Allof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -91,18 +80,22 @@ class Allof(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class AllofCombinedWithAnyofOneof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -100,19 +89,51 @@ class AllofCombinedWithAnyofOneof(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
]
|
||||
|
||||
@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,
|
||||
]
|
||||
|
||||
@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,
|
||||
|
@ -32,17 +32,6 @@ class AllofSimpleTypes(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -81,18 +70,22 @@ class AllofSimpleTypes(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -36,17 +36,6 @@ class AllofWithBaseSchema(
|
||||
}
|
||||
bar = schemas.IntSchema
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -95,18 +84,22 @@ class AllofWithBaseSchema(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,12 @@ class AllofWithOneEmptySchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,18 +45,9 @@ class AllofWithOneEmptySchema(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,13 @@ class AllofWithTheFirstEmptySchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
all_of_1 = schemas.NumberSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +46,10 @@ class AllofWithTheFirstEmptySchema(
|
||||
# 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.AnyTypeSchema
|
||||
all_of_1 = schemas.NumberSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,13 @@ class AllofWithTheLastEmptySchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.NumberSchema
|
||||
all_of_1 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +46,10 @@ class AllofWithTheLastEmptySchema(
|
||||
# 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.NumberSchema
|
||||
all_of_1 = schemas.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,13 @@ class AllofWithTwoEmptySchemas(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
all_of_1 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +46,10 @@ class AllofWithTwoEmptySchemas(
|
||||
# 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.AnyTypeSchema
|
||||
all_of_1 = schemas.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class Anyof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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.IntSchema
|
||||
|
||||
|
||||
@ -63,18 +52,22 @@ class Anyof(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
any_of_1,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.any_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class AnyofComplexTypes(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class any_of_0(
|
||||
@ -91,18 +80,22 @@ class AnyofComplexTypes(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
any_of_1,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.any_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,17 +33,6 @@ class AnyofWithBaseSchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class any_of_0(
|
||||
@ -82,18 +71,22 @@ class AnyofWithBaseSchema(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
any_of_1,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.any_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,13 @@ class AnyofWithOneEmptySchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
any_of_0 = schemas.NumberSchema
|
||||
any_of_1 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +46,10 @@ class AnyofWithOneEmptySchema(
|
||||
# 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.NumberSchema
|
||||
any_of_1 = schemas.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
any_of_1,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.any_of_0,
|
||||
cls.any_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -37,10 +37,12 @@ class ForbiddenProperty(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
not_schema = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -48,17 +50,9 @@ class ForbiddenProperty(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,12 @@ class ModelNot(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
not_schema = schemas.IntSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +45,9 @@ class ModelNot(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.IntSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,27 +32,18 @@ class NestedAllofToCheckValidationSemantics(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
all_of_0 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -60,18 +51,9 @@ class NestedAllofToCheckValidationSemantics(
|
||||
# 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
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
@ -85,17 +67,21 @@ class NestedAllofToCheckValidationSemantics(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -32,27 +32,18 @@ class NestedAnyofToCheckValidationSemantics(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class any_of_0(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
any_of_0 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -60,18 +51,9 @@ class NestedAnyofToCheckValidationSemantics(
|
||||
# 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
|
||||
}
|
||||
return [
|
||||
cls.any_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
@ -85,17 +67,21 @@ class NestedAnyofToCheckValidationSemantics(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
any_of_0,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -32,27 +32,18 @@ class NestedOneofToCheckValidationSemantics(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class one_of_0(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
one_of_0 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -60,18 +51,9 @@ class NestedOneofToCheckValidationSemantics(
|
||||
# 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
|
||||
}
|
||||
return [
|
||||
cls.one_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
@ -85,17 +67,21 @@ class NestedOneofToCheckValidationSemantics(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -32,17 +32,6 @@ class NotMoreComplexSchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class not_schema(
|
||||
@ -65,16 +54,21 @@ class NotMoreComplexSchema(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
|
||||
@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 (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class Oneof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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.IntSchema
|
||||
|
||||
|
||||
@ -63,18 +52,22 @@ class Oneof(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
one_of_1,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.one_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class OneofComplexTypes(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class one_of_0(
|
||||
@ -91,18 +80,22 @@ class OneofComplexTypes(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
one_of_1,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.one_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,17 +33,6 @@ class OneofWithBaseSchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class one_of_0(
|
||||
@ -82,18 +71,22 @@ class OneofWithBaseSchema(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
one_of_1,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.one_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,13 @@ class OneofWithEmptySchema(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
one_of_0 = schemas.NumberSchema
|
||||
one_of_1 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +46,10 @@ class OneofWithEmptySchema(
|
||||
# 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.NumberSchema
|
||||
one_of_1 = schemas.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
one_of_1,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.one_of_0,
|
||||
cls.one_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,17 +33,6 @@ class OneofWithRequired(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class one_of_0(
|
||||
@ -88,18 +77,22 @@ class OneofWithRequired(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
one_of_0,
|
||||
one_of_1,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.one_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class RefInAllof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +44,9 @@ class RefInAllof(
|
||||
# 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': [
|
||||
return [
|
||||
PropertyNamedRefThatIsNotAReference,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class RefInAnyof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +44,9 @@ class RefInAnyof(
|
||||
# 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': [
|
||||
],
|
||||
'anyOf': [
|
||||
return [
|
||||
PropertyNamedRefThatIsNotAReference,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class RefInNot(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,16 +44,9 @@ class RefInNot(
|
||||
# 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': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
return (
|
||||
PropertyNamedRefThatIsNotAReference
|
||||
}
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class RefInOneof(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +44,9 @@ class RefInOneof(
|
||||
# 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': [
|
||||
return [
|
||||
PropertyNamedRefThatIsNotAReference,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -30,17 +30,6 @@ class SchemaForRequestBodyApplicationJson(
|
||||
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
|
||||
|
||||
|
||||
class not_schema(
|
||||
@ -63,16 +52,21 @@ class SchemaForRequestBodyApplicationJson(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
|
||||
@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 (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -30,10 +30,12 @@ class SchemaForRequestBodyApplicationJson(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
not_schema = schemas.IntSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -41,17 +43,9 @@ class SchemaForRequestBodyApplicationJson(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.IntSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class SchemaForRequestBodyApplicationJson(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,16 +44,9 @@ class SchemaForRequestBodyApplicationJson(
|
||||
# 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': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
return (
|
||||
PropertyNamedRefThatIsNotAReference
|
||||
}
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -29,17 +29,6 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
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
|
||||
|
||||
|
||||
class not_schema(
|
||||
@ -62,16 +51,21 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
|
||||
@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 (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -29,10 +29,12 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
not_schema = schemas.IntSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -40,17 +42,9 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.IntSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -31,10 +31,11 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -42,16 +43,9 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
# 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': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
return (
|
||||
PropertyNamedRefThatIsNotAReference
|
||||
}
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -949,20 +949,20 @@ class Discriminable:
|
||||
discriminated_cls = disc[disc_property_name].get(disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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
|
||||
# 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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
@ -1567,7 +1567,7 @@ class ComposedBase(Discriminable):
|
||||
@classmethod
|
||||
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
|
||||
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):
|
||||
continue
|
||||
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
|
||||
@ -1583,7 +1583,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
oneof_classes = []
|
||||
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]:
|
||||
oneof_classes.append(oneof_cls)
|
||||
continue
|
||||
@ -1618,7 +1618,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
anyof_classes = []
|
||||
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):
|
||||
anyof_classes.append(anyof_cls)
|
||||
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)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
update(path_to_schemas, other_path_to_schemas)
|
||||
not_cls = cls._composed_schemas['not']
|
||||
not_cls = getattr(cls, '_not', None)
|
||||
if not_cls:
|
||||
other_path_to_schemas = None
|
||||
not_exception = ApiValueError(
|
||||
@ -2001,27 +2001,10 @@ class BinarySchema(
|
||||
BinaryBase,
|
||||
Schema,
|
||||
):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
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': [
|
||||
_one_of = [
|
||||
BytesSchema,
|
||||
FileSchema,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
|
||||
return super().__new__(cls, arg)
|
||||
|
@ -32,10 +32,12 @@ class AnyTypeNotString(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
not_schema = schemas.StrSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +45,9 @@ class AnyTypeNotString(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.StrSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class Cat(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -65,18 +54,22 @@ class Cat(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
Animal,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class ChildCat(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -65,18 +54,22 @@ class ChildCat(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
ParentPet,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class ComplexQuadrilateral(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -79,18 +68,22 @@ class ComplexQuadrilateral(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
QuadrilateralInterface,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class ComposedAnyOfDifferentTypesNoValidations(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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.DictSchema
|
||||
any_of_1 = schemas.DateSchema
|
||||
any_of_2 = schemas.DateTimeSchema
|
||||
@ -64,32 +53,36 @@ class ComposedAnyOfDifferentTypesNoValidations(
|
||||
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
|
||||
}
|
||||
|
||||
@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,
|
||||
cls.any_of_1,
|
||||
cls.any_of_2,
|
||||
cls.any_of_3,
|
||||
cls.any_of_4,
|
||||
cls.any_of_5,
|
||||
cls.any_of_6,
|
||||
cls.any_of_7,
|
||||
cls.any_of_8,
|
||||
cls.any_of_9,
|
||||
cls.any_of_10,
|
||||
cls.any_of_11,
|
||||
cls.any_of_12,
|
||||
cls.any_of_13,
|
||||
cls.any_of_14,
|
||||
cls.any_of_15,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,12 @@ class ComposedBool(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +46,9 @@ class ComposedBool(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,12 @@ class ComposedNone(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +46,9 @@ class ComposedNone(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,12 @@ class ComposedNumber(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +46,9 @@ class ComposedNumber(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,12 @@ class ComposedObject(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +46,9 @@ class ComposedObject(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -34,17 +34,6 @@ class ComposedOneOfDifferentTypes(
|
||||
this is a model that allows payloads of type object or number
|
||||
"""
|
||||
|
||||
@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_2 = schemas.NoneSchema
|
||||
one_of_3 = schemas.DateSchema
|
||||
|
||||
@ -85,23 +74,27 @@ class ComposedOneOfDifferentTypes(
|
||||
'pattern': r'^2020.*', # noqa: E501
|
||||
}]
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'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 [
|
||||
NumberWithValidations,
|
||||
Animal,
|
||||
one_of_2,
|
||||
one_of_3,
|
||||
one_of_4,
|
||||
one_of_5,
|
||||
one_of_6,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.one_of_2,
|
||||
cls.one_of_3,
|
||||
cls.one_of_4,
|
||||
cls.one_of_5,
|
||||
cls.one_of_6,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,12 @@ class ComposedString(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
all_of_0 = schemas.AnyTypeSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +46,9 @@ class ComposedString(
|
||||
# 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.AnyTypeSchema
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
return [
|
||||
cls.all_of_0,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class Dog(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -65,18 +54,22 @@ class Dog(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
Animal,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class EquilateralTriangle(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -79,18 +68,22 @@ class EquilateralTriangle(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
TriangleInterface,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,11 @@ class Fruit(
|
||||
"""
|
||||
color = schemas.StrSchema
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +45,10 @@ class Fruit(
|
||||
# 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': [
|
||||
return [
|
||||
Apple,
|
||||
Banana,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,12 @@ class FruitReq(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
one_of_0 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,20 +45,11 @@ class FruitReq(
|
||||
# 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,
|
||||
return [
|
||||
cls.one_of_0,
|
||||
AppleReq,
|
||||
BananaReq,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -33,10 +33,11 @@ class GmFruit(
|
||||
"""
|
||||
color = schemas.StrSchema
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -44,18 +45,10 @@ class GmFruit(
|
||||
# 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': [
|
||||
],
|
||||
'anyOf': [
|
||||
return [
|
||||
Apple,
|
||||
Banana,
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class IsoscelesTriangle(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -79,18 +68,22 @@ class IsoscelesTriangle(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
TriangleInterface,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -43,10 +43,11 @@ class Mammal(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -54,19 +55,11 @@ class Mammal(
|
||||
# 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': [
|
||||
return [
|
||||
Whale,
|
||||
Zebra,
|
||||
Pig,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -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)
|
||||
"""
|
||||
|
||||
one_of_2 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -45,20 +47,11 @@ class NullableShape(
|
||||
# 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_2 = schemas.NoneSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
return [
|
||||
Triangle,
|
||||
Quadrilateral,
|
||||
one_of_2,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.one_of_2,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -37,17 +37,6 @@ class ObjectWithInlineCompositionProperty(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -55,17 +44,21 @@ class ObjectWithInlineCompositionProperty(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -42,10 +42,11 @@ class ParentPet(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -53,17 +54,9 @@ class ParentPet(
|
||||
# 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': [
|
||||
return [
|
||||
GrandparentAnimal,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -42,10 +42,11 @@ class Pig(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -53,18 +54,10 @@ class Pig(
|
||||
# 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': [
|
||||
return [
|
||||
BasquePig,
|
||||
DanishPig,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -42,10 +42,11 @@ class Quadrilateral(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -53,18 +54,10 @@ class Quadrilateral(
|
||||
# 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': [
|
||||
return [
|
||||
SimpleQuadrilateral,
|
||||
ComplexQuadrilateral,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class ScaleneTriangle(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -79,18 +68,22 @@ class ScaleneTriangle(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
TriangleInterface,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -42,10 +42,11 @@ class Shape(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -53,18 +54,10 @@ class Shape(
|
||||
# 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': [
|
||||
return [
|
||||
Triangle,
|
||||
Quadrilateral,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -44,10 +44,12 @@ class ShapeOrNull(
|
||||
}
|
||||
}
|
||||
|
||||
one_of_0 = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -55,20 +57,11 @@ class ShapeOrNull(
|
||||
# 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,
|
||||
return [
|
||||
cls.one_of_0,
|
||||
Triangle,
|
||||
Quadrilateral,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,17 +32,6 @@ class SimpleQuadrilateral(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class all_of_1(
|
||||
@ -79,18 +68,22 @@ class SimpleQuadrilateral(
|
||||
_configuration=_configuration,
|
||||
**kwargs,
|
||||
)
|
||||
return {
|
||||
'allOf': [
|
||||
|
||||
@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 [
|
||||
QuadrilateralInterface,
|
||||
all_of_1,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
cls.all_of_1,
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -32,10 +32,11 @@ class SomeObject(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -43,17 +44,9 @@ class SomeObject(
|
||||
# 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': [
|
||||
return [
|
||||
ObjectInterface,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -43,10 +43,11 @@ class Triangle(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -54,19 +55,11 @@ class Triangle(
|
||||
# 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': [
|
||||
return [
|
||||
EquilateralTriangle,
|
||||
IsoscelesTriangle,
|
||||
ScaleneTriangle,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -68,10 +68,12 @@ class User(
|
||||
schemas.ComposedSchema,
|
||||
):
|
||||
|
||||
not_schema = schemas.NoneSchema
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
@functools.cache
|
||||
def _composed_schemas(cls):
|
||||
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
|
||||
@ -79,17 +81,9 @@ class User(
|
||||
# code would be run when this module is imported, and these composed
|
||||
# classes don't exist yet because their module has not finished
|
||||
# loading
|
||||
not_schema = schemas.NoneSchema
|
||||
return {
|
||||
'allOf': [
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
not_schema
|
||||
}
|
||||
return (
|
||||
cls.not_schema
|
||||
)
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -30,17 +30,6 @@ class CompositionAtRootSchema(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -48,17 +37,21 @@ class CompositionAtRootSchema(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -83,17 +76,6 @@ class CompositionInPropertySchema(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -101,17 +83,21 @@ class CompositionInPropertySchema(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -179,17 +165,6 @@ class SchemaForRequestBodyApplicationJson(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -197,17 +172,21 @@ class SchemaForRequestBodyApplicationJson(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -232,17 +211,6 @@ class SchemaForRequestBodyMultipartFormData(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -250,17 +218,21 @@ class SchemaForRequestBodyMultipartFormData(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -306,17 +278,6 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -324,17 +285,21 @@ class SchemaFor200ResponseBodyApplicationJson(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -359,17 +324,6 @@ class SchemaFor200ResponseBodyMultipartFormData(
|
||||
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
|
||||
|
||||
|
||||
class all_of_0(
|
||||
@ -377,17 +331,21 @@ class SchemaFor200ResponseBodyMultipartFormData(
|
||||
):
|
||||
_min_length=1
|
||||
pass
|
||||
return {
|
||||
'allOf': [
|
||||
all_of_0,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not':
|
||||
None
|
||||
}
|
||||
|
||||
@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,
|
||||
|
@ -949,20 +949,20 @@ class Discriminable:
|
||||
discriminated_cls = disc[disc_property_name].get(disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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
|
||||
# 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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
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(
|
||||
disc_property_name=disc_property_name, disc_payload_value=disc_payload_value)
|
||||
if discriminated_cls is not None:
|
||||
@ -1567,7 +1567,7 @@ class ComposedBase(Discriminable):
|
||||
@classmethod
|
||||
def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata):
|
||||
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):
|
||||
continue
|
||||
other_path_to_schemas = allof_cls._validate(arg, validation_metadata=validation_metadata)
|
||||
@ -1583,7 +1583,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
oneof_classes = []
|
||||
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]:
|
||||
oneof_classes.append(oneof_cls)
|
||||
continue
|
||||
@ -1618,7 +1618,7 @@ class ComposedBase(Discriminable):
|
||||
):
|
||||
anyof_classes = []
|
||||
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):
|
||||
anyof_classes.append(anyof_cls)
|
||||
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)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
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(
|
||||
arg,
|
||||
discriminated_cls=discriminated_cls,
|
||||
validation_metadata=updated_vm
|
||||
)
|
||||
update(path_to_schemas, other_path_to_schemas)
|
||||
not_cls = cls._composed_schemas['not']
|
||||
not_cls = getattr(cls, '_not', None)
|
||||
if not_cls:
|
||||
other_path_to_schemas = None
|
||||
not_exception = ApiValueError(
|
||||
@ -2001,27 +2001,10 @@ class BinarySchema(
|
||||
BinaryBase,
|
||||
Schema,
|
||||
):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
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': [
|
||||
_one_of = [
|
||||
BytesSchema,
|
||||
FileSchema,
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: typing.Union[ValidationMetadata]):
|
||||
return super().__new__(cls, arg)
|
||||
|
@ -42,7 +42,7 @@ class TestAnimal(unittest.TestCase):
|
||||
assert isinstance(animal, Animal)
|
||||
assert isinstance(animal, frozendict)
|
||||
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 animal.className == 'Cat'
|
||||
assert animal.color == 'black'
|
||||
@ -54,7 +54,7 @@ class TestAnimal(unittest.TestCase):
|
||||
assert isinstance(animal, Animal)
|
||||
assert isinstance(animal, frozendict)
|
||||
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 animal.className == 'Cat'
|
||||
assert animal.color == 'black'
|
||||
@ -68,7 +68,7 @@ class TestAnimal(unittest.TestCase):
|
||||
assert isinstance(animal, Animal)
|
||||
assert isinstance(animal, frozendict)
|
||||
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 animal.className == 'Dog'
|
||||
assert animal.color == 'black'
|
||||
@ -80,7 +80,7 @@ class TestAnimal(unittest.TestCase):
|
||||
assert isinstance(animal, Animal)
|
||||
assert isinstance(animal, frozendict)
|
||||
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 animal.className == 'Dog'
|
||||
assert animal.color == 'black'
|
||||
|
@ -38,20 +38,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testDictSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
DictSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model(a=1, b='hi')
|
||||
assert isinstance(m, Model)
|
||||
@ -63,20 +53,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testListSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
ListSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model([1, 'hi'])
|
||||
assert isinstance(m, Model)
|
||||
@ -88,20 +68,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testStrSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
StrSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model('hi')
|
||||
assert isinstance(m, Model)
|
||||
@ -113,20 +83,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testNumberSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
NumberSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model(1)
|
||||
assert isinstance(m, Model)
|
||||
@ -145,20 +105,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testIntSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
IntSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model(1)
|
||||
assert isinstance(m, Model)
|
||||
@ -174,20 +124,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testBoolSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
BoolSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model(True)
|
||||
assert isinstance(m, Model)
|
||||
@ -206,20 +146,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testNoneSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
NoneSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model(None)
|
||||
assert isinstance(m, Model)
|
||||
@ -231,20 +161,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testDateSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
DateSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model('1970-01-01')
|
||||
assert isinstance(m, Model)
|
||||
@ -256,20 +176,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testDateTimeSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
DateTimeSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model('2020-01-01T00:00:00')
|
||||
assert isinstance(m, Model)
|
||||
@ -281,20 +191,10 @@ class TestAnyTypeSchema(unittest.TestCase):
|
||||
def testDecimalSchema(self):
|
||||
class Model(ComposedSchema):
|
||||
|
||||
@classmethod
|
||||
@property
|
||||
def _composed_schemas(cls):
|
||||
return {
|
||||
'allOf': [
|
||||
_all_of = [
|
||||
AnyTypeSchema,
|
||||
DecimalSchema,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
'anyOf': [
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
]
|
||||
|
||||
m = Model('12.34')
|
||||
assert isinstance(m, Model)
|
||||
|
@ -84,16 +84,11 @@ class TestFruit(unittest.TestCase):
|
||||
# make sure that the ModelComposed class properties are correct
|
||||
# model._composed_schemas stores the anyOf/allOf/oneOf info
|
||||
self.assertEqual(
|
||||
fruit._composed_schemas,
|
||||
{
|
||||
'anyOf': [],
|
||||
'allOf': [],
|
||||
'oneOf': [
|
||||
fruit._one_of,
|
||||
[
|
||||
apple.Apple,
|
||||
banana.Banana,
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
)
|
||||
|
||||
"""
|
||||
|
@ -69,17 +69,12 @@ class TestFruitReq(unittest.TestCase):
|
||||
# make sure that the ModelComposed class properties are correct
|
||||
# model._composed_schemas stores the anyOf/allOf/oneOf info
|
||||
self.assertEqual(
|
||||
fruit._composed_schemas,
|
||||
{
|
||||
'anyOf': [],
|
||||
'allOf': [],
|
||||
'oneOf': [
|
||||
fruit._one_of,
|
||||
[
|
||||
NoneSchema,
|
||||
apple_req.AppleReq,
|
||||
banana_req.BananaReq,
|
||||
],
|
||||
'not': None
|
||||
}
|
||||
)
|
||||
|
||||
# including extra parameters raises an exception
|
||||
|
@ -66,16 +66,11 @@ class TestGmFruit(unittest.TestCase):
|
||||
# make sure that the ModelComposed class properties are correct
|
||||
# model._composed_schemas stores the anyOf/allOf/oneOf info
|
||||
self.assertEqual(
|
||||
fruit._composed_schemas,
|
||||
{
|
||||
'anyOf': [
|
||||
fruit._any_of,
|
||||
[
|
||||
apple.Apple,
|
||||
banana.Banana,
|
||||
],
|
||||
'allOf': [],
|
||||
'oneOf': [],
|
||||
'not': None
|
||||
}
|
||||
)
|
||||
|
||||
# including extra parameters works
|
||||
|
@ -100,7 +100,7 @@ class TestValidateResults(unittest.TestCase):
|
||||
frozendict(className="Dog", color="black"), validation_metadata=vm
|
||||
)
|
||||
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]", "color"): set([StrSchema, AnyTypeSchema, str]),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user