diff --git a/modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/model/CodegenSchema.java b/modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/model/CodegenSchema.java index e1ee503fe626..c0049dee2f9f 100644 --- a/modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/model/CodegenSchema.java +++ b/modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/model/CodegenSchema.java @@ -19,6 +19,7 @@ import io.swagger.v3.oas.models.ExternalDocumentation; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -126,6 +127,68 @@ public CodegenSchema getSelfOrDeepestRef() { return refObject; } + /** + * Returns all schemas in post order traversal, used by templates to write schema classes + * @param schemas the input list that stores this and all required schemas + * @return the list that stores this and all required schemas + */ + private ArrayList getAllSchemas(ArrayList schemas, int level) { + /* + post order traversal using alphabetic json schema keywords as the order + keywords with schemas: + additionalProperties + allOf + anyOf + items + not + oneOf + properties + + excluded: + $ref (because it is an import) + */ + if (additionalProperties != null) { + additionalProperties.getAllSchemas(schemas, level + 1); + } + if (allOf != null) { + for (CodegenSchema someSchema: allOf) { + someSchema.getAllSchemas(schemas, level + 1); + } + } + if (anyOf != null) { + for (CodegenSchema someSchema: anyOf) { + someSchema.getAllSchemas(schemas, level + 1); + } + } + if (items != null) { + items.getAllSchemas(schemas, level + 1); + } + if (not != null) { + not.getAllSchemas(schemas, level + 1); + } + if (oneOf != null) { + for (CodegenSchema someSchema: oneOf) { + someSchema.getAllSchemas(schemas, level + 1); + } + } + if (properties != null) { + for (CodegenSchema someSchema: properties.values()) { + someSchema.getAllSchemas(schemas, level + 1); + } + } + if (refInfo != null && level > 0) { + // do not add ref to schemas + return schemas; + } + schemas.add(this); + return schemas; + } + + public ArrayList getSchemas() { + ArrayList schemas = new ArrayList<>(); + return getAllSchemas(schemas, 0); + } + public boolean isComplicated() { // used by templates diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_composed_schemas.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_composed_schemas.hbs index 67ebdfaf191f..3fb5ba555700 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_composed_schemas.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_composed_schemas.hbs @@ -1,73 +1,54 @@ {{#if allOf}} -class AllOf: -{{#each allOf}} -{{#if refInfo.refClass}} - - {{> components/schemas/_helper_refclass_staticmethod }} -{{else}} - {{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "AllOf" jsonPathPiece) }} -{{/if}} -{{/each}} - classes = [ -{{#each allOf}} - {{#if refInfo.refClass}} - {{jsonPathPiece.snakeCase}}, - {{else}} +@staticmethod +def all_of(): + return ( + {{#each allOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, + {{else}} {{jsonPathPiece.camelCase}}, - {{/if}} -{{/each}} - ] + {{/if}} + {{/each}} + ) {{/if}} {{#if oneOf}} -class OneOf: -{{#each oneOf}} -{{#if refInfo.refClass}} - - {{> components/schemas/_helper_refclass_staticmethod }} -{{else}} - {{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "OneOf" jsonPathPiece) }} -{{/if}} -{{/each}} - classes = [ -{{#each oneOf}} - {{#if refInfo.refClass}} - {{jsonPathPiece.snakeCase}}, - {{else}} +@staticmethod +def one_of(): + return ( + {{#each oneOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, + {{else}} {{jsonPathPiece.camelCase}}, - {{/if}} -{{/each}} - ] + {{/if}} + {{/each}} + ) {{/if}} {{#if anyOf}} -class AnyOf: -{{#each anyOf}} -{{#if refInfo.refClass}} - - {{> components/schemas/_helper_refclass_staticmethod }} -{{else}} - {{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "AnyOf" jsonPathPiece) }} -{{/if}} -{{/each}} - classes = [ -{{#each anyOf}} - {{#if refInfo.refClass}} - {{jsonPathPiece.snakeCase}}, - {{else}} +@staticmethod +def any_of(): + return ( + {{#each anyOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, + {{else}} {{jsonPathPiece.camelCase}}, - {{/if}} -{{/each}} - ] + {{/if}} + {{/each}} + ) {{/if}} {{#if not}} {{#with not}} -{{#if refInfo.refClass}} -{{> components/schemas/_helper_refclass_staticmethod }} -{{else}} -{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} -{{/if}} +@staticmethod +def not_(): + {{#if refInfo.refClass}} + return {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}} + {{else}} + return {{jsonPathPiece.camelCase}} + {{/if}} {{/with}} {{/if}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_dict_partial.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_dict_partial.hbs index 51f0557904c6..1fcda2afe860 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_dict_partial.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_dict_partial.hbs @@ -25,30 +25,25 @@ def discriminator(): {{/if}} {{#if properties}} -class Properties: -{{#each properties}} -{{#if refInfo.refClass}} - - {{> components/schemas/_helper_refclass_staticmethod }} -{{else}} - {{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "Properties" jsonPathPiece.camelCase) }} -{{/if}} -{{/each}} - __annotations__ = { -{{#each properties}} -{{#if refInfo.refClass}} - "{{{@key.original}}}": {{jsonPathPiece.snakeCase}}, -{{else}} +@staticmethod +def properties(): + return { + {{#each properties}} + {{#if refInfo.refClass}} + "{{{@key.original}}}": {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, + {{else}} "{{{@key.original}}}": {{jsonPathPiece.camelCase}}, -{{/if}} -{{/each}} + {{/if}} + {{/each}} } {{/if}} {{#with additionalProperties}} -{{#if refInfo.refClass}} -{{> components/schemas/_helper_refclass_staticmethod }} -{{else}} -{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} -{{/if}} +@staticmethod +def additional_properties(): + {{#if refInfo.refClass}} + return {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}} + {{else}} + return {{jsonPathPiece.camelCase}} + {{/if}} {{/with}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitem_property.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitem_property.hbs index afe0a0a3c645..4b8f5efba5d6 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitem_property.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitem_property.hbs @@ -1,13 +1,13 @@ {{#if types}} {{#eq types.size 1}} -def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]:{{#if overload}} ...{{/if}} +def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]:{{#if overload}} ...{{/if}} {{else}} -def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[typing.Union[ +def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]:{{#if overload}} ...{{/if}} {{/eq}} {{else}} -def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[typing.Union[ +def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]:{{#if overload}} ...{{/if}} {{/if}} \ No newline at end of file diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitems.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitems.hbs index 8b2a8cda36e0..9e012bd0eeb4 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitems.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_getitems.hbs @@ -8,9 +8,9 @@ {{else}} {{#if jsonPathPiece}} {{#if schemaIsFromAdditionalProperties}} -{{> components/schemas/_helper_getitem_property propertyClass="" literal=true key=@key.original overload=true }} +{{> components/schemas/_helper_getitem_property literal=true key=@key.original overload=true }} {{else}} -{{> components/schemas/_helper_getitem_property propertyClass=".Properties" literal=true key=@key.original overload=true }} +{{> components/schemas/_helper_getitem_property literal=true key=@key.original overload=true }} {{/if}} {{else}} {{! for when additionalProperties is unset, use schemas.AnyTypeSchema because val is not always schemas.UnsetAnyTypeSchema }} @@ -29,7 +29,7 @@ def __getitem__(self, name: typing_extensions.Literal["{{{@key.original}}}"]) -> {{#if refInfo.refClass}} {{> components/schemas/_helper_getitem_refclass literal=true key=@key.original overload=true }} {{else}} -{{> components/schemas/_helper_getitem_property propertyClass=".Properties" literal=true key=@key.original overload=true }} +{{> components/schemas/_helper_getitem_property literal=true key=@key.original overload=true }} {{/if}} {{/each}} {{/if}} @@ -41,7 +41,7 @@ def __getitem__(self, name: typing_extensions.Literal["{{{@key.original}}}"]) -> {{#if refInfo.refClass}} {{> components/schemas/_helper_getitem_refclass literal=false key="str" overload=true }} {{else}} -{{> components/schemas/_helper_getitem_property propertyClass="" literal=false key="str" overload=true }} +{{> components/schemas/_helper_getitem_property literal=false key="str" overload=true }} {{/if}} {{/unless}} {{else}} @@ -90,7 +90,7 @@ def __getitem__( {{#if refInfo.refClass}} {{> components/schemas/_helper_getitem_refclass literal=false key="str" overload=false }} {{else}} -{{> components/schemas/_helper_getitem_property propertyClass="" literal=false key="str" overload=false }} +{{> components/schemas/_helper_getitem_property literal=false key="str" overload=false }} {{/if}} # dict_instance[name] accessor return super().__getitem__(name) diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_list_partial.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_list_partial.hbs index b935f94d1818..a8c363292f7b 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_list_partial.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_list_partial.hbs @@ -1,8 +1,10 @@ {{#with items}} -{{#if refInfo.refClass}} -{{> components/schemas/_helper_refclass_staticmethod }} -{{else}} -{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} -{{/if}} +@staticmethod +def items(): + {{#if refInfo.refClass}} + return {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}} + {{else}} + return {{jsonPathPiece.camelCase}} + {{/if}} {{/with}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new.hbs index 5f8b5fe0bd9b..63e8015322d9 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new.hbs @@ -11,7 +11,7 @@ def __new__( ] {{else}} typing.Union[ - {{> components/schemas/_helper_new_property_value_type propertyClass=null optional=false }} + {{> components/schemas/_helper_new_property_value_type optional=false }} ] {{/if}} {{/with}} @@ -65,11 +65,11 @@ def __new__( {{#if jsonPathPiece}} {{#if schemaIsFromAdditionalProperties}} {{@key.original}}: typing.Union[ - {{> components/schemas/_helper_new_property_value_type propertyClass=null optional=false }} + {{> components/schemas/_helper_new_property_value_type optional=false }} ], {{else}} {{@key.original}}: typing.Union[ - {{> components/schemas/_helper_new_property_value_type propertyClass="Properties" optional=false }} + {{> components/schemas/_helper_new_property_value_type optional=false }} ], {{/if}} {{else}} @@ -95,7 +95,7 @@ def __new__( ] = schemas.unset, {{else}} {{@key.original}}: typing.Union[ - {{> components/schemas/_helper_new_property_value_type propertyClass="Properties" optional=true }} + {{> components/schemas/_helper_new_property_value_type optional=true }} ] = schemas.unset, {{/if}} {{/if}} @@ -109,7 +109,7 @@ def __new__( ], {{else}} **kwargs: typing.Union[ - {{> components/schemas/_helper_new_property_value_type propertyClass=null optional=false }} + {{> components/schemas/_helper_new_property_value_type optional=false }} ], {{/if}} {{/unless}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new_property_value_type.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new_property_value_type.hbs index 392d4d1c513a..33adcef89337 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new_property_value_type.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_new_property_value_type.hbs @@ -1,13 +1,13 @@ {{#if types}} {{#eq types.size 1}} -Schema_.{{#if propertyClass}}{{propertyClass}}.{{/if}}{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}], +{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}], {{else}} -Schema_.{{#if propertyClass}}{{propertyClass}}.{{/if}}{{jsonPathPiece.camelCase}}[typing.Union[ +{{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]], {{/eq}} {{else}} -Schema_.{{#if propertyClass}}{{propertyClass}}.{{/if}}{{jsonPathPiece.camelCase}}[typing.Union[ +{{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]], {{/if}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_property_type_hints.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_property_type_hints.hbs index 35555c32e5a1..0ac48dd0b9ba 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_property_type_hints.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_property_type_hints.hbs @@ -34,12 +34,12 @@ def {{@key.original}}(self) -> {{#if ../refInfo.refModule}}{{../refInfo.refModul {{#eq types.size 1}} @property -def {{@key.original}}(self) -> Schema_.{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]: +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]: return self.__getitem__("{{{@key.original}}}") {{else}} @property -def {{@key.original}}(self) -> Schema_.{{jsonPathPiece.camelCase}}[typing.Union[ +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]: return self.__getitem__("{{{@key.original}}}") @@ -47,7 +47,7 @@ def {{@key.original}}(self) -> Schema_.{{jsonPathPiece.camelCase}}[typing.Union[ {{else}} @property -def {{@key.original}}(self) -> Schema_.{{jsonPathPiece.camelCase}}[typing.Union[ +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]: return self.__getitem__("{{{@key.original}}}") @@ -57,12 +57,12 @@ def {{@key.original}}(self) -> Schema_.{{jsonPathPiece.camelCase}}[typing.Union[ {{#eq types.size 1}} @property -def {{@key.original}}(self) -> Schema_.Properties.{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]: +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]: return self.__getitem__("{{{@key.original}}}") {{else}} @property -def {{@key.original}}(self) -> Schema_.Properties.{{jsonPathPiece.camelCase}}[typing.Union[ +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]: return self.__getitem__("{{{@key.original}}}") @@ -70,7 +70,7 @@ def {{@key.original}}(self) -> Schema_.Properties.{{jsonPathPiece.camelCase}}[ty {{else}} @property -def {{@key.original}}(self) -> Schema_.Properties.{{jsonPathPiece.camelCase}}[typing.Union[ +def {{@key.original}}(self) -> {{jsonPathPiece.camelCase}}[typing.Union[ {{> components/schemas/_helper_schema_python_base_types_newline }} ]]: return self.__getitem__("{{{@key.original}}}") diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_composed_or_anytype.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_composed_or_anytype.hbs index 9d624ea08ce6..b286db2a304b 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_composed_or_anytype.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_composed_or_anytype.hbs @@ -68,3 +68,4 @@ class {{jsonPathPiece.camelCase}}( {{> components/schemas/_helper_property_type_hints }} {{> components/schemas/_helper_new }} + diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_dict.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_dict.hbs index 48583f3abdaa..e779e7d22936 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_dict.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_dict.hbs @@ -25,3 +25,4 @@ class {{jsonPathPiece.camelCase}}( {{> components/schemas/_helper_property_type_hints }} {{> components/schemas/_helper_new }} + diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_list.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_list.hbs index 9d0af06be38c..662d47ee3b12 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_list.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_schema_list.hbs @@ -31,7 +31,8 @@ class {{jsonPathPiece.camelCase}}( {{#if refInfo.refClass}} {{> components/schemas/_helper_getitem_refclass literal=false key="int" overload=false }} {{else}} - {{> components/schemas/_helper_getitem_property propertyClass="" literal=false key="int" overload=false }} + {{> components/schemas/_helper_getitem_property literal=false key="int" overload=false }} {{/if}} return super().__getitem__(name) -{{/with}} \ No newline at end of file +{{/with}} + diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/schema.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/schema.hbs index 3f72670bb1af..fb72af715361 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/schema.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/schema.hbs @@ -13,7 +13,10 @@ from {{packageName}}.shared_imports.schema_imports import * {{else}} from __future__ import annotations from {{packageName}}.shared_imports.schema_imports import * + + {{#each getSchemas}} {{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} + {{/each}} {{#if imports}} {{/if}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/configurations/schema_configuration.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/configurations/schema_configuration.hbs index 02be05467609..1271d1f70f27 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/configurations/schema_configuration.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/configurations/schema_configuration.hbs @@ -26,15 +26,12 @@ PYTHON_KEYWORD_TO_JSON_SCHEMA_KEYWORD = { 'format': 'format', 'required': 'required', 'items': 'items', - 'Items': 'items', - 'Properties': 'properties', + 'properties': 'properties', 'additional_properties': 'additionalProperties', - 'additionalProperties': 'additionalProperties', - 'OneOf': 'oneOf', - 'AnyOf': 'anyOf', - 'AllOf': 'allOf', - '_not': 'not', - '_Not': 'not', + 'one_of': 'oneOf', + 'any_of': 'anyOf', + 'all_of': 'allOf', + 'not_': 'not', 'discriminator': 'discriminator' } diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/schemas.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/schemas.hbs index d62a13b607c9..b331cc090636 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/schemas.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/schemas.hbs @@ -8,6 +8,7 @@ import datetime import dataclasses import functools import decimal +import inspect import io import re import types @@ -188,22 +189,17 @@ class SchemaTyped: min_items: int discriminator: typing.Dict[str, typing.Dict[str, typing.Type['Schema']]] default: typing.Union[str, int, BoolClass] - - - class Properties: - # to hold object properties - pass - - additionalProperties: typing.Optional[typing.Type['Schema']] + properties: typing.Callable + additional_properties: typing.Callable max_properties: int min_properties: int - AllOf: typing.List[typing.Type['Schema']] - OneOf: typing.List[typing.Type['Schema']] - AnyOf: typing.List[typing.Type['Schema']] - _not: typing.Type['Schema'] + all_of: typing.Callable + one_of: typing.Callable + any_of: typing.Callable + not_: typing.Callable max_length: int min_length: int - items: typing.Type['Schema'] + items: typing.Callable PathToSchemasType = typing.Dict[ typing.Tuple[typing.Union[str, int], ...], @@ -832,12 +828,14 @@ def _get_class(item_cls: typing.Union[types.FunctionType, staticmethod, typing.T elif isinstance(item_cls, staticmethod): # referenced schema return item_cls.__func__() - return item_cls + elif isinstance(item_cls, type): + return item_cls + raise ValueError('invalid class value passed in') def validate_items( arg: typing.Any, - item_cls: typing.Type, + item_cls_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -846,7 +844,7 @@ def validate_items( ) -> typing.Optional[PathToSchemasType]: if not isinstance(arg, tuple): return None - item_cls = _get_class(item_cls) + item_cls = _get_class(item_cls_fn.__func__()) path_to_schemas = {} for i, value in enumerate(arg): item_validation_metadata = ValidationMetadata( @@ -865,7 +863,7 @@ def validate_items( def validate_properties( arg: typing.Any, - properties: typing.Type, + properties_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -875,10 +873,11 @@ def validate_properties( if not isinstance(arg, frozendict.frozendict): return None path_to_schemas = {} - present_properties = {k: v for k, v, in arg.items() if k in properties.__annotations__} + properties = properties_fn.__func__() + present_properties = {k: v for k, v, in arg.items() if k in properties} for property_name, value in present_properties.items(): path_to_item = validation_metadata.path_to_item + (property_name,) - schema = properties.__annotations__[property_name] + schema = properties[property_name] schema = _get_class(schema) arg_validation_metadata = ValidationMetadata( path_to_item=path_to_item, @@ -895,7 +894,7 @@ def validate_properties( def validate_additional_properties( arg: typing.Any, - additional_properties_schema: typing.Type, + additional_properties_schema_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -904,10 +903,10 @@ def validate_additional_properties( ) -> typing.Optional[PathToSchemasType]: if not isinstance(arg, frozendict.frozendict): return None - schema = _get_class(additional_properties_schema) + schema = _get_class(additional_properties_schema_fn.__func__()) path_to_schemas = {} - properties_annotations = cls.Schema_.Properties.__annotations__ if hasattr(cls.Schema_, 'Properties') else {} - present_additional_properties = {k: v for k, v, in arg.items() if k not in properties_annotations} + properties = cls.Schema_.properties() if hasattr(cls.Schema_, 'properties') else {} + present_additional_properties = {k: v for k, v, in arg.items() if k not in properties} for property_name, value in present_additional_properties.items(): path_to_item = validation_metadata.path_to_item + (property_name,) arg_validation_metadata = ValidationMetadata( @@ -925,7 +924,7 @@ def validate_additional_properties( def validate_one_of( arg: typing.Any, - one_of_container_cls: typing.Type, + classes_fn: typing.Callable, cls: 'Schema', validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -935,8 +934,9 @@ def validate_one_of( ) -> PathToSchemasType: oneof_classes = [] path_to_schemas = collections.defaultdict(set) - for one_of_cls in one_of_container_cls.classes: - schema = _get_class(one_of_cls) + classes = classes_fn.__func__() + for schema in classes: + schema = _get_class(schema) if schema in path_to_schemas[validation_metadata.path_to_item]: oneof_classes.append(schema) continue @@ -989,7 +989,7 @@ def validate_one_of( def validate_any_of( arg: typing.Any, - any_of_container_cls: typing.Type, + classes_fn: typing.Callable, cls: 'Schema', validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -999,8 +999,9 @@ def validate_any_of( ) -> PathToSchemasType: anyof_classes = [] path_to_schemas = collections.defaultdict(set) - for any_of_cls in any_of_container_cls.classes: - schema = _get_class(any_of_cls) + classes = classes_fn.__func__() + for schema in classes: + schema = _get_class(schema) if schema is cls: """ optimistically assume that cls schema will pass validation @@ -1038,7 +1039,7 @@ def validate_any_of( def validate_all_of( arg: typing.Any, - all_of_cls: typing.Type, + classes_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} @@ -1046,8 +1047,8 @@ def validate_all_of( {{/if}} ) -> PathToSchemasType: path_to_schemas = collections.defaultdict(set) - for allof_cls in all_of_cls.classes: - schema = _get_class(allof_cls) + classes = classes_fn.__func__() + for schema in classes: if schema is cls: """ optimistically assume that cls schema will pass validation @@ -1064,14 +1065,14 @@ def validate_all_of( def validate_not( arg: typing.Any, - not_cls: typing.Type, + not_cls_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, {{#if nonCompliantUseDiscriminatorIfCompositionFails}} **kwargs {{/if}} ) -> None: - not_schema = _get_class(not_cls) + not_schema = _get_class(not_cls_fn.__func__()) other_path_to_schemas = None not_exception = exceptions.ApiValueError( "Invalid value '{}' was passed in to {}. Value is invalid because it is disallowed by {}".format( @@ -1118,29 +1119,26 @@ def __get_discriminated_class(cls, disc_property_name: str, disc_payload_value: if discriminated_cls is not None: return discriminated_cls if not ( - hasattr(cls.Schema_, 'AllOf') or - hasattr(cls.Schema_, 'OneOf') or - hasattr(cls.Schema_, 'AnyOf') + hasattr(cls.Schema_, 'all_of') or + hasattr(cls.Schema_, 'one_of') or + hasattr(cls.Schema_, 'any_of') ): return None # TODO stop traveling if a cycle is hit - if hasattr(cls.Schema_, 'AllOf'): - for allof_cls in cls.Schema_.AllOf.classes: - allof_cls = _get_class(allof_cls) + if hasattr(cls.Schema_, 'all_of'): + for allof_cls in cls.Schema_.all_of(): discriminated_cls = __get_discriminated_class( allof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: return discriminated_cls - if hasattr(cls.Schema_, 'OneOf'): - for oneof_cls in cls.Schema_.OneOf.classes: - oneof_cls = _get_class(oneof_cls) + if hasattr(cls.Schema_, 'one_of'): + for oneof_cls in cls.Schema_.one_of(): discriminated_cls = __get_discriminated_class( oneof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: return discriminated_cls - if hasattr(cls.Schema_, 'AnyOf'): - for anyof_cls in cls.Schema_.AnyOf.classes: - anyof_cls = _get_class(anyof_cls) + if hasattr(cls.Schema_, 'any_of'): + for anyof_cls in cls.Schema_.any_of(): discriminated_cls = __get_discriminated_class( anyof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: @@ -1240,16 +1238,12 @@ json_schema_keyword_to_validator = { 'format': validate_format, 'required': validate_required, 'items': validate_items, - 'Items': validate_items, - 'Properties': validate_properties, - 'AdditionalProperties': validate_additional_properties, + 'properties': validate_properties, 'additional_properties': validate_additional_properties, - 'OneOf': validate_one_of, - 'AnyOf': validate_any_of, - 'AllOf': validate_all_of, - '_not': validate_not, - '_Not': validate_not, - 'ModelNot': validate_not, + 'one_of': validate_one_of, + 'any_of': validate_any_of, + 'all_of': validate_all_of, + 'not_': validate_not, 'discriminator': validate_discriminator } @@ -2439,11 +2433,12 @@ class BinarySchema( types = {FileIO, bytes} format = 'binary' - class OneOf: - classes = [ + @staticmethod + def one_of(): + return ( BytesSchema, FileSchema, - ] + ) def __new__(cls, arg_: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: schema_configuration.SchemaConfiguration) -> BinarySchema[typing.Union[FileIO, bytes]]: return super().__new__(cls, arg_) @@ -2497,7 +2492,8 @@ class AnyTypeSchema( Schema, bytes, io.FileIO, - io.BufferedReader + io.BufferedReader, + Unset ], configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ @@ -2516,7 +2512,8 @@ class AnyTypeSchema( Schema, bytes, io.FileIO, - io.BufferedReader + io.BufferedReader, + Unset ] ) -> AnyTypeSchema[typing.Union[ NoneClass, @@ -2588,7 +2585,9 @@ class NotAnyTypeSchema(AnyTypeSchema[T]): """ class Schema_: - _not = AnyTypeSchema[U] + @staticmethod + def not_(): + return AnyTypeSchema[U] def __new__( cls, diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION index 56fea8a08d2f..717311e32e3c 100644 --- a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0 \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_int32_json_content_type_header/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_int32_json_content_type_header/content/application_json/schema.py index af8e03d6a9c2..5af8b8a8edee 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_int32_json_content_type_header/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_int32_json_content_type_header/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int32Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_number_header/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_number_header/schema.py index b89a7f469718..e394930dca77 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_number_header/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_number_header/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.DecimalSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_string_header/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_string_header/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_string_header/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_string_header/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/parameters/parameter_path_user_name/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/parameters/parameter_path_user_name/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/parameters/parameter_path_user_name/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/parameters/parameter_path_user_name/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/request_bodies/request_body_user_array/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/request_bodies/request_body_user_array/content/application_json/schema.py index bf33d2594d77..d623dc48bfc9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/request_bodies/request_body_user_array/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/request_bodies/request_body_user_array/content/application_json/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.ListSchema[schemas.T] ): @@ -20,7 +21,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[user.User]: + def items(): return user.User def __new__( @@ -48,4 +49,5 @@ def __new__( def __getitem__(self, name: int) -> user.User[frozendict.frozendict]: return super().__getitem__(name) + from petstore_api.components.schema import user diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/content/application_json/schema.py index ba5df782e330..e397e951dfef 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/content/application_json/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.Int32Schema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -18,9 +20,12 @@ class Schema( class Schema_: types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.Int32Schema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[decimal.Decimal]: + def __getitem__(self, name: str) -> AdditionalProperties[decimal.Decimal]: # dict_instance[name] accessor return super().__getitem__(name) @@ -29,7 +34,7 @@ def __new__( *args_: typing.Union[dict, frozendict.frozendict], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[decimal.Decimal], + AdditionalProperties[decimal.Decimal], decimal.Decimal, int ], @@ -45,3 +50,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/headers/header_some_header/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/headers/header_some_header/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/headers/header_some_header/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/headers/header_some_header/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_json/schema.py index 4c3448a28c30..f86b1b9bd33e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_json/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.ListSchema[schemas.T] ): @@ -20,7 +21,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[ref_pet.RefPet]: + def items(): return ref_pet.RefPet def __new__( @@ -48,4 +49,5 @@ def __new__( def __getitem__(self, name: int) -> ref_pet.RefPet[frozendict.frozendict]: return super().__getitem__(name) + from petstore_api.components.schema import ref_pet diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_xml/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_xml/schema.py index a92778494755..814bd4ea792e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_xml/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/content/application_xml/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.ListSchema[schemas.T] ): @@ -20,7 +21,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[pet.Pet]: + def items(): return pet.Pet def __new__( @@ -48,4 +49,5 @@ def __new__( def __getitem__(self, name: int) -> pet.Pet[frozendict.frozendict]: return super().__getitem__(name) + from petstore_api.components.schema import pet diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_200_response.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_200_response.py index 04c09917ad27..4d4ce97e9e07 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_200_response.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_200_response.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.Int32Schema[U] +_Class: typing_extensions.TypeAlias = schemas.StrSchema[U] + class _200Response( schemas.AnyTypeSchema[schemas.T], @@ -26,20 +29,19 @@ class _200Response( class Schema_: # any type - class Properties: - Name: typing_extensions.TypeAlias = schemas.Int32Schema[U] - _Class: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "name": Name, "class": _Class, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["class"]) -> Schema_.Properties._Class[str]: ... + def __getitem__(self, name: typing_extensions.Literal["class"]) -> _Class[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -85,7 +87,7 @@ def __new__( io.BufferedReader ], name: typing.Union[ - Schema_.Properties.Name[decimal.Decimal], + Name[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -145,3 +147,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_return.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_return.py index 214ad473f0cf..8a271a1c3eab 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_return.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/_return.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Return: typing_extensions.TypeAlias = schemas.Int32Schema[U] + class _Return( schemas.AnyTypeSchema[schemas.T], @@ -26,15 +28,15 @@ class _Return( class Schema_: # any type - class Properties: - _Return: typing_extensions.TypeAlias = schemas.Int32Schema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "return": _Return, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["return"]) -> Schema_.Properties._Return[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["return"]) -> _Return[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -132,3 +134,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/abstract_step_message.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/abstract_step_message.py index c5215da4bc59..e7f793defcde 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/abstract_step_message.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/abstract_step_message.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Discriminator: typing_extensions.TypeAlias = schemas.StrSchema[U] + class AbstractStepMessage( schemas.DictSchema[schemas.T] @@ -41,20 +43,17 @@ def discriminator(): } } - class Properties: - Discriminator: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "discriminator": Discriminator, } - class AnyOf: - - @staticmethod - def _0() -> typing.Type[AbstractStepMessage]: - return AbstractStepMessage - classes = [ - _0, - ] + @staticmethod + def any_of(): + return ( + AbstractStepMessage, + ) @property @@ -71,7 +70,7 @@ def description(self) -> schemas.AnyTypeSchema[typing.Union[ return self.__getitem__("description") @property - def discriminator(self) -> Schema_.Properties.Discriminator[str]: + def discriminator(self) -> Discriminator[str]: return self.__getitem__("discriminator") @property @@ -100,7 +99,7 @@ def __getitem__(self, name: typing_extensions.Literal["description"]) -> schemas ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["discriminator"]) -> Schema_.Properties.Discriminator[str]: ... + def __getitem__(self, name: typing_extensions.Literal["discriminator"]) -> Discriminator[str]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["sequenceNumber"]) -> schemas.AnyTypeSchema[typing.Union[ @@ -170,7 +169,7 @@ def __new__( io.BufferedReader ], discriminator: typing.Union[ - Schema_.Properties.Discriminator[str], + Discriminator[str], str ], sequenceNumber: typing.Union[ @@ -236,3 +235,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_class.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_class.py index adb7a45c29fe..b2233c3b0dc0 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_class.py @@ -10,6 +10,275 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class MapProperty( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[str]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[str], + str + ], + ) -> MapProperty[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapProperty[frozendict.frozendict], + inst + ) + return inst + +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class AdditionalProperties( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[str]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[str], + str + ], + ) -> AdditionalProperties[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[frozendict.frozendict], + inst + ) + return inst + + + +class MapOfMapProperty( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[frozendict.frozendict]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[frozendict.frozendict], + dict, + frozendict.frozendict + ], + ) -> MapOfMapProperty[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapOfMapProperty[frozendict.frozendict], + inst + ) + return inst + +Anytype1: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +MapWithUndeclaredPropertiesAnytype1: typing_extensions.TypeAlias = schemas.DictSchema[U] +MapWithUndeclaredPropertiesAnytype2: typing_extensions.TypeAlias = schemas.DictSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + +class MapWithUndeclaredPropertiesAnytype3( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + ) -> MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict], + inst + ) + return inst + +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + +class EmptyMap( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> EmptyMap[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + ) + inst = typing.cast( + EmptyMap[frozendict.frozendict], + inst + ) + return inst + +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class MapWithUndeclaredPropertiesString( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[str]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[str], + str + ], + ) -> MapWithUndeclaredPropertiesString[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapWithUndeclaredPropertiesString[frozendict.frozendict], + inst + ) + return inst + + class AdditionalPropertiesClass( schemas.DictSchema[schemas.T] @@ -24,245 +293,9 @@ class AdditionalPropertiesClass( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class MapProperty( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], - str - ], - ) -> AdditionalPropertiesClass.Schema_.Properties.MapProperty[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.MapProperty[frozendict.frozendict], - inst - ) - return inst - - - class MapOfMapProperty( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], - str - ], - ) -> AdditionalPropertiesClass.Schema_.Properties.MapOfMapProperty.Schema_.AdditionalProperties[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.MapOfMapProperty.Schema_.AdditionalProperties[frozendict.frozendict], - inst - ) - return inst - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[frozendict.frozendict]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[frozendict.frozendict], - dict, - frozendict.frozendict - ], - ) -> AdditionalPropertiesClass.Schema_.Properties.MapOfMapProperty[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.MapOfMapProperty[frozendict.frozendict], - inst - ) - return inst - Anytype1: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - MapWithUndeclaredPropertiesAnytype1: typing_extensions.TypeAlias = schemas.DictSchema[U] - MapWithUndeclaredPropertiesAnytype2: typing_extensions.TypeAlias = schemas.DictSchema[U] - - - class MapWithUndeclaredPropertiesAnytype3( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - ) -> AdditionalPropertiesClass.Schema_.Properties.MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict], - inst - ) - return inst - - - class EmptyMap( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> AdditionalPropertiesClass.Schema_.Properties.EmptyMap[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.EmptyMap[frozendict.frozendict], - inst - ) - return inst - - - class MapWithUndeclaredPropertiesString( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], - str - ], - ) -> AdditionalPropertiesClass.Schema_.Properties.MapWithUndeclaredPropertiesString[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesClass.Schema_.Properties.MapWithUndeclaredPropertiesString[frozendict.frozendict], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "map_property": MapProperty, "map_of_map_property": MapOfMapProperty, "anytype_1": Anytype1, @@ -274,13 +307,13 @@ def __new__( } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_property"]) -> Schema_.Properties.MapProperty[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_property"]) -> MapProperty[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_of_map_property"]) -> Schema_.Properties.MapOfMapProperty[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_of_map_property"]) -> MapOfMapProperty[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["anytype_1"]) -> Schema_.Properties.Anytype1[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["anytype_1"]) -> Anytype1[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -292,19 +325,19 @@ def __getitem__(self, name: typing_extensions.Literal["anytype_1"]) -> Schema_.P ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_1"]) -> Schema_.Properties.MapWithUndeclaredPropertiesAnytype1[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_1"]) -> MapWithUndeclaredPropertiesAnytype1[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_2"]) -> Schema_.Properties.MapWithUndeclaredPropertiesAnytype2[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_2"]) -> MapWithUndeclaredPropertiesAnytype2[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_3"]) -> Schema_.Properties.MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_anytype_3"]) -> MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["empty_map"]) -> Schema_.Properties.EmptyMap[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["empty_map"]) -> EmptyMap[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_string"]) -> Schema_.Properties.MapWithUndeclaredPropertiesString[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_with_undeclared_properties_string"]) -> MapWithUndeclaredPropertiesString[frozendict.frozendict]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -339,19 +372,19 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], map_property: typing.Union[ - Schema_.Properties.MapProperty[frozendict.frozendict], + MapProperty[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, map_of_map_property: typing.Union[ - Schema_.Properties.MapOfMapProperty[frozendict.frozendict], + MapOfMapProperty[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, anytype_1: typing.Union[ - Schema_.Properties.Anytype1[typing.Union[ + Anytype1[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -380,31 +413,31 @@ def __new__( io.BufferedReader ] = schemas.unset, map_with_undeclared_properties_anytype_1: typing.Union[ - Schema_.Properties.MapWithUndeclaredPropertiesAnytype1[frozendict.frozendict], + MapWithUndeclaredPropertiesAnytype1[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, map_with_undeclared_properties_anytype_2: typing.Union[ - Schema_.Properties.MapWithUndeclaredPropertiesAnytype2[frozendict.frozendict], + MapWithUndeclaredPropertiesAnytype2[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, map_with_undeclared_properties_anytype_3: typing.Union[ - Schema_.Properties.MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict], + MapWithUndeclaredPropertiesAnytype3[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, empty_map: typing.Union[ - Schema_.Properties.EmptyMap[frozendict.frozendict], + EmptyMap[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, map_with_undeclared_properties_string: typing.Union[ - Schema_.Properties.MapWithUndeclaredPropertiesString[frozendict.frozendict], + MapWithUndeclaredPropertiesString[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict @@ -449,3 +482,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_validator.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_validator.py index 9970c8353c6b..65cf3168256e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_validator.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_validator.py @@ -10,188 +10,152 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] -class AdditionalPropertiesValidator( + +class _0( schemas.DictSchema[schemas.T] ): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - """ + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + ) -> _0[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _0[frozendict.frozendict], + inst + ) + return inst + + + +class AdditionalProperties( + schemas.AnyTypeSchema[schemas.T], +): class Schema_: - types = { + # any type + min_length = 3 + + + def __new__( + cls, + *args_: typing.Union[ + dict, frozendict.frozendict, - } - - class AllOf: - - - class _0( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - ) -> AdditionalPropertiesValidator.Schema_.AllOf._0[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesValidator.Schema_.AllOf._0[frozendict.frozendict], - inst - ) - return inst - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - min_length = 3 - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AdditionalPropertiesValidator.Schema_.AllOf._1.Schema_.AdditionalProperties[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesValidator.Schema_.AllOf._1.Schema_.AdditionalProperties[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AdditionalProperties[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[ + typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -200,151 +164,157 @@ def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ tuple, bytes, schemas.FileIO - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - ) -> AdditionalPropertiesValidator.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesValidator.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - - - class _2( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - max_length = 5 - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AdditionalPropertiesValidator.Schema_.AllOf._2.Schema_.AdditionalProperties[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesValidator.Schema_.AllOf._2.Schema_.AdditionalProperties[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ + ] + ], + inst + ) + return inst + + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + +class AdditionalProperties( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + max_length = 5 + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AdditionalProperties[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[ + typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -353,59 +323,108 @@ def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ tuple, bytes, schemas.FileIO - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - ) -> AdditionalPropertiesValidator.Schema_.AllOf._2[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AdditionalPropertiesValidator.Schema_.AllOf._2[frozendict.frozendict], - inst - ) - return inst - classes = [ + ] + ], + inst + ) + return inst + + + +class _2( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + ) -> _2[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _2[frozendict.frozendict], + inst + ) + return inst + + + +class AdditionalPropertiesValidator( + schemas.DictSchema[schemas.T] +): + """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + """ + + + class Schema_: + types = { + frozendict.frozendict, + } + + @staticmethod + def all_of(): + return ( _0, _1, _2, - ] + ) def __new__( @@ -443,3 +462,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_with_array_of_enums.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_with_array_of_enums.py index d74a9ac6d23e..e346c8434c78 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_with_array_of_enums.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/additional_properties_with_array_of_enums.py @@ -11,6 +11,45 @@ from petstore_api.shared_imports.schema_imports import * + +class AdditionalProperties( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return enum_class.EnumClass + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + enum_class.EnumClass[str], + str + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> AdditionalProperties[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + AdditionalProperties[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> enum_class.EnumClass[str]: + return super().__getitem__(name) + + + class AdditionalPropertiesWithArrayOfEnums( schemas.DictSchema[schemas.T] ): @@ -24,44 +63,11 @@ class AdditionalPropertiesWithArrayOfEnums( class Schema_: types = {frozendict.frozendict} - - class AdditionalProperties( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - @staticmethod - def items() -> typing.Type[enum_class.EnumClass]: - return enum_class.EnumClass - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - enum_class.EnumClass[str], - str - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> AdditionalPropertiesWithArrayOfEnums.Schema_.AdditionalProperties[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - AdditionalPropertiesWithArrayOfEnums.Schema_.AdditionalProperties[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> enum_class.EnumClass[str]: - return super().__getitem__(name) + @staticmethod + def additional_properties(): + return AdditionalProperties - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[tuple]: + def __getitem__(self, name: str) -> AdditionalProperties[tuple]: # dict_instance[name] accessor return super().__getitem__(name) @@ -70,7 +76,7 @@ def __new__( *args_: typing.Union[dict, frozendict.frozendict], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[tuple], + AdditionalProperties[tuple], list, tuple ], @@ -87,4 +93,5 @@ def __new__( ) return inst + from petstore_api.components.schema import enum_class diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/address.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/address.py index 5b8b02658fc1..3cdfbf270e70 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/address.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/address.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.IntSchema[U] + class Address( schemas.DictSchema[schemas.T] @@ -23,9 +25,12 @@ class Address( class Schema_: types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.IntSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[decimal.Decimal]: + def __getitem__(self, name: str) -> AdditionalProperties[decimal.Decimal]: # dict_instance[name] accessor return super().__getitem__(name) @@ -34,7 +39,7 @@ def __new__( *args_: typing.Union[dict, frozendict.frozendict], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[decimal.Decimal], + AdditionalProperties[decimal.Decimal], decimal.Decimal, int ], @@ -50,3 +55,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal.py index a8fa24bc5e24..e9a8aefc53a5 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal.py @@ -10,6 +10,20 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +ClassName: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class Color( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "red" + class Animal( schemas.DictSchema[schemas.T] @@ -36,34 +50,22 @@ def discriminator(): } } - class Properties: - ClassName: typing_extensions.TypeAlias = schemas.StrSchema[U] - - - class Color( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "red" - __annotations__ = { + @staticmethod + def properties(): + return { "className": ClassName, "color": Color, } @property - def className(self) -> Schema_.Properties.ClassName[str]: + def className(self) -> ClassName[str]: return self.__getitem__("className") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["className"]) -> Schema_.Properties.ClassName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["className"]) -> ClassName[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["color"]) -> Schema_.Properties.Color[str]: ... + def __getitem__(self, name: typing_extensions.Literal["color"]) -> Color[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -92,11 +94,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], className: typing.Union[ - Schema_.Properties.ClassName[str], + ClassName[str], str ], color: typing.Union[ - Schema_.Properties.Color[str], + Color[str], schemas.Unset, str ] = schemas.unset, @@ -135,5 +137,6 @@ def __new__( ) return inst + from petstore_api.components.schema import cat from petstore_api.components.schema import dog diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal_farm.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal_farm.py index e85cf9f254ad..1a01b6805137 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal_farm.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/animal_farm.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class AnimalFarm( schemas.ListSchema[schemas.T] ): @@ -25,7 +26,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[animal.Animal]: + def items(): return animal.Animal def __new__( @@ -53,4 +54,5 @@ def __new__( def __getitem__(self, name: int) -> animal.Animal[frozendict.frozendict]: return super().__getitem__(name) + from petstore_api.components.schema import animal diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_and_format.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_and_format.py index 5bf7aaafe36b..5fc631d727fa 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_and_format.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_and_format.py @@ -11,6 +11,794 @@ from petstore_api.shared_imports.schema_imports import * + +class Uuid( + schemas.UUIDBase, + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'uuid' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Uuid[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Uuid[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Date( + schemas.DateBase, + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'date' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Date[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Date[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class DateTime( + schemas.DateTimeBase, + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'date-time' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> DateTime[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + DateTime[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Number( + schemas.DecimalBase, + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'number' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Number[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Number[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Binary( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'binary' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Binary[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Binary[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Int32( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'int32' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Int32[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Int32[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Int64( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'int64' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Int64[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Int64[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class Double( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'double' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Double[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Double[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + +class _Float( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + format = 'float' + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _Float[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _Float[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + class AnyTypeAndFormat( schemas.DictSchema[schemas.T] ): @@ -24,786 +812,9 @@ class AnyTypeAndFormat( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class Uuid( - schemas.UUIDBase, - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'uuid' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Uuid[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Uuid[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Date( - schemas.DateBase, - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'date' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Date[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Date[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class DateTime( - schemas.DateTimeBase, - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'date-time' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.DateTime[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.DateTime[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Number( - schemas.DecimalBase, - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'number' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Number[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Number[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Binary( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'binary' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Binary[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Binary[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Int32( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'int32' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Int32[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Int32[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Int64( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'int64' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Int64[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Int64[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class Double( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'double' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties.Double[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties.Double[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - - - class _Float( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - format = 'float' - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> AnyTypeAndFormat.Schema_.Properties._Float[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - AnyTypeAndFormat.Schema_.Properties._Float[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "uuid": Uuid, "date": Date, "date-time": DateTime, @@ -816,7 +827,7 @@ def __new__( } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Schema_.Properties.Uuid[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Uuid[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -828,7 +839,7 @@ def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Schema_.Proper ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date"]) -> Schema_.Properties.Date[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["date"]) -> Date[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -840,7 +851,7 @@ def __getitem__(self, name: typing_extensions.Literal["date"]) -> Schema_.Proper ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date-time"]) -> Schema_.Properties.DateTime[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["date-time"]) -> DateTime[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -852,7 +863,7 @@ def __getitem__(self, name: typing_extensions.Literal["date-time"]) -> Schema_.P ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number"]) -> Schema_.Properties.Number[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["number"]) -> Number[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -864,7 +875,7 @@ def __getitem__(self, name: typing_extensions.Literal["number"]) -> Schema_.Prop ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Schema_.Properties.Binary[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Binary[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -876,7 +887,7 @@ def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Schema_.Prop ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Schema_.Properties.Int32[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Int32[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -888,7 +899,7 @@ def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Schema_.Prope ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Schema_.Properties.Int64[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Int64[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -900,7 +911,7 @@ def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Schema_.Prope ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["double"]) -> Schema_.Properties.Double[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["double"]) -> Double[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -912,7 +923,7 @@ def __getitem__(self, name: typing_extensions.Literal["double"]) -> Schema_.Prop ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float"]) -> Schema_.Properties._Float[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["float"]) -> _Float[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -957,7 +968,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], uuid: typing.Union[ - Schema_.Properties.Uuid[typing.Union[ + Uuid[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -986,7 +997,7 @@ def __new__( io.BufferedReader ] = schemas.unset, date: typing.Union[ - Schema_.Properties.Date[typing.Union[ + Date[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1015,7 +1026,7 @@ def __new__( io.BufferedReader ] = schemas.unset, number: typing.Union[ - Schema_.Properties.Number[typing.Union[ + Number[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1044,7 +1055,7 @@ def __new__( io.BufferedReader ] = schemas.unset, binary: typing.Union[ - Schema_.Properties.Binary[typing.Union[ + Binary[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1073,7 +1084,7 @@ def __new__( io.BufferedReader ] = schemas.unset, int32: typing.Union[ - Schema_.Properties.Int32[typing.Union[ + Int32[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1102,7 +1113,7 @@ def __new__( io.BufferedReader ] = schemas.unset, int64: typing.Union[ - Schema_.Properties.Int64[typing.Union[ + Int64[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1131,7 +1142,7 @@ def __new__( io.BufferedReader ] = schemas.unset, double: typing.Union[ - Schema_.Properties.Double[typing.Union[ + Double[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -1198,3 +1209,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_not_string.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_not_string.py index db81e53f39c6..8c25ce8d2349 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_not_string.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/any_type_not_string.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.StrSchema[U] + class AnyTypeNotString( schemas.AnyTypeSchema[schemas.T], @@ -23,7 +25,10 @@ class AnyTypeNotString( class Schema_: # any type - _Not: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def not_(): + return _Not def __new__( @@ -100,3 +105,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/api_response.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/api_response.py index 85f679d09b84..e7d2a6ad35b2 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/api_response.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/api_response.py @@ -10,6 +10,10 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Code: typing_extensions.TypeAlias = schemas.Int32Schema[U] +Type: typing_extensions.TypeAlias = schemas.StrSchema[U] +Message: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ApiResponse( schemas.DictSchema[schemas.T] @@ -24,24 +28,22 @@ class ApiResponse( class Schema_: types = {frozendict.frozendict} - class Properties: - Code: typing_extensions.TypeAlias = schemas.Int32Schema[U] - Type: typing_extensions.TypeAlias = schemas.StrSchema[U] - Message: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "code": Code, "type": Type, "message": Message, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["code"]) -> Schema_.Properties.Code[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["code"]) -> Code[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> Schema_.Properties.Type[str]: ... + def __getitem__(self, name: typing_extensions.Literal["type"]) -> Type[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["message"]) -> Schema_.Properties.Message[str]: ... + def __getitem__(self, name: typing_extensions.Literal["message"]) -> Message[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -71,18 +73,18 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], code: typing.Union[ - Schema_.Properties.Code[decimal.Decimal], + Code[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, type: typing.Union[ - Schema_.Properties.Type[str], + Type[str], schemas.Unset, str ] = schemas.unset, message: typing.Union[ - Schema_.Properties.Message[str], + Message[str], schemas.Unset, str ] = schemas.unset, @@ -121,3 +123,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple.py index 9563f71c04de..3fc3603932e0 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple.py @@ -11,6 +11,36 @@ from petstore_api.shared_imports.schema_imports import * + +class Cultivar( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'^[a-zA-Z\s]*$', # noqa: E501 + } + + +class Origin( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'^[A-Z\s]*$', # noqa: E501 + 'flags': re.I, + } + + class Apple( schemas.NoneBase, schemas.DictBase, @@ -33,51 +63,23 @@ class Schema_: "cultivar", } - class Properties: - - - class Cultivar( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'^[a-zA-Z\s]*$', # noqa: E501 - } - - - class Origin( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'^[A-Z\s]*$', # noqa: E501 - 'flags': re.I, - } - __annotations__ = { + @staticmethod + def properties(): + return { "cultivar": Cultivar, "origin": Origin, } @property - def cultivar(self) -> Schema_.Properties.Cultivar[str]: + def cultivar(self) -> Cultivar[str]: return self.__getitem__("cultivar") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["cultivar"]) -> Schema_.Properties.Cultivar[str]: ... + def __getitem__(self, name: typing_extensions.Literal["cultivar"]) -> Cultivar[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["origin"]) -> Schema_.Properties.Origin[str]: ... + def __getitem__(self, name: typing_extensions.Literal["origin"]) -> Origin[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -110,7 +112,7 @@ def __new__( frozendict.frozendict ], origin: typing.Union[ - Schema_.Properties.Origin[str], + Origin[str], schemas.Unset, str ] = schemas.unset, @@ -157,3 +159,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple_req.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple_req.py index 56858d46e7c0..7fdb530575c1 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple_req.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/apple_req.py @@ -10,6 +10,11 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +Cultivar: typing_extensions.TypeAlias = schemas.StrSchema[U] +Mealy: typing_extensions.TypeAlias = schemas.BoolSchema[U] + class AppleReq( schemas.DictSchema[schemas.T] @@ -27,24 +32,26 @@ class Schema_: "cultivar", } - class Properties: - Cultivar: typing_extensions.TypeAlias = schemas.StrSchema[U] - Mealy: typing_extensions.TypeAlias = schemas.BoolSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "cultivar": Cultivar, "mealy": Mealy, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def cultivar(self) -> Schema_.Properties.Cultivar[str]: + def cultivar(self) -> Cultivar[str]: return self.__getitem__("cultivar") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["cultivar"]) -> Schema_.Properties.Cultivar[str]: ... + def __getitem__(self, name: typing_extensions.Literal["cultivar"]) -> Cultivar[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mealy"]) -> Schema_.Properties.Mealy[schemas.BoolClass]: ... + def __getitem__(self, name: typing_extensions.Literal["mealy"]) -> Mealy[schemas.BoolClass]: ... def __getitem__( self, @@ -60,11 +67,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], cultivar: typing.Union[ - Schema_.Properties.Cultivar[str], + Cultivar[str], str ], mealy: typing.Union[ - Schema_.Properties.Mealy[schemas.BoolClass], + Mealy[schemas.BoolClass], schemas.Unset, bool ] = schemas.unset, @@ -82,3 +89,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_holding_any_type.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_holding_any_type.py index 1ecb36b47934..d541fec167b8 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_holding_any_type.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_holding_any_type.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ArrayHoldingAnyType( schemas.ListSchema[schemas.T] @@ -23,13 +25,16 @@ class ArrayHoldingAnyType( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[typing.Union[ + Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -70,7 +75,7 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ + def __getitem__(self, name: int) -> Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -81,3 +86,4 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ schemas.FileIO ]]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_array_of_number_only.py index 7687d5d484d2..bf4d1d786867 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_array_of_number_only.py @@ -10,6 +10,87 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] + + +class Items( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[decimal.Decimal], + decimal.Decimal, + int, + float + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Items[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Items[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[decimal.Decimal]: + return super().__getitem__(name) + + + +class ArrayArrayNumber( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[tuple], + list, + tuple + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayArrayNumber[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayArrayNumber[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[tuple]: + return super().__getitem__(name) + + class ArrayOfArrayOfNumberOnly( schemas.DictSchema[schemas.T] @@ -24,83 +105,14 @@ class ArrayOfArrayOfNumberOnly( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class ArrayArrayNumber( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[decimal.Decimal], - decimal.Decimal, - int, - float - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayOfArrayOfNumberOnly.Schema_.Properties.ArrayArrayNumber.Schema_.Items[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayOfArrayOfNumberOnly.Schema_.Properties.ArrayArrayNumber.Schema_.Items[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[decimal.Decimal]: - return super().__getitem__(name) - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[tuple], - list, - tuple - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayOfArrayOfNumberOnly.Schema_.Properties.ArrayArrayNumber[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayOfArrayOfNumberOnly.Schema_.Properties.ArrayArrayNumber[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[tuple]: - return super().__getitem__(name) - __annotations__ = { + @staticmethod + def properties(): + return { "ArrayArrayNumber": ArrayArrayNumber, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ArrayArrayNumber"]) -> Schema_.Properties.ArrayArrayNumber[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["ArrayArrayNumber"]) -> ArrayArrayNumber[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -128,7 +140,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], ArrayArrayNumber: typing.Union[ - Schema_.Properties.ArrayArrayNumber[tuple], + ArrayArrayNumber[tuple], schemas.Unset, list, tuple @@ -166,3 +178,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_enums.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_enums.py index bbffd4a0c553..6455c2f19f0c 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_enums.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_enums.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ArrayOfEnums( schemas.ListSchema[schemas.T] ): @@ -25,7 +26,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[string_enum.StringEnum]: + def items(): return string_enum.StringEnum def __new__( @@ -59,4 +60,5 @@ def __getitem__(self, name: int) -> string_enum.StringEnum[typing.Union[ ]]: return super().__getitem__(name) + from petstore_api.components.schema import string_enum diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_number_only.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_number_only.py index e6c70ced7d49..ae56c6219ee2 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_of_number_only.py @@ -10,6 +10,48 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] + + +class ArrayNumber( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[decimal.Decimal], + decimal.Decimal, + int, + float + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayNumber[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayNumber[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[decimal.Decimal]: + return super().__getitem__(name) + + class ArrayOfNumberOnly( schemas.DictSchema[schemas.T] @@ -24,49 +66,14 @@ class ArrayOfNumberOnly( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class ArrayNumber( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[decimal.Decimal], - decimal.Decimal, - int, - float - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayOfNumberOnly.Schema_.Properties.ArrayNumber[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayOfNumberOnly.Schema_.Properties.ArrayNumber[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[decimal.Decimal]: - return super().__getitem__(name) - __annotations__ = { + @staticmethod + def properties(): + return { "ArrayNumber": ArrayNumber, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ArrayNumber"]) -> Schema_.Properties.ArrayNumber[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["ArrayNumber"]) -> ArrayNumber[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -94,7 +101,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], ArrayNumber: typing.Union[ - Schema_.Properties.ArrayNumber[tuple], + ArrayNumber[tuple], schemas.Unset, list, tuple @@ -132,3 +139,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_test.py index 1fc7747f40ee..86d24569f292 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_test.py @@ -10,6 +10,203 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class ArrayOfString( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[str], + str + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayOfString[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayOfString[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[str]: + return super().__getitem__(name) + +Items: typing_extensions.TypeAlias = schemas.Int64Schema[U] + + +class Items( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[decimal.Decimal], + decimal.Decimal, + int + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Items[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Items[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[decimal.Decimal]: + return super().__getitem__(name) + + + +class ArrayArrayOfInteger( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[tuple], + list, + tuple + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayArrayOfInteger[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayArrayOfInteger[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[tuple]: + return super().__getitem__(name) + + + +class Items( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return read_only_first.ReadOnlyFirst + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + read_only_first.ReadOnlyFirst[frozendict.frozendict], + dict, + frozendict.frozendict + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Items[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Items[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> read_only_first.ReadOnlyFirst[frozendict.frozendict]: + return super().__getitem__(name) + + + +class ArrayArrayOfModel( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[tuple], + list, + tuple + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayArrayOfModel[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayArrayOfModel[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[tuple]: + return super().__getitem__(name) + + class ArrayTest( schemas.DictSchema[schemas.T] @@ -24,196 +221,22 @@ class ArrayTest( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class ArrayOfString( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[str], - str - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayTest.Schema_.Properties.ArrayOfString[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayTest.Schema_.Properties.ArrayOfString[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[str]: - return super().__getitem__(name) - - - class ArrayArrayOfInteger( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.Int64Schema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[decimal.Decimal], - decimal.Decimal, - int - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayTest.Schema_.Properties.ArrayArrayOfInteger.Schema_.Items[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayTest.Schema_.Properties.ArrayArrayOfInteger.Schema_.Items[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[decimal.Decimal]: - return super().__getitem__(name) - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[tuple], - list, - tuple - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayTest.Schema_.Properties.ArrayArrayOfInteger[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayTest.Schema_.Properties.ArrayArrayOfInteger[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[tuple]: - return super().__getitem__(name) - - - class ArrayArrayOfModel( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - @staticmethod - def items() -> typing.Type[read_only_first.ReadOnlyFirst]: - return read_only_first.ReadOnlyFirst - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - read_only_first.ReadOnlyFirst[frozendict.frozendict], - dict, - frozendict.frozendict - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayTest.Schema_.Properties.ArrayArrayOfModel.Schema_.Items[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayTest.Schema_.Properties.ArrayArrayOfModel.Schema_.Items[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> read_only_first.ReadOnlyFirst[frozendict.frozendict]: - return super().__getitem__(name) - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[tuple], - list, - tuple - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ArrayTest.Schema_.Properties.ArrayArrayOfModel[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ArrayTest.Schema_.Properties.ArrayArrayOfModel[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[tuple]: - return super().__getitem__(name) - __annotations__ = { + @staticmethod + def properties(): + return { "array_of_string": ArrayOfString, "array_array_of_integer": ArrayArrayOfInteger, "array_array_of_model": ArrayArrayOfModel, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_of_string"]) -> Schema_.Properties.ArrayOfString[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["array_of_string"]) -> ArrayOfString[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_array_of_integer"]) -> Schema_.Properties.ArrayArrayOfInteger[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["array_array_of_integer"]) -> ArrayArrayOfInteger[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_array_of_model"]) -> Schema_.Properties.ArrayArrayOfModel[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["array_array_of_model"]) -> ArrayArrayOfModel[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -243,19 +266,19 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], array_of_string: typing.Union[ - Schema_.Properties.ArrayOfString[tuple], + ArrayOfString[tuple], schemas.Unset, list, tuple ] = schemas.unset, array_array_of_integer: typing.Union[ - Schema_.Properties.ArrayArrayOfInteger[tuple], + ArrayArrayOfInteger[tuple], schemas.Unset, list, tuple ] = schemas.unset, array_array_of_model: typing.Union[ - Schema_.Properties.ArrayArrayOfModel[tuple], + ArrayArrayOfModel[tuple], schemas.Unset, list, tuple @@ -296,4 +319,5 @@ def __new__( ) return inst + from petstore_api.components.schema import read_only_first diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_with_validations_in_items.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_with_validations_in_items.py index 76b7d6641e4b..7776961f2b69 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_with_validations_in_items.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/array_with_validations_in_items.py @@ -11,6 +11,20 @@ from petstore_api.shared_imports.schema_imports import * + +class Items( + schemas.Int64Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int64' + inclusive_maximum = 7 + + class ArrayWithValidationsInItems( schemas.ListSchema[schemas.T] ): @@ -25,24 +39,15 @@ class Schema_: types = {tuple} max_items = 2 - - class Items( - schemas.Int64Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int64' - inclusive_maximum = 7 + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[decimal.Decimal], + Items[decimal.Decimal], decimal.Decimal, int ] @@ -60,5 +65,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[decimal.Decimal]: + def __getitem__(self, name: int) -> Items[decimal.Decimal]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana.py index 2183434680b9..dbcbc36d3ae1 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +LengthCm: typing_extensions.TypeAlias = schemas.NumberSchema[U] + class Banana( schemas.DictSchema[schemas.T] @@ -27,18 +29,18 @@ class Schema_: "lengthCm", } - class Properties: - LengthCm: typing_extensions.TypeAlias = schemas.NumberSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "lengthCm": LengthCm, } @property - def lengthCm(self) -> Schema_.Properties.LengthCm[decimal.Decimal]: + def lengthCm(self) -> LengthCm[decimal.Decimal]: return self.__getitem__("lengthCm") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["lengthCm"]) -> Schema_.Properties.LengthCm[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["lengthCm"]) -> LengthCm[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -66,7 +68,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], lengthCm: typing.Union[ - Schema_.Properties.LengthCm[decimal.Decimal], + LengthCm[decimal.Decimal], decimal.Decimal, int, float @@ -104,3 +106,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana_req.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana_req.py index 29dd3e22417b..1f4a64441154 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana_req.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/banana_req.py @@ -10,6 +10,11 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +LengthCm: typing_extensions.TypeAlias = schemas.NumberSchema[U] +Sweet: typing_extensions.TypeAlias = schemas.BoolSchema[U] + class BananaReq( schemas.DictSchema[schemas.T] @@ -27,24 +32,26 @@ class Schema_: "lengthCm", } - class Properties: - LengthCm: typing_extensions.TypeAlias = schemas.NumberSchema[U] - Sweet: typing_extensions.TypeAlias = schemas.BoolSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "lengthCm": LengthCm, "sweet": Sweet, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def lengthCm(self) -> Schema_.Properties.LengthCm[decimal.Decimal]: + def lengthCm(self) -> LengthCm[decimal.Decimal]: return self.__getitem__("lengthCm") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["lengthCm"]) -> Schema_.Properties.LengthCm[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["lengthCm"]) -> LengthCm[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["sweet"]) -> Schema_.Properties.Sweet[schemas.BoolClass]: ... + def __getitem__(self, name: typing_extensions.Literal["sweet"]) -> Sweet[schemas.BoolClass]: ... def __getitem__( self, @@ -60,13 +67,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], lengthCm: typing.Union[ - Schema_.Properties.LengthCm[decimal.Decimal], + LengthCm[decimal.Decimal], decimal.Decimal, int, float ], sweet: typing.Union[ - Schema_.Properties.Sweet[schemas.BoolClass], + Sweet[schemas.BoolClass], schemas.Unset, bool ] = schemas.unset, @@ -84,3 +91,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/bar.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/bar.py index 271d231384e4..19bc4467e58b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/bar.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/bar.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Bar( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/basque_pig.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/basque_pig.py index 4e81c76ce9b1..42af3fc1bd39 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/basque_pig.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/basque_pig.py @@ -11,6 +11,25 @@ from petstore_api.shared_imports.schema_imports import * + +class ClassName( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "BasquePig": "BASQUE_PIG", + } + + @schemas.classproperty + def BASQUE_PIG(cls): + return cls("BasquePig") # type: ignore + + class BasquePig( schemas.DictSchema[schemas.T] ): @@ -27,35 +46,18 @@ class Schema_: "className", } - class Properties: - - - class ClassName( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "BasquePig": "BASQUE_PIG", - } - - @schemas.classproperty - def BASQUE_PIG(cls): - return cls("BasquePig") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "className": ClassName, } @property - def className(self) -> Schema_.Properties.ClassName[str]: + def className(self) -> ClassName[str]: return self.__getitem__("className") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["className"]) -> Schema_.Properties.ClassName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["className"]) -> ClassName[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -83,7 +85,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], className: typing.Union[ - Schema_.Properties.ClassName[str], + ClassName[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -119,3 +121,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean.py index e34abf6a7291..04cd54e9c827 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Boolean: typing_extensions.TypeAlias = schemas.BoolSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean_enum.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean_enum.py index e78bb7bad409..4d068d5e4d59 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean_enum.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/boolean_enum.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class BooleanEnum( schemas.BoolSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/capitalization.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/capitalization.py index 3e4d5304bfd4..4b9af905ff7b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/capitalization.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/capitalization.py @@ -10,6 +10,13 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +SmallCamel: typing_extensions.TypeAlias = schemas.StrSchema[U] +CapitalCamel: typing_extensions.TypeAlias = schemas.StrSchema[U] +SmallSnake: typing_extensions.TypeAlias = schemas.StrSchema[U] +CapitalSnake: typing_extensions.TypeAlias = schemas.StrSchema[U] +SCAETHFlowPoints: typing_extensions.TypeAlias = schemas.StrSchema[U] +ATTNAME: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Capitalization( schemas.DictSchema[schemas.T] @@ -24,14 +31,9 @@ class Capitalization( class Schema_: types = {frozendict.frozendict} - class Properties: - SmallCamel: typing_extensions.TypeAlias = schemas.StrSchema[U] - CapitalCamel: typing_extensions.TypeAlias = schemas.StrSchema[U] - SmallSnake: typing_extensions.TypeAlias = schemas.StrSchema[U] - CapitalSnake: typing_extensions.TypeAlias = schemas.StrSchema[U] - SCAETHFlowPoints: typing_extensions.TypeAlias = schemas.StrSchema[U] - ATTNAME: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "smallCamel": SmallCamel, "CapitalCamel": CapitalCamel, "small_Snake": SmallSnake, @@ -41,22 +43,22 @@ class Properties: } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["smallCamel"]) -> Schema_.Properties.SmallCamel[str]: ... + def __getitem__(self, name: typing_extensions.Literal["smallCamel"]) -> SmallCamel[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["CapitalCamel"]) -> Schema_.Properties.CapitalCamel[str]: ... + def __getitem__(self, name: typing_extensions.Literal["CapitalCamel"]) -> CapitalCamel[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["small_Snake"]) -> Schema_.Properties.SmallSnake[str]: ... + def __getitem__(self, name: typing_extensions.Literal["small_Snake"]) -> SmallSnake[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["Capital_Snake"]) -> Schema_.Properties.CapitalSnake[str]: ... + def __getitem__(self, name: typing_extensions.Literal["Capital_Snake"]) -> CapitalSnake[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["SCA_ETH_Flow_Points"]) -> Schema_.Properties.SCAETHFlowPoints[str]: ... + def __getitem__(self, name: typing_extensions.Literal["SCA_ETH_Flow_Points"]) -> SCAETHFlowPoints[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ATT_NAME"]) -> Schema_.Properties.ATTNAME[str]: ... + def __getitem__(self, name: typing_extensions.Literal["ATT_NAME"]) -> ATTNAME[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -89,32 +91,32 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], smallCamel: typing.Union[ - Schema_.Properties.SmallCamel[str], + SmallCamel[str], schemas.Unset, str ] = schemas.unset, CapitalCamel: typing.Union[ - Schema_.Properties.CapitalCamel[str], + CapitalCamel[str], schemas.Unset, str ] = schemas.unset, small_Snake: typing.Union[ - Schema_.Properties.SmallSnake[str], + SmallSnake[str], schemas.Unset, str ] = schemas.unset, Capital_Snake: typing.Union[ - Schema_.Properties.CapitalSnake[str], + CapitalSnake[str], schemas.Unset, str ] = schemas.unset, SCA_ETH_Flow_Points: typing.Union[ - Schema_.Properties.SCAETHFlowPoints[str], + SCAETHFlowPoints[str], schemas.Unset, str ] = schemas.unset, ATT_NAME: typing.Union[ - Schema_.Properties.ATTNAME[str], + ATTNAME[str], schemas.Unset, str ] = schemas.unset, @@ -156,3 +158,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/cat.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/cat.py index e32d9792f195..ee9b60294428 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/cat.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/cat.py @@ -10,6 +10,91 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Declawed: typing_extensions.TypeAlias = schemas.BoolSchema[U] + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "declawed": Declawed, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["declawed"]) -> Declawed[schemas.BoolClass]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["declawed"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + declawed: typing.Union[ + Declawed[schemas.BoolClass], + schemas.Unset, + bool + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + declawed=declawed, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + class Cat( schemas.AnyTypeSchema[schemas.T], @@ -24,97 +109,12 @@ class Cat( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[animal.Animal]: - return animal.Animal - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - Declawed: typing_extensions.TypeAlias = schemas.BoolSchema[U] - __annotations__ = { - "declawed": Declawed, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["declawed"]) -> Schema_.Properties.Declawed[schemas.BoolClass]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["declawed"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - declawed: typing.Union[ - Schema_.Properties.Declawed[schemas.BoolClass], - schemas.Unset, - bool - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> Cat.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - declawed=declawed, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - Cat.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + animal.Animal, _1, - ] + ) def __new__( @@ -192,4 +192,5 @@ def __new__( ) return inst + from petstore_api.components.schema import animal diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/category.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/category.py index 13a7d58a493b..0e322e883a8a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/category.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/category.py @@ -10,6 +10,20 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] + + +class Name( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "default-name" + class Category( schemas.DictSchema[schemas.T] @@ -27,34 +41,22 @@ class Schema_: "name", } - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - - - class Name( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "default-name" - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, "name": Name, } @property - def name(self) -> Schema_.Properties.Name[str]: + def name(self) -> Name[str]: return self.__getitem__("name") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -83,11 +85,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], name: typing.Union[ - Schema_.Properties.Name[str], + Name[str], str ], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -126,3 +128,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/child_cat.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/child_cat.py index 27df325cc423..561334125d70 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/child_cat.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/child_cat.py @@ -10,6 +10,91 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "name": Name, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["name"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + name: typing.Union[ + Name[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + name=name, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + class ChildCat( schemas.AnyTypeSchema[schemas.T], @@ -24,97 +109,12 @@ class ChildCat( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[parent_pet.ParentPet]: - return parent_pet.ParentPet - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { - "name": Name, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["name"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - name: typing.Union[ - Schema_.Properties.Name[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ChildCat.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - name=name, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ChildCat.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + parent_pet.ParentPet, _1, - ] + ) def __new__( @@ -192,4 +192,5 @@ def __new__( ) return inst + from petstore_api.components.schema import parent_pet diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/class_model.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/class_model.py index 5084a186ce1b..771e31432bda 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/class_model.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/class_model.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Class: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ClassModel( schemas.AnyTypeSchema[schemas.T], @@ -26,15 +28,15 @@ class ClassModel( class Schema_: # any type - class Properties: - _Class: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "_class": _Class, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["_class"]) -> Schema_.Properties._Class[str]: ... + def __getitem__(self, name: typing_extensions.Literal["_class"]) -> _Class[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -79,7 +81,7 @@ def __new__( io.BufferedReader ], _class: typing.Union[ - Schema_.Properties._Class[str], + _Class[str], schemas.Unset, str ] = schemas.unset, @@ -138,3 +140,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/client.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/client.py index e37211352982..13145c407cdb 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/client.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/client.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Client: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Client( schemas.DictSchema[schemas.T] @@ -24,14 +26,14 @@ class Client( class Schema_: types = {frozendict.frozendict} - class Properties: - Client: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "client": Client, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["client"]) -> Schema_.Properties.Client[str]: ... + def __getitem__(self, name: typing_extensions.Literal["client"]) -> Client[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -59,7 +61,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], client: typing.Union[ - Schema_.Properties.Client[str], + Client[str], schemas.Unset, str ] = schemas.unset, @@ -96,3 +98,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/complex_quadrilateral.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/complex_quadrilateral.py index cf42295f8ca3..eb7dc230d25e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/complex_quadrilateral.py @@ -11,6 +11,108 @@ from petstore_api.shared_imports.schema_imports import * + +class QuadrilateralType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "ComplexQuadrilateral": "COMPLEX_QUADRILATERAL", + } + + @schemas.classproperty + def COMPLEX_QUADRILATERAL(cls): + return cls("ComplexQuadrilateral") # type: ignore + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "quadrilateralType": QuadrilateralType, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> QuadrilateralType[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["quadrilateralType"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + quadrilateralType: typing.Union[ + QuadrilateralType[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + quadrilateralType=quadrilateralType, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + class ComplexQuadrilateral( schemas.AnyTypeSchema[schemas.T], ): @@ -24,114 +126,12 @@ class ComplexQuadrilateral( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[quadrilateral_interface.QuadrilateralInterface]: - return quadrilateral_interface.QuadrilateralInterface - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - - - class QuadrilateralType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "ComplexQuadrilateral": "COMPLEX_QUADRILATERAL", - } - - @schemas.classproperty - def COMPLEX_QUADRILATERAL(cls): - return cls("ComplexQuadrilateral") # type: ignore - __annotations__ = { - "quadrilateralType": QuadrilateralType, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> Schema_.Properties.QuadrilateralType[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["quadrilateralType"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - quadrilateralType: typing.Union[ - Schema_.Properties.QuadrilateralType[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ComplexQuadrilateral.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - quadrilateralType=quadrilateralType, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ComplexQuadrilateral.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + quadrilateral_interface.QuadrilateralInterface, _1, - ] + ) def __new__( @@ -209,4 +209,5 @@ def __new__( ) return inst + from petstore_api.components.schema import quadrilateral_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_any_of_different_types_no_validations.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_any_of_different_types_no_validations.py index 23093685beeb..c8ed2a665044 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_any_of_different_types_no_validations.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_any_of_different_types_no_validations.py @@ -10,87 +10,35 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.DictSchema[U] +_1: typing_extensions.TypeAlias = schemas.DateSchema[U] +_2: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] +_3: typing_extensions.TypeAlias = schemas.BinarySchema[U] +_4: typing_extensions.TypeAlias = schemas.StrSchema[U] +_5: typing_extensions.TypeAlias = schemas.StrSchema[U] +_6: typing_extensions.TypeAlias = schemas.DictSchema[U] +_7: typing_extensions.TypeAlias = schemas.BoolSchema[U] +_8: typing_extensions.TypeAlias = schemas.NoneSchema[U] +Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] -class ComposedAnyOfDifferentTypesNoValidations( - schemas.AnyTypeSchema[schemas.T], -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - """ +class _9( + schemas.ListSchema[schemas.T] +): class Schema_: - # any type + types = {tuple} - class AnyOf: - _0: typing_extensions.TypeAlias = schemas.DictSchema[U] - _1: typing_extensions.TypeAlias = schemas.DateSchema[U] - _2: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] - _3: typing_extensions.TypeAlias = schemas.BinarySchema[U] - _4: typing_extensions.TypeAlias = schemas.StrSchema[U] - _5: typing_extensions.TypeAlias = schemas.StrSchema[U] - _6: typing_extensions.TypeAlias = schemas.DictSchema[U] - _7: typing_extensions.TypeAlias = schemas.BoolSchema[U] - _8: typing_extensions.TypeAlias = schemas.NoneSchema[U] - - - class _9( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ComposedAnyOfDifferentTypesNoValidations.Schema_.AnyOf._9[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ComposedAnyOfDifferentTypesNoValidations.Schema_.AnyOf._9[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -99,15 +47,74 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ tuple, bytes, schemas.FileIO - ]]: - return super().__getitem__(name) - _10: typing_extensions.TypeAlias = schemas.NumberSchema[U] - _11: typing_extensions.TypeAlias = schemas.Float32Schema[U] - _12: typing_extensions.TypeAlias = schemas.Float64Schema[U] - _13: typing_extensions.TypeAlias = schemas.IntSchema[U] - _14: typing_extensions.TypeAlias = schemas.Int32Schema[U] - _15: typing_extensions.TypeAlias = schemas.Int64Schema[U] - classes = [ + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> _9[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + _9[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + return super().__getitem__(name) + +_10: typing_extensions.TypeAlias = schemas.NumberSchema[U] +_11: typing_extensions.TypeAlias = schemas.Float32Schema[U] +_12: typing_extensions.TypeAlias = schemas.Float64Schema[U] +_13: typing_extensions.TypeAlias = schemas.IntSchema[U] +_14: typing_extensions.TypeAlias = schemas.Int32Schema[U] +_15: typing_extensions.TypeAlias = schemas.Int64Schema[U] + + +class ComposedAnyOfDifferentTypesNoValidations( + schemas.AnyTypeSchema[schemas.T], +): + """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + """ + + + class Schema_: + # any type + + @staticmethod + def any_of(): + return ( _0, _1, _2, @@ -124,7 +131,7 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ _13, _14, _15, - ] + ) def __new__( @@ -201,3 +208,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_array.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_array.py index 455e4c96f2a2..1892c576ba57 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_array.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_array.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedArray( schemas.ListSchema[schemas.T] @@ -23,13 +25,16 @@ class ComposedArray( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[typing.Union[ + Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -70,7 +75,7 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ + def __getitem__(self, name: int) -> Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -81,3 +86,4 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ schemas.FileIO ]]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_bool.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_bool.py index 9793dd0cf262..d81d6b6c1190 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_bool.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_bool.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedBool( schemas.BoolSchema[schemas.T] @@ -26,11 +28,11 @@ class Schema_: schemas.BoolClass, } - class AllOf: - _0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -48,3 +50,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_none.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_none.py index 4bbce9a9f9fe..7991e0455787 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_none.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_none.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedNone( schemas.NoneSchema[schemas.T] @@ -26,11 +28,11 @@ class Schema_: schemas.NoneClass, } - class AllOf: - _0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -48,3 +50,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_number.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_number.py index 7fec5602894d..c3c5bfdfb302 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_number.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_number.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedNumber( schemas.NumberSchema[schemas.T] @@ -26,11 +28,11 @@ class Schema_: decimal.Decimal, } - class AllOf: - _0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -48,3 +50,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_object.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_object.py index e7c2701d1ae5..653198863b59 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_object.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_object.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedObject( schemas.DictSchema[schemas.T] @@ -26,11 +28,11 @@ class Schema_: frozendict.frozendict, } - class AllOf: - _0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -68,3 +70,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_one_of_different_types.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_one_of_different_types.py index b5e73633fe78..488878279ab0 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_one_of_different_types.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_one_of_different_types.py @@ -10,139 +10,78 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_2: typing_extensions.TypeAlias = schemas.NoneSchema[U] +_3: typing_extensions.TypeAlias = schemas.DateSchema[U] -class ComposedOneOfDifferentTypes( - schemas.AnyTypeSchema[schemas.T], + +class _4( + schemas.DictSchema[schemas.T] ): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - this is a model that allows payloads of type object or number - """ + class Schema_: + types = {frozendict.frozendict} + max_properties = 4 + min_properties = 4 + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _4[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _4[frozendict.frozendict], + inst + ) + return inst + +Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + +class _5( + schemas.ListSchema[schemas.T] +): class Schema_: - # any type - - class OneOf: - - @staticmethod - def _0() -> typing.Type[number_with_validations.NumberWithValidations]: - return number_with_validations.NumberWithValidations + types = {tuple} + max_items = 4 + min_items = 4 - @staticmethod - def _1() -> typing.Type[animal.Animal]: - return animal.Animal - _2: typing_extensions.TypeAlias = schemas.NoneSchema[U] - _3: typing_extensions.TypeAlias = schemas.DateSchema[U] - - - class _4( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - max_properties = 4 - min_properties = 4 - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ComposedOneOfDifferentTypes.Schema_.OneOf._4[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ComposedOneOfDifferentTypes.Schema_.OneOf._4[frozendict.frozendict], - inst - ) - return inst - - - class _5( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - max_items = 4 - min_items = 4 - Items: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> ComposedOneOfDifferentTypes.Schema_.OneOf._5[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - ComposedOneOfDifferentTypes.Schema_.OneOf._5[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -151,32 +90,93 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ tuple, bytes, schemas.FileIO - ]]: - return super().__getitem__(name) - - - class _6( - schemas.DateTimeSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - format = 'date-time' - regex={ - 'pattern': r'^2020.*', # noqa: E501 - } - classes = [ - _0, - _1, + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> _5[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + _5[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + return super().__getitem__(name) + + + +class _6( + schemas.DateTimeSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + format = 'date-time' + regex={ + 'pattern': r'^2020.*', # noqa: E501 + } + + +class ComposedOneOfDifferentTypes( + schemas.AnyTypeSchema[schemas.T], +): + """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + + this is a model that allows payloads of type object or number + """ + + + class Schema_: + # any type + + @staticmethod + def one_of(): + return ( + number_with_validations.NumberWithValidations, + animal.Animal, _2, _3, _4, _5, _6, - ] + ) def __new__( @@ -254,5 +254,6 @@ def __new__( ) return inst + from petstore_api.components.schema import animal from petstore_api.components.schema import number_with_validations diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_string.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_string.py index 60b6a7cc1eda..9e97cb2d02b9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_string.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/composed_string.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ComposedString( schemas.StrSchema[schemas.T] @@ -26,11 +28,11 @@ class Schema_: str, } - class AllOf: - _0: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -48,3 +50,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/currency.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/currency.py index c434b611fe7e..9381539ad7d9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/currency.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/currency.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Currency( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/danish_pig.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/danish_pig.py index 704fccd52fc8..b137132a924a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/danish_pig.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/danish_pig.py @@ -11,6 +11,25 @@ from petstore_api.shared_imports.schema_imports import * + +class ClassName( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "DanishPig": "DANISH_PIG", + } + + @schemas.classproperty + def DANISH_PIG(cls): + return cls("DanishPig") # type: ignore + + class DanishPig( schemas.DictSchema[schemas.T] ): @@ -27,35 +46,18 @@ class Schema_: "className", } - class Properties: - - - class ClassName( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "DanishPig": "DANISH_PIG", - } - - @schemas.classproperty - def DANISH_PIG(cls): - return cls("DanishPig") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "className": ClassName, } @property - def className(self) -> Schema_.Properties.ClassName[str]: + def className(self) -> ClassName[str]: return self.__getitem__("className") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["className"]) -> Schema_.Properties.ClassName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["className"]) -> ClassName[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -83,7 +85,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], className: typing.Union[ - Schema_.Properties.ClassName[str], + ClassName[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -119,3 +121,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_test.py index 76f6bc03629e..188aef732cd6 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_test.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class DateTimeTest( schemas.DateTimeSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_with_validations.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_with_validations.py index 0d32ff064933..450121f04fe5 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_with_validations.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_time_with_validations.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class DateTimeWithValidations( schemas.DateTimeSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_with_validations.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_with_validations.py index 3bf6ec7fed6f..0c75048b8dfe 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_with_validations.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/date_with_validations.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class DateWithValidations( schemas.DateSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/decimal_payload.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/decimal_payload.py index a49d226a22b5..bd611d27d8ea 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/decimal_payload.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/decimal_payload.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + DecimalPayload: typing_extensions.TypeAlias = schemas.DecimalSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/dog.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/dog.py index 7f41fb2da245..a20a0dbd742a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/dog.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/dog.py @@ -10,6 +10,91 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Breed: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "breed": Breed, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["breed"]) -> Breed[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["breed"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + breed: typing.Union[ + Breed[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + breed=breed, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + class Dog( schemas.AnyTypeSchema[schemas.T], @@ -24,97 +109,12 @@ class Dog( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[animal.Animal]: - return animal.Animal - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - Breed: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { - "breed": Breed, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["breed"]) -> Schema_.Properties.Breed[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["breed"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - breed: typing.Union[ - Schema_.Properties.Breed[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> Dog.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - breed=breed, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - Dog.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + animal.Animal, _1, - ] + ) def __new__( @@ -192,4 +192,5 @@ def __new__( ) return inst + from petstore_api.components.schema import animal diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/drawing.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/drawing.py index 77d1f5dba17d..35634606f451 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/drawing.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/drawing.py @@ -11,92 +11,24 @@ from petstore_api.shared_imports.schema_imports import * -class Drawing( - schemas.DictSchema[schemas.T] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - """ +class Shapes( + schemas.ListSchema[schemas.T] +): class Schema_: - types = {frozendict.frozendict} - - class Properties: - - @staticmethod - def main_shape() -> typing.Type[shape.Shape]: - return shape.Shape - - @staticmethod - def shape_or_null() -> typing.Type[shape_or_null.ShapeOrNull]: - return shape_or_null.ShapeOrNull + types = {tuple} - @staticmethod - def nullable_shape() -> typing.Type[nullable_shape.NullableShape]: - return nullable_shape.NullableShape - - - class Shapes( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - @staticmethod - def items() -> typing.Type[shape.Shape]: - return shape.Shape - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - shape.Shape[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> Drawing.Schema_.Properties.Shapes[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - Drawing.Schema_.Properties.Shapes[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> shape.Shape[typing.Union[ + @staticmethod + def items(): + return shape.Shape + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + shape.Shape[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -105,17 +37,76 @@ def __getitem__(self, name: int) -> shape.Shape[typing.Union[ tuple, bytes, schemas.FileIO - ]]: - return super().__getitem__(name) - __annotations__ = { - "mainShape": main_shape, - "shapeOrNull": shape_or_null, - "nullableShape": nullable_shape, + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Shapes[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Shapes[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> shape.Shape[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + return super().__getitem__(name) + + + +class Drawing( + schemas.DictSchema[schemas.T] +): + """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + """ + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "mainShape": shape.Shape, + "shapeOrNull": shape_or_null.ShapeOrNull, + "nullableShape": nullable_shape.NullableShape, "shapes": Shapes, } @staticmethod - def additional_properties() -> typing.Type[fruit.Fruit]: + def additional_properties(): return fruit.Fruit @typing.overload @@ -155,7 +146,7 @@ def __getitem__(self, name: typing_extensions.Literal["nullableShape"]) -> nulla ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["shapes"]) -> Schema_.Properties.Shapes[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["shapes"]) -> Shapes[tuple]: ... @typing.overload def __getitem__(self, name: str) -> fruit.Fruit[typing.Union[ @@ -273,7 +264,7 @@ def __new__( io.BufferedReader ] = schemas.unset, shapes: typing.Union[ - Schema_.Properties.Shapes[tuple], + Shapes[tuple], schemas.Unset, list, tuple @@ -324,6 +315,7 @@ def __new__( ) return inst + from petstore_api.components.schema import fruit from petstore_api.components.schema import nullable_shape from petstore_api.components.schema import shape diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_arrays.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_arrays.py index 2bcaa8703128..f3197b3d7b19 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_arrays.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_arrays.py @@ -11,6 +11,91 @@ from petstore_api.shared_imports.schema_imports import * + +class JustSymbol( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + ">=": "GREATER_THAN_SIGN_EQUALS_SIGN", + "$": "DOLLAR_SIGN", + } + + @schemas.classproperty + def GREATER_THAN_SIGN_EQUALS_SIGN(cls): + return cls(">=") # type: ignore + + @schemas.classproperty + def DOLLAR_SIGN(cls): + return cls("$") # type: ignore + + +class Items( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "fish": "FISH", + "crab": "CRAB", + } + + @schemas.classproperty + def FISH(cls): + return cls("fish") # type: ignore + + @schemas.classproperty + def CRAB(cls): + return cls("crab") # type: ignore + + +class ArrayEnum( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[str], + str + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayEnum[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayEnum[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[str]: + return super().__getitem__(name) + + + class EnumArrays( schemas.DictSchema[schemas.T] ): @@ -24,96 +109,18 @@ class EnumArrays( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class JustSymbol( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - ">=": "GREATER_THAN_SIGN_EQUALS_SIGN", - "$": "DOLLAR_SIGN", - } - - @schemas.classproperty - def GREATER_THAN_SIGN_EQUALS_SIGN(cls): - return cls(">=") # type: ignore - - @schemas.classproperty - def DOLLAR_SIGN(cls): - return cls("$") # type: ignore - - - class ArrayEnum( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "fish": "FISH", - "crab": "CRAB", - } - - @schemas.classproperty - def FISH(cls): - return cls("fish") # type: ignore - - @schemas.classproperty - def CRAB(cls): - return cls("crab") # type: ignore - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[str], - str - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> EnumArrays.Schema_.Properties.ArrayEnum[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - EnumArrays.Schema_.Properties.ArrayEnum[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[str]: - return super().__getitem__(name) - __annotations__ = { + @staticmethod + def properties(): + return { "just_symbol": JustSymbol, "array_enum": ArrayEnum, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["just_symbol"]) -> Schema_.Properties.JustSymbol[str]: ... + def __getitem__(self, name: typing_extensions.Literal["just_symbol"]) -> JustSymbol[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_enum"]) -> Schema_.Properties.ArrayEnum[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["array_enum"]) -> ArrayEnum[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -142,12 +149,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], just_symbol: typing.Union[ - Schema_.Properties.JustSymbol[str], + JustSymbol[str], schemas.Unset, str ] = schemas.unset, array_enum: typing.Union[ - Schema_.Properties.ArrayEnum[tuple], + ArrayEnum[tuple], schemas.Unset, list, tuple @@ -186,3 +193,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_class.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_class.py index 168d3e9713b3..93d2f936955d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_class.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_class.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class EnumClass( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_test.py index cfbf1e284182..eecc44d70c27 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/enum_test.py @@ -11,6 +11,111 @@ from petstore_api.shared_imports.schema_imports import * + +class EnumString( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "UPPER": "UPPER", + "lower": "LOWER", + "": "EMPTY", + } + + @schemas.classproperty + def UPPER(cls): + return cls("UPPER") # type: ignore + + @schemas.classproperty + def LOWER(cls): + return cls("lower") # type: ignore + + @schemas.classproperty + def EMPTY(cls): + return cls("") # type: ignore + + +class EnumStringRequired( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "UPPER": "UPPER", + "lower": "LOWER", + "": "EMPTY", + } + + @schemas.classproperty + def UPPER(cls): + return cls("UPPER") # type: ignore + + @schemas.classproperty + def LOWER(cls): + return cls("lower") # type: ignore + + @schemas.classproperty + def EMPTY(cls): + return cls("") # type: ignore + + +class EnumInteger( + schemas.Int32Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int32' + enum_value_to_name = { + 1: "POSITIVE_1", + -1: "NEGATIVE_1", + } + + @schemas.classproperty + def POSITIVE_1(cls): + return cls(1) # type: ignore + + @schemas.classproperty + def NEGATIVE_1(cls): + return cls(-1) # type: ignore + + +class EnumNumber( + schemas.Float64Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'double' + enum_value_to_name = { + 1.1: "POSITIVE_1_PT_1", + -1.2: "NEGATIVE_1_PT_2", + } + + @schemas.classproperty + def POSITIVE_1_PT_1(cls): + return cls(1.1) # type: ignore + + @schemas.classproperty + def NEGATIVE_1_PT_2(cls): + return cls(-1.2) # type: ignore + + class EnumTest( schemas.DictSchema[schemas.T] ): @@ -27,158 +132,35 @@ class Schema_: "enum_string_required", } - class Properties: - - - class EnumString( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "UPPER": "UPPER", - "lower": "LOWER", - "": "EMPTY", - } - - @schemas.classproperty - def UPPER(cls): - return cls("UPPER") # type: ignore - - @schemas.classproperty - def LOWER(cls): - return cls("lower") # type: ignore - - @schemas.classproperty - def EMPTY(cls): - return cls("") # type: ignore - - - class EnumStringRequired( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "UPPER": "UPPER", - "lower": "LOWER", - "": "EMPTY", - } - - @schemas.classproperty - def UPPER(cls): - return cls("UPPER") # type: ignore - - @schemas.classproperty - def LOWER(cls): - return cls("lower") # type: ignore - - @schemas.classproperty - def EMPTY(cls): - return cls("") # type: ignore - - - class EnumInteger( - schemas.Int32Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int32' - enum_value_to_name = { - 1: "POSITIVE_1", - -1: "NEGATIVE_1", - } - - @schemas.classproperty - def POSITIVE_1(cls): - return cls(1) # type: ignore - - @schemas.classproperty - def NEGATIVE_1(cls): - return cls(-1) # type: ignore - - - class EnumNumber( - schemas.Float64Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'double' - enum_value_to_name = { - 1.1: "POSITIVE_1_PT_1", - -1.2: "NEGATIVE_1_PT_2", - } - - @schemas.classproperty - def POSITIVE_1_PT_1(cls): - return cls(1.1) # type: ignore - - @schemas.classproperty - def NEGATIVE_1_PT_2(cls): - return cls(-1.2) # type: ignore - - @staticmethod - def string_enum() -> typing.Type[string_enum.StringEnum]: - return string_enum.StringEnum - - @staticmethod - def integer_enum() -> typing.Type[integer_enum.IntegerEnum]: - return integer_enum.IntegerEnum - - @staticmethod - def string_enum_with_default_value() -> typing.Type[string_enum_with_default_value.StringEnumWithDefaultValue]: - return string_enum_with_default_value.StringEnumWithDefaultValue - - @staticmethod - def integer_enum_with_default_value() -> typing.Type[integer_enum_with_default_value.IntegerEnumWithDefaultValue]: - return integer_enum_with_default_value.IntegerEnumWithDefaultValue - - @staticmethod - def integer_enum_one_value() -> typing.Type[integer_enum_one_value.IntegerEnumOneValue]: - return integer_enum_one_value.IntegerEnumOneValue - __annotations__ = { + @staticmethod + def properties(): + return { "enum_string": EnumString, "enum_string_required": EnumStringRequired, "enum_integer": EnumInteger, "enum_number": EnumNumber, - "stringEnum": string_enum, - "IntegerEnum": integer_enum, - "StringEnumWithDefaultValue": string_enum_with_default_value, - "IntegerEnumWithDefaultValue": integer_enum_with_default_value, - "IntegerEnumOneValue": integer_enum_one_value, + "stringEnum": string_enum.StringEnum, + "IntegerEnum": integer_enum.IntegerEnum, + "StringEnumWithDefaultValue": string_enum_with_default_value.StringEnumWithDefaultValue, + "IntegerEnumWithDefaultValue": integer_enum_with_default_value.IntegerEnumWithDefaultValue, + "IntegerEnumOneValue": integer_enum_one_value.IntegerEnumOneValue, } @property - def enum_string_required(self) -> Schema_.Properties.EnumStringRequired[str]: + def enum_string_required(self) -> EnumStringRequired[str]: return self.__getitem__("enum_string_required") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_string_required"]) -> Schema_.Properties.EnumStringRequired[str]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_string_required"]) -> EnumStringRequired[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_string"]) -> Schema_.Properties.EnumString[str]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_string"]) -> EnumString[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_integer"]) -> Schema_.Properties.EnumInteger[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_integer"]) -> EnumInteger[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_number"]) -> Schema_.Properties.EnumNumber[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_number"]) -> EnumNumber[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["stringEnum"]) -> string_enum.StringEnum[typing.Union[ @@ -232,22 +214,22 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], enum_string_required: typing.Union[ - Schema_.Properties.EnumStringRequired[str], + EnumStringRequired[str], str ], enum_string: typing.Union[ - Schema_.Properties.EnumString[str], + EnumString[str], schemas.Unset, str ] = schemas.unset, enum_integer: typing.Union[ - Schema_.Properties.EnumInteger[decimal.Decimal], + EnumInteger[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, enum_number: typing.Union[ - Schema_.Properties.EnumNumber[decimal.Decimal], + EnumNumber[decimal.Decimal], schemas.Unset, decimal.Decimal, int, @@ -327,6 +309,7 @@ def __new__( ) return inst + from petstore_api.components.schema import integer_enum from petstore_api.components.schema import integer_enum_one_value from petstore_api.components.schema import integer_enum_with_default_value diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/equilateral_triangle.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/equilateral_triangle.py index d7a531a1de96..7c4a56b6d540 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/equilateral_triangle.py @@ -11,6 +11,108 @@ from petstore_api.shared_imports.schema_imports import * + +class TriangleType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "EquilateralTriangle": "EQUILATERAL_TRIANGLE", + } + + @schemas.classproperty + def EQUILATERAL_TRIANGLE(cls): + return cls("EquilateralTriangle") # type: ignore + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "triangleType": TriangleType, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> TriangleType[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["triangleType"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + triangleType: typing.Union[ + TriangleType[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + triangleType=triangleType, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + class EquilateralTriangle( schemas.AnyTypeSchema[schemas.T], ): @@ -24,114 +126,12 @@ class EquilateralTriangle( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[triangle_interface.TriangleInterface]: - return triangle_interface.TriangleInterface - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - - - class TriangleType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "EquilateralTriangle": "EQUILATERAL_TRIANGLE", - } - - @schemas.classproperty - def EQUILATERAL_TRIANGLE(cls): - return cls("EquilateralTriangle") # type: ignore - __annotations__ = { - "triangleType": TriangleType, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> Schema_.Properties.TriangleType[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["triangleType"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - triangleType: typing.Union[ - Schema_.Properties.TriangleType[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> EquilateralTriangle.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - triangleType=triangleType, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - EquilateralTriangle.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + triangle_interface.TriangleInterface, _1, - ] + ) def __new__( @@ -209,4 +209,5 @@ def __new__( ) return inst + from petstore_api.components.schema import triangle_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file.py index 7b0e391b61f6..e84b27d5d474 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +SourceURI: typing_extensions.TypeAlias = schemas.StrSchema[U] + class File( schemas.DictSchema[schemas.T] @@ -26,14 +28,14 @@ class File( class Schema_: types = {frozendict.frozendict} - class Properties: - SourceURI: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "sourceURI": SourceURI, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["sourceURI"]) -> Schema_.Properties.SourceURI[str]: ... + def __getitem__(self, name: typing_extensions.Literal["sourceURI"]) -> SourceURI[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -61,7 +63,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], sourceURI: typing.Union[ - Schema_.Properties.SourceURI[str], + SourceURI[str], schemas.Unset, str ] = schemas.unset, @@ -98,3 +100,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file_schema_test_class.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file_schema_test_class.py index 9d1e9137a038..bb9f1420cfed 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/file_schema_test_class.py @@ -11,6 +11,46 @@ from petstore_api.shared_imports.schema_imports import * + +class Files( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return file.File + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + file.File[frozendict.frozendict], + dict, + frozendict.frozendict + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Files[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Files[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> file.File[frozendict.frozendict]: + return super().__getitem__(name) + + + class FileSchemaTestClass( schemas.DictSchema[schemas.T] ): @@ -24,51 +64,10 @@ class FileSchemaTestClass( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def file() -> typing.Type[file.File]: - return file.File - - - class Files( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - @staticmethod - def items() -> typing.Type[file.File]: - return file.File - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - file.File[frozendict.frozendict], - dict, - frozendict.frozendict - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> FileSchemaTestClass.Schema_.Properties.Files[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - FileSchemaTestClass.Schema_.Properties.Files[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> file.File[frozendict.frozendict]: - return super().__getitem__(name) - __annotations__ = { - "file": file, + @staticmethod + def properties(): + return { + "file": file.File, "files": Files, } @@ -76,7 +75,7 @@ def __getitem__(self, name: int) -> file.File[frozendict.frozendict]: def __getitem__(self, name: typing_extensions.Literal["file"]) -> file.File[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["files"]) -> Schema_.Properties.Files[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["files"]) -> Files[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -111,7 +110,7 @@ def __new__( frozendict.frozendict ] = schemas.unset, files: typing.Union[ - Schema_.Properties.Files[tuple], + Files[tuple], schemas.Unset, list, tuple @@ -151,4 +150,5 @@ def __new__( ) return inst + from petstore_api.components.schema import file diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/foo.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/foo.py index 8f65054530ad..75444a9f258c 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/foo.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/foo.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Foo( schemas.DictSchema[schemas.T] ): @@ -24,13 +25,10 @@ class Foo( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def bar() -> typing.Type[bar.Bar]: - return bar.Bar - __annotations__ = { - "bar": bar, + @staticmethod + def properties(): + return { + "bar": bar.Bar, } @typing.overload @@ -100,4 +98,5 @@ def __new__( ) return inst + from petstore_api.components.schema import bar diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/format_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/format_test.py index f8d64a6032e0..ff1845c861a3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/format_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/format_test.py @@ -11,6 +11,189 @@ from petstore_api.shared_imports.schema_imports import * + +class Integer( + schemas.IntSchema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int' + inclusive_maximum = 100 + inclusive_minimum = 10 + multiple_of = 2 +Int32: typing_extensions.TypeAlias = schemas.Int32Schema[U] + + +class Int32withValidations( + schemas.Int32Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int32' + inclusive_maximum = 200 + inclusive_minimum = 20 +Int64: typing_extensions.TypeAlias = schemas.Int64Schema[U] + + +class Number( + schemas.NumberSchema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + inclusive_maximum = 543.2 + inclusive_minimum = 32.1 + multiple_of = 32.5 + + +class _Float( + schemas.Float32Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'float' + inclusive_maximum = 987.6 + inclusive_minimum = 54.3 +Float32: typing_extensions.TypeAlias = schemas.Float32Schema[U] + + +class Double( + schemas.Float64Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'double' + inclusive_maximum = 123.4 + inclusive_minimum = 67.8 +Float64: typing_extensions.TypeAlias = schemas.Float64Schema[U] +Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] + + +class ArrayWithUniqueItems( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + unique_items = True + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[decimal.Decimal], + decimal.Decimal, + int, + float + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayWithUniqueItems[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayWithUniqueItems[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[decimal.Decimal]: + return super().__getitem__(name) + + + +class String( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'[a-z]', # noqa: E501 + 'flags': re.I, + } +Byte: typing_extensions.TypeAlias = schemas.StrSchema[U] +Binary: typing_extensions.TypeAlias = schemas.BinarySchema[U] +Date: typing_extensions.TypeAlias = schemas.DateSchema[U] +DateTime: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] +Uuid: typing_extensions.TypeAlias = schemas.UUIDSchema[U] +UuidNoExample: typing_extensions.TypeAlias = schemas.UUIDSchema[U] + + +class Password( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + format = 'password' + max_length = 64 + min_length = 10 + + +class PatternWithDigits( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'^\d{10}$', # noqa: E501 + } + + +class PatternWithDigitsAndDelimiter( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'^image_\d{1,3}$', # noqa: E501 + 'flags': re.I, + } +NoneProp: typing_extensions.TypeAlias = schemas.NoneSchema[U] + + class FormatTest( schemas.DictSchema[schemas.T] ): @@ -30,185 +213,9 @@ class Schema_: "password", } - class Properties: - - - class Integer( - schemas.IntSchema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int' - inclusive_maximum = 100 - inclusive_minimum = 10 - multiple_of = 2 - Int32: typing_extensions.TypeAlias = schemas.Int32Schema[U] - - - class Int32withValidations( - schemas.Int32Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int32' - inclusive_maximum = 200 - inclusive_minimum = 20 - Int64: typing_extensions.TypeAlias = schemas.Int64Schema[U] - - - class Number( - schemas.NumberSchema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - inclusive_maximum = 543.2 - inclusive_minimum = 32.1 - multiple_of = 32.5 - - - class _Float( - schemas.Float32Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'float' - inclusive_maximum = 987.6 - inclusive_minimum = 54.3 - Float32: typing_extensions.TypeAlias = schemas.Float32Schema[U] - - - class Double( - schemas.Float64Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'double' - inclusive_maximum = 123.4 - inclusive_minimum = 67.8 - Float64: typing_extensions.TypeAlias = schemas.Float64Schema[U] - - - class ArrayWithUniqueItems( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - unique_items = True - Items: typing_extensions.TypeAlias = schemas.NumberSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[decimal.Decimal], - decimal.Decimal, - int, - float - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> FormatTest.Schema_.Properties.ArrayWithUniqueItems[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - FormatTest.Schema_.Properties.ArrayWithUniqueItems[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[decimal.Decimal]: - return super().__getitem__(name) - - - class String( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'[a-z]', # noqa: E501 - 'flags': re.I, - } - Byte: typing_extensions.TypeAlias = schemas.StrSchema[U] - Binary: typing_extensions.TypeAlias = schemas.BinarySchema[U] - Date: typing_extensions.TypeAlias = schemas.DateSchema[U] - DateTime: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] - Uuid: typing_extensions.TypeAlias = schemas.UUIDSchema[U] - UuidNoExample: typing_extensions.TypeAlias = schemas.UUIDSchema[U] - - - class Password( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - format = 'password' - max_length = 64 - min_length = 10 - - - class PatternWithDigits( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'^\d{10}$', # noqa: E501 - } - - - class PatternWithDigitsAndDelimiter( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'^image_\d{1,3}$', # noqa: E501 - 'flags': re.I, - } - NoneProp: typing_extensions.TypeAlias = schemas.NoneSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "integer": Integer, "int32": Int32, "int32withValidations": Int32withValidations, @@ -233,83 +240,83 @@ class Schema_: } @property - def byte(self) -> Schema_.Properties.Byte[str]: + def byte(self) -> Byte[str]: return self.__getitem__("byte") @property - def date(self) -> Schema_.Properties.Date[str]: + def date(self) -> Date[str]: return self.__getitem__("date") @property - def number(self) -> Schema_.Properties.Number[decimal.Decimal]: + def number(self) -> Number[decimal.Decimal]: return self.__getitem__("number") @property - def password(self) -> Schema_.Properties.Password[str]: + def password(self) -> Password[str]: return self.__getitem__("password") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["byte"]) -> Schema_.Properties.Byte[str]: ... + def __getitem__(self, name: typing_extensions.Literal["byte"]) -> Byte[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date"]) -> Schema_.Properties.Date[str]: ... + def __getitem__(self, name: typing_extensions.Literal["date"]) -> Date[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number"]) -> Schema_.Properties.Number[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["number"]) -> Number[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["password"]) -> Schema_.Properties.Password[str]: ... + def __getitem__(self, name: typing_extensions.Literal["password"]) -> Password[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["integer"]) -> Schema_.Properties.Integer[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["integer"]) -> Integer[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Schema_.Properties.Int32[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Int32[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32withValidations"]) -> Schema_.Properties.Int32withValidations[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["int32withValidations"]) -> Int32withValidations[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Schema_.Properties.Int64[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Int64[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float"]) -> Schema_.Properties._Float[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["float"]) -> _Float[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float32"]) -> Schema_.Properties.Float32[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["float32"]) -> Float32[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["double"]) -> Schema_.Properties.Double[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["double"]) -> Double[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float64"]) -> Schema_.Properties.Float64[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["float64"]) -> Float64[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["arrayWithUniqueItems"]) -> Schema_.Properties.ArrayWithUniqueItems[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["arrayWithUniqueItems"]) -> ArrayWithUniqueItems[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["string"]) -> Schema_.Properties.String[str]: ... + def __getitem__(self, name: typing_extensions.Literal["string"]) -> String[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Schema_.Properties.Binary[typing.Union[bytes, schemas.FileIO]]: ... + def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Binary[typing.Union[bytes, schemas.FileIO]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> Schema_.Properties.DateTime[str]: ... + def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> DateTime[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Schema_.Properties.Uuid[str]: ... + def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Uuid[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["uuidNoExample"]) -> Schema_.Properties.UuidNoExample[str]: ... + def __getitem__(self, name: typing_extensions.Literal["uuidNoExample"]) -> UuidNoExample[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pattern_with_digits"]) -> Schema_.Properties.PatternWithDigits[str]: ... + def __getitem__(self, name: typing_extensions.Literal["pattern_with_digits"]) -> PatternWithDigits[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pattern_with_digits_and_delimiter"]) -> Schema_.Properties.PatternWithDigitsAndDelimiter[str]: ... + def __getitem__(self, name: typing_extensions.Literal["pattern_with_digits_and_delimiter"]) -> PatternWithDigitsAndDelimiter[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["noneProp"]) -> Schema_.Properties.NoneProp[schemas.NoneClass]: ... + def __getitem__(self, name: typing_extensions.Literal["noneProp"]) -> NoneProp[schemas.NoneClass]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -357,117 +364,117 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], byte: typing.Union[ - Schema_.Properties.Byte[str], + Byte[str], str ], date: typing.Union[ - Schema_.Properties.Date[str], + Date[str], str, datetime.date ], number: typing.Union[ - Schema_.Properties.Number[decimal.Decimal], + Number[decimal.Decimal], decimal.Decimal, int, float ], password: typing.Union[ - Schema_.Properties.Password[str], + Password[str], str ], integer: typing.Union[ - Schema_.Properties.Integer[decimal.Decimal], + Integer[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, int32: typing.Union[ - Schema_.Properties.Int32[decimal.Decimal], + Int32[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, int32withValidations: typing.Union[ - Schema_.Properties.Int32withValidations[decimal.Decimal], + Int32withValidations[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, int64: typing.Union[ - Schema_.Properties.Int64[decimal.Decimal], + Int64[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, float32: typing.Union[ - Schema_.Properties.Float32[decimal.Decimal], + Float32[decimal.Decimal], schemas.Unset, decimal.Decimal, int, float ] = schemas.unset, double: typing.Union[ - Schema_.Properties.Double[decimal.Decimal], + Double[decimal.Decimal], schemas.Unset, decimal.Decimal, int, float ] = schemas.unset, float64: typing.Union[ - Schema_.Properties.Float64[decimal.Decimal], + Float64[decimal.Decimal], schemas.Unset, decimal.Decimal, int, float ] = schemas.unset, arrayWithUniqueItems: typing.Union[ - Schema_.Properties.ArrayWithUniqueItems[tuple], + ArrayWithUniqueItems[tuple], schemas.Unset, list, tuple ] = schemas.unset, string: typing.Union[ - Schema_.Properties.String[str], + String[str], schemas.Unset, str ] = schemas.unset, binary: typing.Union[ - Schema_.Properties.Binary[typing.Union[bytes, schemas.FileIO]], + Binary[typing.Union[bytes, schemas.FileIO]], schemas.Unset, bytes, io.FileIO, io.BufferedReader ] = schemas.unset, dateTime: typing.Union[ - Schema_.Properties.DateTime[str], + DateTime[str], schemas.Unset, str, datetime.datetime ] = schemas.unset, uuid: typing.Union[ - Schema_.Properties.Uuid[str], + Uuid[str], schemas.Unset, str, uuid.UUID ] = schemas.unset, uuidNoExample: typing.Union[ - Schema_.Properties.UuidNoExample[str], + UuidNoExample[str], schemas.Unset, str, uuid.UUID ] = schemas.unset, pattern_with_digits: typing.Union[ - Schema_.Properties.PatternWithDigits[str], + PatternWithDigits[str], schemas.Unset, str ] = schemas.unset, pattern_with_digits_and_delimiter: typing.Union[ - Schema_.Properties.PatternWithDigitsAndDelimiter[str], + PatternWithDigitsAndDelimiter[str], schemas.Unset, str ] = schemas.unset, noneProp: typing.Union[ - Schema_.Properties.NoneProp[schemas.NoneClass], + NoneProp[schemas.NoneClass], schemas.Unset, None ] = schemas.unset, @@ -523,3 +530,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/from_schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/from_schema.py index 3a14b0c39165..2b818f050ea1 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/from_schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/from_schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Data: typing_extensions.TypeAlias = schemas.StrSchema[U] +Id: typing_extensions.TypeAlias = schemas.IntSchema[U] + class FromSchema( schemas.DictSchema[schemas.T] @@ -24,19 +27,18 @@ class FromSchema( class Schema_: types = {frozendict.frozendict} - class Properties: - Data: typing_extensions.TypeAlias = schemas.StrSchema[U] - Id: typing_extensions.TypeAlias = schemas.IntSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "data": Data, "id": Id, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["data"]) -> Schema_.Properties.Data[str]: ... + def __getitem__(self, name: typing_extensions.Literal["data"]) -> Data[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -65,12 +67,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], data: typing.Union[ - Schema_.Properties.Data[str], + Data[str], schemas.Unset, str ] = schemas.unset, id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -109,3 +111,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit.py index 318d575ec541..364e63b8f037 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Color: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Fruit( schemas.AnyTypeSchema[schemas.T], @@ -24,29 +26,22 @@ class Fruit( class Schema_: # any type - class Properties: - Color: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "color": Color, } - class OneOf: - - @staticmethod - def _0() -> typing.Type[apple.Apple]: - return apple.Apple - - @staticmethod - def _1() -> typing.Type[banana.Banana]: - return banana.Banana - classes = [ - _0, - _1, - ] + @staticmethod + def one_of(): + return ( + apple.Apple, + banana.Banana, + ) @typing.overload - def __getitem__(self, name: typing_extensions.Literal["color"]) -> Schema_.Properties.Color[str]: ... + def __getitem__(self, name: typing_extensions.Literal["color"]) -> Color[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -91,7 +86,7 @@ def __new__( io.BufferedReader ], color: typing.Union[ - Schema_.Properties.Color[str], + Color[str], schemas.Unset, str ] = schemas.unset, @@ -151,5 +146,6 @@ def __new__( ) return inst + from petstore_api.components.schema import apple from petstore_api.components.schema import banana diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit_req.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit_req.py index e69a4c751b04..ba545ad59985 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit_req.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/fruit_req.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.NoneSchema[U] + class FruitReq( schemas.AnyTypeSchema[schemas.T], @@ -24,21 +26,13 @@ class FruitReq( class Schema_: # any type - class OneOf: - _0: typing_extensions.TypeAlias = schemas.NoneSchema[U] - - @staticmethod - def _1() -> typing.Type[apple_req.AppleReq]: - return apple_req.AppleReq - - @staticmethod - def _2() -> typing.Type[banana_req.BananaReq]: - return banana_req.BananaReq - classes = [ + @staticmethod + def one_of(): + return ( _0, - _1, - _2, - ] + apple_req.AppleReq, + banana_req.BananaReq, + ) def __new__( @@ -116,5 +110,6 @@ def __new__( ) return inst + from petstore_api.components.schema import apple_req from petstore_api.components.schema import banana_req diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/gm_fruit.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/gm_fruit.py index cafacf1540bc..4b94e0aa95b8 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/gm_fruit.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/gm_fruit.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Color: typing_extensions.TypeAlias = schemas.StrSchema[U] + class GmFruit( schemas.AnyTypeSchema[schemas.T], @@ -24,29 +26,22 @@ class GmFruit( class Schema_: # any type - class Properties: - Color: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "color": Color, } - class AnyOf: - - @staticmethod - def _0() -> typing.Type[apple.Apple]: - return apple.Apple - - @staticmethod - def _1() -> typing.Type[banana.Banana]: - return banana.Banana - classes = [ - _0, - _1, - ] + @staticmethod + def any_of(): + return ( + apple.Apple, + banana.Banana, + ) @typing.overload - def __getitem__(self, name: typing_extensions.Literal["color"]) -> Schema_.Properties.Color[str]: ... + def __getitem__(self, name: typing_extensions.Literal["color"]) -> Color[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -91,7 +86,7 @@ def __new__( io.BufferedReader ], color: typing.Union[ - Schema_.Properties.Color[str], + Color[str], schemas.Unset, str ] = schemas.unset, @@ -151,5 +146,6 @@ def __new__( ) return inst + from petstore_api.components.schema import apple from petstore_api.components.schema import banana diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/grandparent_animal.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/grandparent_animal.py index 7ac63cff463f..3317dc50e118 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/grandparent_animal.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/grandparent_animal.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +PetType: typing_extensions.TypeAlias = schemas.StrSchema[U] + class GrandparentAnimal( schemas.DictSchema[schemas.T] @@ -36,18 +38,18 @@ def discriminator(): } } - class Properties: - PetType: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "pet_type": PetType, } @property - def pet_type(self) -> Schema_.Properties.PetType[str]: + def pet_type(self) -> PetType[str]: return self.__getitem__("pet_type") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pet_type"]) -> Schema_.Properties.PetType[str]: ... + def __getitem__(self, name: typing_extensions.Literal["pet_type"]) -> PetType[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -75,7 +77,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], pet_type: typing.Union[ - Schema_.Properties.PetType[str], + PetType[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -112,5 +114,6 @@ def __new__( ) return inst + from petstore_api.components.schema import child_cat from petstore_api.components.schema import parent_pet diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/has_only_read_only.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/has_only_read_only.py index daa6d32dce8a..95a8163f8978 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/has_only_read_only.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Bar: typing_extensions.TypeAlias = schemas.StrSchema[U] +Foo: typing_extensions.TypeAlias = schemas.StrSchema[U] + class HasOnlyReadOnly( schemas.DictSchema[schemas.T] @@ -24,19 +27,18 @@ class HasOnlyReadOnly( class Schema_: types = {frozendict.frozendict} - class Properties: - Bar: typing_extensions.TypeAlias = schemas.StrSchema[U] - Foo: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "bar": Bar, "foo": Foo, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["bar"]) -> Schema_.Properties.Bar[str]: ... + def __getitem__(self, name: typing_extensions.Literal["bar"]) -> Bar[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["foo"]) -> Schema_.Properties.Foo[str]: ... + def __getitem__(self, name: typing_extensions.Literal["foo"]) -> Foo[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -65,12 +67,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], bar: typing.Union[ - Schema_.Properties.Bar[str], + Bar[str], schemas.Unset, str ] = schemas.unset, foo: typing.Union[ - Schema_.Properties.Foo[str], + Foo[str], schemas.Unset, str ] = schemas.unset, @@ -108,3 +110,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/health_check_result.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/health_check_result.py index c5d5b7900897..ad2fd6e26ee8 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/health_check_result.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/health_check_result.py @@ -11,6 +11,53 @@ from petstore_api.shared_imports.schema_imports import * + +class NullableMessage( + schemas.NoneBase, + schemas.StrBase, + schemas.Schema[schemas.T], + schemas.NoneStrMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + str, + } + + + def __new__( + cls, + arg_: typing.Union[ + None, + str + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> NullableMessage[ + typing.Union[ + schemas.NoneClass, + str + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + NullableMessage[ + typing.Union[ + schemas.NoneClass, + str + ] + ], + inst + ) + return inst + + + class HealthCheckResult( schemas.DictSchema[schemas.T] ): @@ -26,58 +73,14 @@ class HealthCheckResult( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class NullableMessage( - schemas.NoneBase, - schemas.StrBase, - schemas.Schema[schemas.T], - schemas.NoneStrMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - str, - } - - - def __new__( - cls, - arg_: typing.Union[ - None, - str - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> HealthCheckResult.Schema_.Properties.NullableMessage[ - typing.Union[ - schemas.NoneClass, - str - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - HealthCheckResult.Schema_.Properties.NullableMessage[ - typing.Union[ - schemas.NoneClass, - str - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "NullableMessage": NullableMessage, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["NullableMessage"]) -> Schema_.Properties.NullableMessage[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["NullableMessage"]) -> NullableMessage[typing.Union[ schemas.NoneClass, str ]]: ... @@ -108,7 +111,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], NullableMessage: typing.Union[ - Schema_.Properties.NullableMessage[typing.Union[ + NullableMessage[typing.Union[ schemas.NoneClass, str ]], @@ -149,3 +152,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum.py index 9d9a5205a033..9277a587a6b9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerEnum( schemas.IntSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_big.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_big.py index d277679a8b17..88be80611384 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_big.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_big.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerEnumBig( schemas.IntSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_one_value.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_one_value.py index 2b93fb978c70..a00d59011114 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_one_value.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_one_value.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerEnumOneValue( schemas.IntSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_with_default_value.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_with_default_value.py index bb7f5bbf35a5..27781f9a1cd5 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_enum_with_default_value.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerEnumWithDefaultValue( schemas.IntSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_max10.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_max10.py index f45dccf0637b..38eb98e86b25 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_max10.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_max10.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerMax10( schemas.Int64Schema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_min15.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_min15.py index c239d94a1f0d..cb703127938b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_min15.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/integer_min15.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class IntegerMin15( schemas.Int64Schema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/isosceles_triangle.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/isosceles_triangle.py index 22d4a7192be2..38ecab5f39a0 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/isosceles_triangle.py @@ -11,6 +11,108 @@ from petstore_api.shared_imports.schema_imports import * + +class TriangleType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "IsoscelesTriangle": "ISOSCELES_TRIANGLE", + } + + @schemas.classproperty + def ISOSCELES_TRIANGLE(cls): + return cls("IsoscelesTriangle") # type: ignore + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "triangleType": TriangleType, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> TriangleType[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["triangleType"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + triangleType: typing.Union[ + TriangleType[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + triangleType=triangleType, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + class IsoscelesTriangle( schemas.AnyTypeSchema[schemas.T], ): @@ -24,114 +126,12 @@ class IsoscelesTriangle( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[triangle_interface.TriangleInterface]: - return triangle_interface.TriangleInterface - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - - - class TriangleType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "IsoscelesTriangle": "ISOSCELES_TRIANGLE", - } - - @schemas.classproperty - def ISOSCELES_TRIANGLE(cls): - return cls("IsoscelesTriangle") # type: ignore - __annotations__ = { - "triangleType": TriangleType, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> Schema_.Properties.TriangleType[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["triangleType"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - triangleType: typing.Union[ - Schema_.Properties.TriangleType[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> IsoscelesTriangle.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - triangleType=triangleType, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - IsoscelesTriangle.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + triangle_interface.TriangleInterface, _1, - ] + ) def __new__( @@ -209,4 +209,5 @@ def __new__( ) return inst + from petstore_api.components.schema import triangle_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/items.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/items.py index fb976fa1ef5c..758b599ca961 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/items.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/items.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.DictSchema[U] + class Items( schemas.ListSchema[schemas.T] @@ -25,13 +27,16 @@ class Items( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.DictSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[frozendict.frozendict], + Items[frozendict.frozendict], dict, frozendict.frozendict ] @@ -49,5 +54,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[frozendict.frozendict]: + def __getitem__(self, name: int) -> Items[frozendict.frozendict]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request.py index 08bd3bea5704..4dcb16ec8e1a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request.py @@ -11,89 +11,84 @@ from petstore_api.shared_imports.schema_imports import * -class JSONPatchRequest( - schemas.ListSchema[schemas.T] -): - """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. - Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator - Do not edit the class manually. - """ +class Items( + schemas.AnyTypeSchema[schemas.T], +): class Schema_: - types = {tuple} - - - class Items( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - - class OneOf: - - @staticmethod - def _0() -> typing.Type[json_patch_request_add_replace_test.JSONPatchRequestAddReplaceTest]: - return json_patch_request_add_replace_test.JSONPatchRequestAddReplaceTest - - @staticmethod - def _1() -> typing.Type[json_patch_request_remove.JSONPatchRequestRemove]: - return json_patch_request_remove.JSONPatchRequestRemove - - @staticmethod - def _2() -> typing.Type[json_patch_request_move_copy.JSONPatchRequestMoveCopy]: - return json_patch_request_move_copy.JSONPatchRequestMoveCopy - classes = [ - _0, - _1, - _2, - ] - + # any type - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> JSONPatchRequest.Schema_.Items[ + @staticmethod + def one_of(): + return ( + json_patch_request_add_replace_test.JSONPatchRequestAddReplaceTest, + json_patch_request_remove.JSONPatchRequestRemove, + json_patch_request_move_copy.JSONPatchRequestMoveCopy, + ) + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Items[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Items[ typing.Union[ frozendict.frozendict, str, @@ -104,35 +99,35 @@ def __new__( bytes, schemas.FileIO ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - JSONPatchRequest.Schema_.Items[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst + ], + inst + ) + return inst + + + +class JSONPatchRequest( + schemas.ListSchema[schemas.T] +): + """NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + """ + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[typing.Union[ + Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -173,7 +168,7 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ + def __getitem__(self, name: int) -> Items[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -185,6 +180,7 @@ def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ ]]: return super().__getitem__(name) + from petstore_api.components.schema import json_patch_request_add_replace_test from petstore_api.components.schema import json_patch_request_move_copy from petstore_api.components.schema import json_patch_request_remove diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_add_replace_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_add_replace_test.py index 15818afec3b6..0351ef706854 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_add_replace_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_add_replace_test.py @@ -10,6 +10,39 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +Path: typing_extensions.TypeAlias = schemas.StrSchema[U] +Value: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + +class Op( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "add": "ADD", + "replace": "REPLACE", + "test": "TEST", + } + + @schemas.classproperty + def ADD(cls): + return cls("add") # type: ignore + + @schemas.classproperty + def REPLACE(cls): + return cls("replace") # type: ignore + + @schemas.classproperty + def TEST(cls): + return cls("test") # type: ignore + class JSONPatchRequestAddReplaceTest( schemas.DictSchema[schemas.T] @@ -29,54 +62,28 @@ class Schema_: "value", } - class Properties: - Path: typing_extensions.TypeAlias = schemas.StrSchema[U] - Value: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - - class Op( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "add": "ADD", - "replace": "REPLACE", - "test": "TEST", - } - - @schemas.classproperty - def ADD(cls): - return cls("add") # type: ignore - - @schemas.classproperty - def REPLACE(cls): - return cls("replace") # type: ignore - - @schemas.classproperty - def TEST(cls): - return cls("test") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "path": Path, "value": Value, "op": Op, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def op(self) -> Schema_.Properties.Op[str]: + def op(self) -> Op[str]: return self.__getitem__("op") @property - def path(self) -> Schema_.Properties.Path[str]: + def path(self) -> Path[str]: return self.__getitem__("path") @property - def value(self) -> Schema_.Properties.Value[typing.Union[ + def value(self) -> Value[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -89,13 +96,13 @@ def value(self) -> Schema_.Properties.Value[typing.Union[ return self.__getitem__("value") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["op"]) -> Schema_.Properties.Op[str]: ... + def __getitem__(self, name: typing_extensions.Literal["op"]) -> Op[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["path"]) -> Schema_.Properties.Path[str]: ... + def __getitem__(self, name: typing_extensions.Literal["path"]) -> Path[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["value"]) -> Schema_.Properties.Value[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["value"]) -> Value[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -121,15 +128,15 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], op: typing.Union[ - Schema_.Properties.Op[str], + Op[str], str ], path: typing.Union[ - Schema_.Properties.Path[str], + Path[str], str ], value: typing.Union[ - Schema_.Properties.Value[typing.Union[ + Value[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -171,3 +178,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_move_copy.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_move_copy.py index 972878e563be..4897ad7fb5bb 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_move_copy.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_move_copy.py @@ -10,6 +10,34 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +_From: typing_extensions.TypeAlias = schemas.StrSchema[U] +Path: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class Op( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "move": "MOVE", + "copy": "COPY", + } + + @schemas.classproperty + def MOVE(cls): + return cls("move") # type: ignore + + @schemas.classproperty + def COPY(cls): + return cls("copy") # type: ignore + class JSONPatchRequestMoveCopy( schemas.DictSchema[schemas.T] @@ -29,55 +57,34 @@ class Schema_: "path", } - class Properties: - _From: typing_extensions.TypeAlias = schemas.StrSchema[U] - Path: typing_extensions.TypeAlias = schemas.StrSchema[U] - - - class Op( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "move": "MOVE", - "copy": "COPY", - } - - @schemas.classproperty - def MOVE(cls): - return cls("move") # type: ignore - - @schemas.classproperty - def COPY(cls): - return cls("copy") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "from": _From, "path": Path, "op": Op, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def op(self) -> Schema_.Properties.Op[str]: + def op(self) -> Op[str]: return self.__getitem__("op") @property - def path(self) -> Schema_.Properties.Path[str]: + def path(self) -> Path[str]: return self.__getitem__("path") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["from"]) -> Schema_.Properties._From[str]: ... + def __getitem__(self, name: typing_extensions.Literal["from"]) -> _From[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["op"]) -> Schema_.Properties.Op[str]: ... + def __getitem__(self, name: typing_extensions.Literal["op"]) -> Op[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["path"]) -> Schema_.Properties.Path[str]: ... + def __getitem__(self, name: typing_extensions.Literal["path"]) -> Path[str]: ... def __getitem__( self, @@ -94,11 +101,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], op: typing.Union[ - Schema_.Properties.Op[str], + Op[str], str ], path: typing.Union[ - Schema_.Properties.Path[str], + Path[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -115,3 +122,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_remove.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_remove.py index 348839bb88fd..73ed14eb18b6 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_remove.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/json_patch_request_remove.py @@ -10,6 +10,28 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +Path: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class Op( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "remove": "REMOVE", + } + + @schemas.classproperty + def REMOVE(cls): + return cls("remove") # type: ignore + class JSONPatchRequestRemove( schemas.DictSchema[schemas.T] @@ -28,45 +50,30 @@ class Schema_: "path", } - class Properties: - Path: typing_extensions.TypeAlias = schemas.StrSchema[U] - - - class Op( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "remove": "REMOVE", - } - - @schemas.classproperty - def REMOVE(cls): - return cls("remove") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "path": Path, "op": Op, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def op(self) -> Schema_.Properties.Op[str]: + def op(self) -> Op[str]: return self.__getitem__("op") @property - def path(self) -> Schema_.Properties.Path[str]: + def path(self) -> Path[str]: return self.__getitem__("path") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["op"]) -> Schema_.Properties.Op[str]: ... + def __getitem__(self, name: typing_extensions.Literal["op"]) -> Op[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["path"]) -> Schema_.Properties.Path[str]: ... + def __getitem__(self, name: typing_extensions.Literal["path"]) -> Path[str]: ... def __getitem__( self, @@ -82,11 +89,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], op: typing.Union[ - Schema_.Properties.Op[str], + Op[str], str ], path: typing.Union[ - Schema_.Properties.Path[str], + Path[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -103,3 +110,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mammal.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mammal.py index ac0b0db52b30..4eadc54723d3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mammal.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mammal.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Mammal( schemas.AnyTypeSchema[schemas.T], ): @@ -34,24 +35,13 @@ def discriminator(): } } - class OneOf: - - @staticmethod - def _0() -> typing.Type[whale.Whale]: - return whale.Whale - - @staticmethod - def _1() -> typing.Type[zebra.Zebra]: - return zebra.Zebra - - @staticmethod - def _2() -> typing.Type[pig.Pig]: - return pig.Pig - classes = [ - _0, - _1, - _2, - ] + @staticmethod + def one_of(): + return ( + whale.Whale, + zebra.Zebra, + pig.Pig, + ) def __new__( @@ -129,6 +119,7 @@ def __new__( ) return inst + from petstore_api.components.schema import pig from petstore_api.components.schema import whale from petstore_api.components.schema import zebra diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/map_test.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/map_test.py index 93db7f1c8a12..c22f1d198b4d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/map_test.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/map_test.py @@ -10,6 +10,189 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class AdditionalProperties( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[str]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[str], + str + ], + ) -> AdditionalProperties[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[frozendict.frozendict], + inst + ) + return inst + + + +class MapMapOfString( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[frozendict.frozendict]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[frozendict.frozendict], + dict, + frozendict.frozendict + ], + ) -> MapMapOfString[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapMapOfString[frozendict.frozendict], + inst + ) + return inst + + + +class AdditionalProperties( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "UPPER": "UPPER", + "lower": "LOWER", + } + + @schemas.classproperty + def UPPER(cls): + return cls("UPPER") # type: ignore + + @schemas.classproperty + def LOWER(cls): + return cls("lower") # type: ignore + + +class MapOfEnumString( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[str]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[str], + str + ], + ) -> MapOfEnumString[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + MapOfEnumString[frozendict.frozendict], + inst + ) + return inst + +AdditionalProperties: typing_extensions.TypeAlias = schemas.BoolSchema[U] + + +class DirectMap( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[schemas.BoolClass]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[schemas.BoolClass], + bool + ], + ) -> DirectMap[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + DirectMap[frozendict.frozendict], + inst + ) + return inst + + class MapTest( schemas.DictSchema[schemas.T] @@ -24,188 +207,23 @@ class MapTest( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class MapMapOfString( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], - str - ], - ) -> MapTest.Schema_.Properties.MapMapOfString.Schema_.AdditionalProperties[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - MapTest.Schema_.Properties.MapMapOfString.Schema_.AdditionalProperties[frozendict.frozendict], - inst - ) - return inst - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[frozendict.frozendict]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[frozendict.frozendict], - dict, - frozendict.frozendict - ], - ) -> MapTest.Schema_.Properties.MapMapOfString[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - MapTest.Schema_.Properties.MapMapOfString[frozendict.frozendict], - inst - ) - return inst - - - class MapOfEnumString( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "UPPER": "UPPER", - "lower": "LOWER", - } - - @schemas.classproperty - def UPPER(cls): - return cls("UPPER") # type: ignore - - @schemas.classproperty - def LOWER(cls): - return cls("lower") # type: ignore - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], - str - ], - ) -> MapTest.Schema_.Properties.MapOfEnumString[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - MapTest.Schema_.Properties.MapOfEnumString[frozendict.frozendict], - inst - ) - return inst - - - class DirectMap( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.BoolSchema[U] - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[schemas.BoolClass]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[schemas.BoolClass], - bool - ], - ) -> MapTest.Schema_.Properties.DirectMap[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - MapTest.Schema_.Properties.DirectMap[frozendict.frozendict], - inst - ) - return inst - - @staticmethod - def indirect_map() -> typing.Type[string_boolean_map.StringBooleanMap]: - return string_boolean_map.StringBooleanMap - __annotations__ = { + @staticmethod + def properties(): + return { "map_map_of_string": MapMapOfString, "map_of_enum_string": MapOfEnumString, "direct_map": DirectMap, - "indirect_map": indirect_map, + "indirect_map": string_boolean_map.StringBooleanMap, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_map_of_string"]) -> Schema_.Properties.MapMapOfString[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_map_of_string"]) -> MapMapOfString[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map_of_enum_string"]) -> Schema_.Properties.MapOfEnumString[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map_of_enum_string"]) -> MapOfEnumString[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["direct_map"]) -> Schema_.Properties.DirectMap[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["direct_map"]) -> DirectMap[frozendict.frozendict]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["indirect_map"]) -> string_boolean_map.StringBooleanMap[frozendict.frozendict]: ... @@ -239,19 +257,19 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], map_map_of_string: typing.Union[ - Schema_.Properties.MapMapOfString[frozendict.frozendict], + MapMapOfString[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, map_of_enum_string: typing.Union[ - Schema_.Properties.MapOfEnumString[frozendict.frozendict], + MapOfEnumString[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, direct_map: typing.Union[ - Schema_.Properties.DirectMap[frozendict.frozendict], + DirectMap[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict @@ -299,4 +317,5 @@ def __new__( ) return inst + from petstore_api.components.schema import string_boolean_map diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mixed_properties_and_additional_properties_class.py index 3d4c46b16240..093175a693e8 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/mixed_properties_and_additional_properties_class.py @@ -10,6 +10,49 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Uuid: typing_extensions.TypeAlias = schemas.UUIDSchema[U] +DateTime: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] + + +class Map( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return animal.Animal + + def __getitem__(self, name: str) -> animal.Animal[frozendict.frozendict]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + animal.Animal[frozendict.frozendict], + dict, + frozendict.frozendict + ], + ) -> Map[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Map[frozendict.frozendict], + inst + ) + return inst + + class MixedPropertiesAndAdditionalPropertiesClass( schemas.DictSchema[schemas.T] @@ -24,62 +67,22 @@ class MixedPropertiesAndAdditionalPropertiesClass( class Schema_: types = {frozendict.frozendict} - class Properties: - Uuid: typing_extensions.TypeAlias = schemas.UUIDSchema[U] - DateTime: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] - - - class Map( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - @staticmethod - def additional_properties() -> typing.Type[animal.Animal]: - return animal.Animal - - def __getitem__(self, name: str) -> animal.Animal[frozendict.frozendict]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - animal.Animal[frozendict.frozendict], - dict, - frozendict.frozendict - ], - ) -> MixedPropertiesAndAdditionalPropertiesClass.Schema_.Properties.Map[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - MixedPropertiesAndAdditionalPropertiesClass.Schema_.Properties.Map[frozendict.frozendict], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "uuid": Uuid, "dateTime": DateTime, "map": Map, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Schema_.Properties.Uuid[str]: ... + def __getitem__(self, name: typing_extensions.Literal["uuid"]) -> Uuid[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> Schema_.Properties.DateTime[str]: ... + def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> DateTime[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["map"]) -> Schema_.Properties.Map[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["map"]) -> Map[frozendict.frozendict]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -109,19 +112,19 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], uuid: typing.Union[ - Schema_.Properties.Uuid[str], + Uuid[str], schemas.Unset, str, uuid.UUID ] = schemas.unset, dateTime: typing.Union[ - Schema_.Properties.DateTime[str], + DateTime[str], schemas.Unset, str, datetime.datetime ] = schemas.unset, map: typing.Union[ - Schema_.Properties.Map[frozendict.frozendict], + Map[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict @@ -162,4 +165,5 @@ def __new__( ) return inst + from petstore_api.components.schema import animal diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/money.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/money.py index 58cd138b97ec..cad7a40ce6d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/money.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/money.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Amount: typing_extensions.TypeAlias = schemas.DecimalSchema[U] + class Money( schemas.DictSchema[schemas.T] @@ -28,19 +30,15 @@ class Schema_: "currency", } - class Properties: - Amount: typing_extensions.TypeAlias = schemas.DecimalSchema[U] - - @staticmethod - def currency() -> typing.Type[currency.Currency]: - return currency.Currency - __annotations__ = { + @staticmethod + def properties(): + return { "amount": Amount, - "currency": currency, + "currency": currency.Currency, } @property - def amount(self) -> Schema_.Properties.Amount[str]: + def amount(self) -> Amount[str]: return self.__getitem__("amount") @property @@ -48,7 +46,7 @@ def currency(self) -> currency.Currency[str]: return self.__getitem__("currency") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["amount"]) -> Schema_.Properties.Amount[str]: ... + def __getitem__(self, name: typing_extensions.Literal["amount"]) -> Amount[str]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["currency"]) -> currency.Currency[str]: ... @@ -80,7 +78,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], amount: typing.Union[ - Schema_.Properties.Amount[str], + Amount[str], str ], currency: typing.Union[ @@ -122,4 +120,5 @@ def __new__( ) return inst + from petstore_api.components.schema import currency diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/name.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/name.py index 71774e1bdac4..dad95a680825 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/name.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/name.py @@ -10,6 +10,10 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.Int32Schema[U] +SnakeCase: typing_extensions.TypeAlias = schemas.Int32Schema[U] +_Property: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Name( schemas.AnyTypeSchema[schemas.T], @@ -29,11 +33,9 @@ class Schema_: "name", } - class Properties: - Name: typing_extensions.TypeAlias = schemas.Int32Schema[U] - SnakeCase: typing_extensions.TypeAlias = schemas.Int32Schema[U] - _Property: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "name": Name, "snake_case": SnakeCase, "property": _Property, @@ -41,17 +43,17 @@ class Properties: @property - def name(self) -> Schema_.Properties.Name[decimal.Decimal]: + def name(self) -> Name[decimal.Decimal]: return self.__getitem__("name") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["snake_case"]) -> Schema_.Properties.SnakeCase[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["snake_case"]) -> SnakeCase[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["property"]) -> Schema_.Properties._Property[str]: ... + def __getitem__(self, name: typing_extensions.Literal["property"]) -> _Property[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -98,7 +100,7 @@ def __new__( io.BufferedReader ], snake_case: typing.Union[ - Schema_.Properties.SnakeCase[decimal.Decimal], + SnakeCase[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -158,3 +160,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/no_additional_properties.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/no_additional_properties.py index 35abf35ee22b..6067eb6ae2c3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/no_additional_properties.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/no_additional_properties.py @@ -10,6 +10,11 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] +PetId: typing_extensions.TypeAlias = schemas.Int64Schema[U] + class NoAdditionalProperties( schemas.DictSchema[schemas.T] @@ -27,24 +32,26 @@ class Schema_: "id", } - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - PetId: typing_extensions.TypeAlias = schemas.Int64Schema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, "petId": PetId, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def id(self) -> Schema_.Properties.Id[decimal.Decimal]: + def id(self) -> Id[decimal.Decimal]: return self.__getitem__("id") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["petId"]) -> Schema_.Properties.PetId[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["petId"]) -> PetId[decimal.Decimal]: ... def __getitem__( self, @@ -60,12 +67,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], decimal.Decimal, int ], petId: typing.Union[ - Schema_.Properties.PetId[decimal.Decimal], + PetId[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -84,3 +91,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_class.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_class.py index f135d99a9fd0..57d7a8761b24 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_class.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_class.py @@ -11,6 +11,954 @@ from petstore_api.shared_imports.schema_imports import * + +class AdditionalProperties( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class IntegerProp( + schemas.NoneBase, + schemas.IntBase, + schemas.Schema[schemas.T], + schemas.NoneDecimalMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + decimal.Decimal, + } + format = 'int' + + + def __new__( + cls, + arg_: typing.Union[ + None, + decimal.Decimal, + int + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> IntegerProp[ + typing.Union[ + schemas.NoneClass, + decimal.Decimal + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + IntegerProp[ + typing.Union[ + schemas.NoneClass, + decimal.Decimal + ] + ], + inst + ) + return inst + + + +class NumberProp( + schemas.NoneBase, + schemas.NumberBase, + schemas.Schema[schemas.T], + schemas.NoneDecimalMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + decimal.Decimal, + } + + + def __new__( + cls, + arg_: typing.Union[ + None, + decimal.Decimal, + int, + float + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> NumberProp[ + typing.Union[ + schemas.NoneClass, + decimal.Decimal + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + NumberProp[ + typing.Union[ + schemas.NoneClass, + decimal.Decimal + ] + ], + inst + ) + return inst + + + +class BooleanProp( + schemas.NoneBase, + schemas.BoolBase, + schemas.Schema[schemas.T], + schemas.NoneBoolMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + schemas.BoolClass, + } + + + def __new__( + cls, + arg_: typing.Union[ + None, + bool + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> BooleanProp[ + typing.Union[ + schemas.NoneClass, + schemas.BoolClass + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + BooleanProp[ + typing.Union[ + schemas.NoneClass, + schemas.BoolClass + ] + ], + inst + ) + return inst + + + +class StringProp( + schemas.NoneBase, + schemas.StrBase, + schemas.Schema[schemas.T], + schemas.NoneStrMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + str, + } + + + def __new__( + cls, + arg_: typing.Union[ + None, + str + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> StringProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + StringProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ], + inst + ) + return inst + + + +class DateProp( + schemas.NoneBase, + schemas.DateBase, + schemas.StrBase, + schemas.Schema[schemas.T], + schemas.NoneStrMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + str, + } + format = 'date' + + + def __new__( + cls, + arg_: typing.Union[ + None, + str, + datetime.date + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> DateProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + DateProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ], + inst + ) + return inst + + + +class DatetimeProp( + schemas.NoneBase, + schemas.DateTimeBase, + schemas.StrBase, + schemas.Schema[schemas.T], + schemas.NoneStrMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + str, + } + format = 'date-time' + + + def __new__( + cls, + arg_: typing.Union[ + None, + str, + datetime.datetime + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> DatetimeProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + DatetimeProp[ + typing.Union[ + schemas.NoneClass, + str + ] + ], + inst + ) + return inst + +Items: typing_extensions.TypeAlias = schemas.DictSchema[U] + + +class ArrayNullableProp( + schemas.NoneBase, + schemas.ListBase, + schemas.Schema[schemas.T], + schemas.NoneTupleMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + tuple, + } + + @staticmethod + def items(): + return Items + + + def __new__( + cls, + arg_: typing.Union[ + None, + list, + tuple + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayNullableProp[ + typing.Union[ + schemas.NoneClass, + tuple + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayNullableProp[ + typing.Union[ + schemas.NoneClass, + tuple + ] + ], + inst + ) + return inst + + + +class Items( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Items[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Items[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class ArrayAndItemsNullableProp( + schemas.NoneBase, + schemas.ListBase, + schemas.Schema[schemas.T], + schemas.NoneTupleMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + tuple, + } + + @staticmethod + def items(): + return Items + + + def __new__( + cls, + arg_: typing.Union[ + None, + list, + tuple + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayAndItemsNullableProp[ + typing.Union[ + schemas.NoneClass, + tuple + ] + ]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayAndItemsNullableProp[ + typing.Union[ + schemas.NoneClass, + tuple + ] + ], + inst + ) + return inst + + + +class Items( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> Items[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + Items[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class ArrayItemsNullable( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]], + None, + dict, + frozendict.frozendict + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> ArrayItemsNullable[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + ArrayItemsNullable[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]]: + return super().__getitem__(name) + +AdditionalProperties: typing_extensions.TypeAlias = schemas.DictSchema[U] + + +class ObjectNullableProp( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + @staticmethod + def additional_properties(): + return AdditionalProperties + + + def __getitem__(self, name: str) -> AdditionalProperties[frozendict.frozendict]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[frozendict.frozendict], + dict, + frozendict.frozendict + ], + ) -> ObjectNullableProp[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + ObjectNullableProp[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class AdditionalProperties( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class ObjectAndItemsNullableProp( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + @staticmethod + def additional_properties(): + return AdditionalProperties + + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]], + None, + dict, + frozendict.frozendict + ], + ) -> ObjectAndItemsNullableProp[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + ObjectAndItemsNullableProp[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class AdditionalProperties( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AdditionalProperties[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + + + +class ObjectItemsNullable( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def additional_properties(): + return AdditionalProperties + + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]]: + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + AdditionalProperties[typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ]], + None, + dict, + frozendict.frozendict + ], + ) -> ObjectItemsNullable[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + ObjectItemsNullable[frozendict.frozendict], + inst + ) + return inst + + + class NullableClass( schemas.DictSchema[schemas.T] ): @@ -24,848 +972,9 @@ class NullableClass( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class IntegerProp( - schemas.NoneBase, - schemas.IntBase, - schemas.Schema[schemas.T], - schemas.NoneDecimalMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - decimal.Decimal, - } - format = 'int' - - - def __new__( - cls, - arg_: typing.Union[ - None, - decimal.Decimal, - int - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.IntegerProp[ - typing.Union[ - schemas.NoneClass, - decimal.Decimal - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.IntegerProp[ - typing.Union[ - schemas.NoneClass, - decimal.Decimal - ] - ], - inst - ) - return inst - - - class NumberProp( - schemas.NoneBase, - schemas.NumberBase, - schemas.Schema[schemas.T], - schemas.NoneDecimalMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - decimal.Decimal, - } - - - def __new__( - cls, - arg_: typing.Union[ - None, - decimal.Decimal, - int, - float - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.NumberProp[ - typing.Union[ - schemas.NoneClass, - decimal.Decimal - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.NumberProp[ - typing.Union[ - schemas.NoneClass, - decimal.Decimal - ] - ], - inst - ) - return inst - - - class BooleanProp( - schemas.NoneBase, - schemas.BoolBase, - schemas.Schema[schemas.T], - schemas.NoneBoolMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - schemas.BoolClass, - } - - - def __new__( - cls, - arg_: typing.Union[ - None, - bool - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.BooleanProp[ - typing.Union[ - schemas.NoneClass, - schemas.BoolClass - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.BooleanProp[ - typing.Union[ - schemas.NoneClass, - schemas.BoolClass - ] - ], - inst - ) - return inst - - - class StringProp( - schemas.NoneBase, - schemas.StrBase, - schemas.Schema[schemas.T], - schemas.NoneStrMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - str, - } - - - def __new__( - cls, - arg_: typing.Union[ - None, - str - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.StringProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.StringProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ], - inst - ) - return inst - - - class DateProp( - schemas.NoneBase, - schemas.DateBase, - schemas.StrBase, - schemas.Schema[schemas.T], - schemas.NoneStrMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - str, - } - format = 'date' - - - def __new__( - cls, - arg_: typing.Union[ - None, - str, - datetime.date - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.DateProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.DateProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ], - inst - ) - return inst - - - class DatetimeProp( - schemas.NoneBase, - schemas.DateTimeBase, - schemas.StrBase, - schemas.Schema[schemas.T], - schemas.NoneStrMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - str, - } - format = 'date-time' - - - def __new__( - cls, - arg_: typing.Union[ - None, - str, - datetime.datetime - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.DatetimeProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.DatetimeProp[ - typing.Union[ - schemas.NoneClass, - str - ] - ], - inst - ) - return inst - - - class ArrayNullableProp( - schemas.NoneBase, - schemas.ListBase, - schemas.Schema[schemas.T], - schemas.NoneTupleMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - tuple, - } - Items: typing_extensions.TypeAlias = schemas.DictSchema[U] - - - def __new__( - cls, - arg_: typing.Union[ - None, - list, - tuple - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.ArrayNullableProp[ - typing.Union[ - schemas.NoneClass, - tuple - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ArrayNullableProp[ - typing.Union[ - schemas.NoneClass, - tuple - ] - ], - inst - ) - return inst - - - class ArrayAndItemsNullableProp( - schemas.NoneBase, - schemas.ListBase, - schemas.Schema[schemas.T], - schemas.NoneTupleMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - tuple, - } - - - class Items( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> NullableClass.Schema_.Properties.ArrayAndItemsNullableProp.Schema_.Items[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ArrayAndItemsNullableProp.Schema_.Items[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - - def __new__( - cls, - arg_: typing.Union[ - None, - list, - tuple - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.ArrayAndItemsNullableProp[ - typing.Union[ - schemas.NoneClass, - tuple - ] - ]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ArrayAndItemsNullableProp[ - typing.Union[ - schemas.NoneClass, - tuple - ] - ], - inst - ) - return inst - - - class ArrayItemsNullable( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> NullableClass.Schema_.Properties.ArrayItemsNullable.Schema_.Items[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ArrayItemsNullable.Schema_.Items[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]], - None, - dict, - frozendict.frozendict - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> NullableClass.Schema_.Properties.ArrayItemsNullable[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ArrayItemsNullable[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]]: - return super().__getitem__(name) - - - class ObjectNullableProp( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - AdditionalProperties: typing_extensions.TypeAlias = schemas.DictSchema[U] - - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[frozendict.frozendict]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[frozendict.frozendict], - dict, - frozendict.frozendict - ], - ) -> NullableClass.Schema_.Properties.ObjectNullableProp[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ObjectNullableProp[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - - class ObjectAndItemsNullableProp( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - class AdditionalProperties( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> NullableClass.Schema_.Properties.ObjectAndItemsNullableProp.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ObjectAndItemsNullableProp.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]], - None, - dict, - frozendict.frozendict - ], - ) -> NullableClass.Schema_.Properties.ObjectAndItemsNullableProp[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ObjectAndItemsNullableProp[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - - class ObjectItemsNullable( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - - class AdditionalProperties( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> NullableClass.Schema_.Properties.ObjectItemsNullable.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ObjectItemsNullable.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]]: - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ]], - None, - dict, - frozendict.frozendict - ], - ) -> NullableClass.Schema_.Properties.ObjectItemsNullable[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.Properties.ObjectItemsNullable[frozendict.frozendict], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "integer_prop": IntegerProp, "number_prop": NumberProp, "boolean_prop": BooleanProp, @@ -880,140 +989,78 @@ def __new__( "object_items_nullable": ObjectItemsNullable, } - - class AdditionalProperties( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> NullableClass.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - NullableClass.Schema_.AdditionalProperties[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst + @staticmethod + def additional_properties(): + return AdditionalProperties @typing.overload - def __getitem__(self, name: typing_extensions.Literal["integer_prop"]) -> Schema_.Properties.IntegerProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["integer_prop"]) -> IntegerProp[typing.Union[ schemas.NoneClass, decimal.Decimal ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number_prop"]) -> Schema_.Properties.NumberProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["number_prop"]) -> NumberProp[typing.Union[ schemas.NoneClass, decimal.Decimal ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["boolean_prop"]) -> Schema_.Properties.BooleanProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["boolean_prop"]) -> BooleanProp[typing.Union[ schemas.NoneClass, schemas.BoolClass ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["string_prop"]) -> Schema_.Properties.StringProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["string_prop"]) -> StringProp[typing.Union[ schemas.NoneClass, str ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date_prop"]) -> Schema_.Properties.DateProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["date_prop"]) -> DateProp[typing.Union[ schemas.NoneClass, str ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["datetime_prop"]) -> Schema_.Properties.DatetimeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["datetime_prop"]) -> DatetimeProp[typing.Union[ schemas.NoneClass, str ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_nullable_prop"]) -> Schema_.Properties.ArrayNullableProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["array_nullable_prop"]) -> ArrayNullableProp[typing.Union[ schemas.NoneClass, tuple ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_and_items_nullable_prop"]) -> Schema_.Properties.ArrayAndItemsNullableProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["array_and_items_nullable_prop"]) -> ArrayAndItemsNullableProp[typing.Union[ schemas.NoneClass, tuple ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["array_items_nullable"]) -> Schema_.Properties.ArrayItemsNullable[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["array_items_nullable"]) -> ArrayItemsNullable[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["object_nullable_prop"]) -> Schema_.Properties.ObjectNullableProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["object_nullable_prop"]) -> ObjectNullableProp[typing.Union[ schemas.NoneClass, frozendict.frozendict ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["object_and_items_nullable_prop"]) -> Schema_.Properties.ObjectAndItemsNullableProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["object_and_items_nullable_prop"]) -> ObjectAndItemsNullableProp[typing.Union[ schemas.NoneClass, frozendict.frozendict ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["object_items_nullable"]) -> Schema_.Properties.ObjectItemsNullable[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["object_items_nullable"]) -> ObjectItemsNullable[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ schemas.NoneClass, frozendict.frozendict ]]: ... @@ -1043,7 +1090,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], integer_prop: typing.Union[ - Schema_.Properties.IntegerProp[typing.Union[ + IntegerProp[typing.Union[ schemas.NoneClass, decimal.Decimal ]], @@ -1053,7 +1100,7 @@ def __new__( int ] = schemas.unset, number_prop: typing.Union[ - Schema_.Properties.NumberProp[typing.Union[ + NumberProp[typing.Union[ schemas.NoneClass, decimal.Decimal ]], @@ -1064,7 +1111,7 @@ def __new__( float ] = schemas.unset, boolean_prop: typing.Union[ - Schema_.Properties.BooleanProp[typing.Union[ + BooleanProp[typing.Union[ schemas.NoneClass, schemas.BoolClass ]], @@ -1073,7 +1120,7 @@ def __new__( bool ] = schemas.unset, string_prop: typing.Union[ - Schema_.Properties.StringProp[typing.Union[ + StringProp[typing.Union[ schemas.NoneClass, str ]], @@ -1082,7 +1129,7 @@ def __new__( str ] = schemas.unset, date_prop: typing.Union[ - Schema_.Properties.DateProp[typing.Union[ + DateProp[typing.Union[ schemas.NoneClass, str ]], @@ -1092,7 +1139,7 @@ def __new__( datetime.date ] = schemas.unset, datetime_prop: typing.Union[ - Schema_.Properties.DatetimeProp[typing.Union[ + DatetimeProp[typing.Union[ schemas.NoneClass, str ]], @@ -1102,7 +1149,7 @@ def __new__( datetime.datetime ] = schemas.unset, array_nullable_prop: typing.Union[ - Schema_.Properties.ArrayNullableProp[typing.Union[ + ArrayNullableProp[typing.Union[ schemas.NoneClass, tuple ]], @@ -1112,7 +1159,7 @@ def __new__( tuple ] = schemas.unset, array_and_items_nullable_prop: typing.Union[ - Schema_.Properties.ArrayAndItemsNullableProp[typing.Union[ + ArrayAndItemsNullableProp[typing.Union[ schemas.NoneClass, tuple ]], @@ -1122,13 +1169,13 @@ def __new__( tuple ] = schemas.unset, array_items_nullable: typing.Union[ - Schema_.Properties.ArrayItemsNullable[tuple], + ArrayItemsNullable[tuple], schemas.Unset, list, tuple ] = schemas.unset, object_nullable_prop: typing.Union[ - Schema_.Properties.ObjectNullableProp[typing.Union[ + ObjectNullableProp[typing.Union[ schemas.NoneClass, frozendict.frozendict ]], @@ -1138,7 +1185,7 @@ def __new__( frozendict.frozendict ] = schemas.unset, object_and_items_nullable_prop: typing.Union[ - Schema_.Properties.ObjectAndItemsNullableProp[typing.Union[ + ObjectAndItemsNullableProp[typing.Union[ schemas.NoneClass, frozendict.frozendict ]], @@ -1148,14 +1195,14 @@ def __new__( frozendict.frozendict ] = schemas.unset, object_items_nullable: typing.Union[ - Schema_.Properties.ObjectItemsNullable[frozendict.frozendict], + ObjectItemsNullable[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ + AdditionalProperties[typing.Union[ schemas.NoneClass, frozendict.frozendict ]], @@ -1187,3 +1234,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_shape.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_shape.py index 5173f0d6e46e..ee210b3974c4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_shape.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_shape.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_2: typing_extensions.TypeAlias = schemas.NoneSchema[U] + class NullableShape( schemas.AnyTypeSchema[schemas.T], @@ -26,21 +28,13 @@ class NullableShape( class Schema_: # any type - class OneOf: - - @staticmethod - def _0() -> typing.Type[triangle.Triangle]: - return triangle.Triangle - - @staticmethod - def _1() -> typing.Type[quadrilateral.Quadrilateral]: - return quadrilateral.Quadrilateral - _2: typing_extensions.TypeAlias = schemas.NoneSchema[U] - classes = [ - _0, - _1, + @staticmethod + def one_of(): + return ( + triangle.Triangle, + quadrilateral.Quadrilateral, _2, - ] + ) def __new__( @@ -118,5 +112,6 @@ def __new__( ) return inst + from petstore_api.components.schema import quadrilateral from petstore_api.components.schema import triangle diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_string.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_string.py index 34c036be5c0e..2c0817bfdaa7 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_string.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/nullable_string.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class NullableString( schemas.NoneBase, schemas.StrBase, @@ -59,3 +60,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number.py index 7223c7815761..286584e8a0d0 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Number: typing_extensions.TypeAlias = schemas.NumberSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_only.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_only.py index db95837f2d87..5bfb00760795 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_only.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_only.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +JustNumber: typing_extensions.TypeAlias = schemas.NumberSchema[U] + class NumberOnly( schemas.DictSchema[schemas.T] @@ -24,14 +26,14 @@ class NumberOnly( class Schema_: types = {frozendict.frozendict} - class Properties: - JustNumber: typing_extensions.TypeAlias = schemas.NumberSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "JustNumber": JustNumber, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["JustNumber"]) -> Schema_.Properties.JustNumber[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["JustNumber"]) -> JustNumber[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -59,7 +61,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], JustNumber: typing.Union[ - Schema_.Properties.JustNumber[decimal.Decimal], + JustNumber[decimal.Decimal], schemas.Unset, decimal.Decimal, int, @@ -98,3 +100,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_with_validations.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_with_validations.py index e4ecb4068af3..b551d7bd2a71 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_with_validations.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/number_with_validations.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class NumberWithValidations( schemas.NumberSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props.py index 82f155d961d8..ac4ef9b869dc 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +A: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ObjWithRequiredProps( schemas.DictSchema[schemas.T] @@ -29,28 +31,25 @@ class Schema_: "a", } - class Properties: - A: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "a": A, } - class AllOf: - - @staticmethod - def _0() -> typing.Type[obj_with_required_props_base.ObjWithRequiredPropsBase]: - return obj_with_required_props_base.ObjWithRequiredPropsBase - classes = [ - _0, - ] + @staticmethod + def all_of(): + return ( + obj_with_required_props_base.ObjWithRequiredPropsBase, + ) @property - def a(self) -> Schema_.Properties.A[str]: + def a(self) -> A[str]: return self.__getitem__("a") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["a"]) -> Schema_.Properties.A[str]: ... + def __getitem__(self, name: typing_extensions.Literal["a"]) -> A[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -78,7 +77,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], a: typing.Union[ - Schema_.Properties.A[str], + A[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -115,4 +114,5 @@ def __new__( ) return inst + from petstore_api.components.schema import obj_with_required_props_base diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props_base.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props_base.py index e3483dbd79b5..4b63daebabc1 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props_base.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/obj_with_required_props_base.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +B: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ObjWithRequiredPropsBase( schemas.DictSchema[schemas.T] @@ -27,18 +29,18 @@ class Schema_: "b", } - class Properties: - B: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "b": B, } @property - def b(self) -> Schema_.Properties.B[str]: + def b(self) -> B[str]: return self.__getitem__("b") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["b"]) -> Schema_.Properties.B[str]: ... + def __getitem__(self, name: typing_extensions.Literal["b"]) -> B[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -66,7 +68,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], b: typing.Union[ - Schema_.Properties.B[str], + B[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -102,3 +104,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_interface.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_interface.py index deb072f72771..1a3c6279e368 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_interface.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_interface.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + ObjectInterface: typing_extensions.TypeAlias = schemas.DictSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_arg_and_args_properties.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_arg_and_args_properties.py index f42727d5f13c..67d059e02fcd 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_arg_and_args_properties.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_arg_and_args_properties.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Arg: typing_extensions.TypeAlias = schemas.StrSchema[U] +Args: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ObjectModelWithArgAndArgsProperties( schemas.DictSchema[schemas.T] @@ -28,27 +31,26 @@ class Schema_: "args", } - class Properties: - Arg: typing_extensions.TypeAlias = schemas.StrSchema[U] - Args: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "arg": Arg, "args": Args, } @property - def arg(self) -> Schema_.Properties.Arg[str]: + def arg(self) -> Arg[str]: return self.__getitem__("arg") @property - def args(self) -> Schema_.Properties.Args[str]: + def args(self) -> Args[str]: return self.__getitem__("args") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["arg"]) -> Schema_.Properties.Arg[str]: ... + def __getitem__(self, name: typing_extensions.Literal["arg"]) -> Arg[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["args"]) -> Schema_.Properties.Args[str]: ... + def __getitem__(self, name: typing_extensions.Literal["args"]) -> Args[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -77,11 +79,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], arg: typing.Union[ - Schema_.Properties.Arg[str], + Arg[str], str ], args: typing.Union[ - Schema_.Properties.Args[str], + Args[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -118,3 +120,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_ref_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_ref_props.py index e35fd5909719..c074ce5146dd 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_model_with_ref_props.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ObjectModelWithRefProps( schemas.DictSchema[schemas.T] ): @@ -26,23 +27,12 @@ class ObjectModelWithRefProps( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def my_number() -> typing.Type[number_with_validations.NumberWithValidations]: - return number_with_validations.NumberWithValidations - - @staticmethod - def my_string() -> typing.Type[string.String]: - return string.String - - @staticmethod - def my_boolean() -> typing.Type[boolean.Boolean]: - return boolean.Boolean - __annotations__ = { - "myNumber": my_number, - "myString": my_string, - "myBoolean": my_boolean, + @staticmethod + def properties(): + return { + "myNumber": number_with_validations.NumberWithValidations, + "myString": string.String, + "myBoolean": boolean.Boolean, } @typing.overload @@ -134,6 +124,7 @@ def __new__( ) return inst + from petstore_api.components.schema import boolean from petstore_api.components.schema import number_with_validations from petstore_api.components.schema import string diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_all_of_with_req_test_prop_from_unset_add_prop.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_all_of_with_req_test_prop_from_unset_add_prop.py index 0ffaf4c68908..019b72251990 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_all_of_with_req_test_prop_from_unset_add_prop.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_all_of_with_req_test_prop_from_unset_add_prop.py @@ -10,6 +10,139 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + required = { + "test", + } + + @staticmethod + def properties(): + return { + "name": Name, + } + + @property + def test(self) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: + return self.__getitem__("test") + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["test"]) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["test"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + test: typing.Union[ + schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]], + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + test=test, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + class ObjectWithAllOfWithReqTestPropFromUnsetAddProp( schemas.AnyTypeSchema[schemas.T], @@ -24,145 +157,12 @@ class ObjectWithAllOfWithReqTestPropFromUnsetAddProp( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[object_with_optional_test_prop.ObjectWithOptionalTestProp]: - return object_with_optional_test_prop.ObjectWithOptionalTestProp - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - required = { - "test", - } - - class Properties: - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { - "name": Name, - } - - @property - def test(self) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: - return self.__getitem__("test") - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["test"]) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["test"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - test: typing.Union[ - schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]], - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - test=test, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ObjectWithAllOfWithReqTestPropFromUnsetAddProp.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + object_with_optional_test_prop.ObjectWithOptionalTestProp, _1, - ] + ) def __new__( @@ -240,4 +240,5 @@ def __new__( ) return inst + from petstore_api.components.schema import object_with_optional_test_prop diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_colliding_properties.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_colliding_properties.py index 6692d9398085..a7993aee7211 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_colliding_properties.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_colliding_properties.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +SomeProp: typing_extensions.TypeAlias = schemas.DictSchema[U] +Someprop: typing_extensions.TypeAlias = schemas.DictSchema[U] + class ObjectWithCollidingProperties( schemas.DictSchema[schemas.T] @@ -26,19 +29,18 @@ class ObjectWithCollidingProperties( class Schema_: types = {frozendict.frozendict} - class Properties: - SomeProp: typing_extensions.TypeAlias = schemas.DictSchema[U] - Someprop: typing_extensions.TypeAlias = schemas.DictSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "someProp": SomeProp, "someprop": Someprop, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> Schema_.Properties.SomeProp[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> SomeProp[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someprop"]) -> Schema_.Properties.Someprop[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["someprop"]) -> Someprop[frozendict.frozendict]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -67,13 +69,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], someProp: typing.Union[ - Schema_.Properties.SomeProp[frozendict.frozendict], + SomeProp[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, someprop: typing.Union[ - Schema_.Properties.Someprop[frozendict.frozendict], + Someprop[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict @@ -112,3 +114,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_decimal_properties.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_decimal_properties.py index 90205445f493..f79fd618cd8e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_decimal_properties.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_decimal_properties.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Width: typing_extensions.TypeAlias = schemas.DecimalSchema[U] + class ObjectWithDecimalProperties( schemas.DictSchema[schemas.T] @@ -24,27 +26,19 @@ class ObjectWithDecimalProperties( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def length() -> typing.Type[decimal_payload.DecimalPayload]: - return decimal_payload.DecimalPayload - Width: typing_extensions.TypeAlias = schemas.DecimalSchema[U] - - @staticmethod - def cost() -> typing.Type[money.Money]: - return money.Money - __annotations__ = { - "length": length, + @staticmethod + def properties(): + return { + "length": decimal_payload.DecimalPayload, "width": Width, - "cost": cost, + "cost": money.Money, } @typing.overload def __getitem__(self, name: typing_extensions.Literal["length"]) -> decimal_payload.DecimalPayload[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["width"]) -> Schema_.Properties.Width[str]: ... + def __getitem__(self, name: typing_extensions.Literal["width"]) -> Width[str]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["cost"]) -> money.Money[frozendict.frozendict]: ... @@ -82,7 +76,7 @@ def __new__( str ] = schemas.unset, width: typing.Union[ - Schema_.Properties.Width[str], + Width[str], schemas.Unset, str ] = schemas.unset, @@ -128,5 +122,6 @@ def __new__( ) return inst + from petstore_api.components.schema import decimal_payload from petstore_api.components.schema import money diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_difficultly_named_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_difficultly_named_props.py index 375f630e55ba..87fe055b1543 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_difficultly_named_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_difficultly_named_props.py @@ -10,6 +10,10 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +SpecialPropertyName: typing_extensions.TypeAlias = schemas.Int64Schema[U] +_123List: typing_extensions.TypeAlias = schemas.StrSchema[U] +_123Number: typing_extensions.TypeAlias = schemas.IntSchema[U] + class ObjectWithDifficultlyNamedProps( schemas.DictSchema[schemas.T] @@ -29,24 +33,22 @@ class Schema_: "123-list", } - class Properties: - SpecialPropertyName: typing_extensions.TypeAlias = schemas.Int64Schema[U] - _123List: typing_extensions.TypeAlias = schemas.StrSchema[U] - _123Number: typing_extensions.TypeAlias = schemas.IntSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "$special[property.name]": SpecialPropertyName, "123-list": _123List, "123Number": _123Number, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["123-list"]) -> Schema_.Properties._123List[str]: ... + def __getitem__(self, name: typing_extensions.Literal["123-list"]) -> _123List[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["$special[property.name]"]) -> Schema_.Properties.SpecialPropertyName[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["$special[property.name]"]) -> SpecialPropertyName[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["123Number"]) -> Schema_.Properties._123Number[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["123Number"]) -> _123Number[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -107,3 +109,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_inline_composition_property.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_inline_composition_property.py index 61c8b3b21da2..82d58c69d4a3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_inline_composition_property.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_inline_composition_property.py @@ -11,6 +11,111 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + +class SomeProp( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + + @staticmethod + def all_of(): + return ( + _0, + ) + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + class ObjectWithInlineCompositionProperty( schemas.DictSchema[schemas.T] ): @@ -24,115 +129,14 @@ class ObjectWithInlineCompositionProperty( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class SomeProp( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ - _0, - ] - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ObjectWithInlineCompositionProperty.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ObjectWithInlineCompositionProperty.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "someProp": SomeProp, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> Schema_.Properties.SomeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -169,7 +173,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], someProp: typing.Union[ - Schema_.Properties.SomeProp[typing.Union[ + SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -230,3 +234,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_invalid_named_refed_properties.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_invalid_named_refed_properties.py index 797bdd494b77..4155df1f3e71 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_invalid_named_refed_properties.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_invalid_named_refed_properties.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ObjectWithInvalidNamedRefedProperties( schemas.DictSchema[schemas.T] ): @@ -28,18 +29,11 @@ class Schema_: "from", } - class Properties: - - @staticmethod - def _from() -> typing.Type[from_schema.FromSchema]: - return from_schema.FromSchema - - @staticmethod - def reference() -> typing.Type[array_with_validations_in_items.ArrayWithValidationsInItems]: - return array_with_validations_in_items.ArrayWithValidationsInItems - __annotations__ = { - "from": _from, - "!reference": reference, + @staticmethod + def properties(): + return { + "from": from_schema.FromSchema, + "!reference": array_with_validations_in_items.ArrayWithValidationsInItems, } @typing.overload @@ -107,5 +101,6 @@ def __new__( ) return inst + from petstore_api.components.schema import array_with_validations_in_items from petstore_api.components.schema import from_schema diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_optional_test_prop.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_optional_test_prop.py index fe8cf9985f3e..84befb76a609 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_optional_test_prop.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_optional_test_prop.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Test: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ObjectWithOptionalTestProp( schemas.DictSchema[schemas.T] @@ -24,14 +26,14 @@ class ObjectWithOptionalTestProp( class Schema_: types = {frozendict.frozendict} - class Properties: - Test: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "test": Test, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["test"]) -> Schema_.Properties.Test[str]: ... + def __getitem__(self, name: typing_extensions.Literal["test"]) -> Test[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -59,7 +61,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], test: typing.Union[ - Schema_.Properties.Test[str], + Test[str], schemas.Unset, str ] = schemas.unset, @@ -96,3 +98,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_validations.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_validations.py index ec7fc27394b3..da47c6158f7d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_validations.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/object_with_validations.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ObjectWithValidations( schemas.DictSchema[schemas.T] ): @@ -60,3 +61,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/order.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/order.py index d2c647606e6b..a28c6630e71f 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/order.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/order.py @@ -10,6 +10,51 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] +PetId: typing_extensions.TypeAlias = schemas.Int64Schema[U] +Quantity: typing_extensions.TypeAlias = schemas.Int32Schema[U] +ShipDate: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] + + +class Status( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "placed": "PLACED", + "approved": "APPROVED", + "delivered": "DELIVERED", + } + + @schemas.classproperty + def PLACED(cls): + return cls("placed") # type: ignore + + @schemas.classproperty + def APPROVED(cls): + return cls("approved") # type: ignore + + @schemas.classproperty + def DELIVERED(cls): + return cls("delivered") # type: ignore + + +class Complete( + schemas.BoolSchema[schemas.T] +): + + + class Schema_: + types = { + schemas.BoolClass, + } + default = schemas.BoolClass.FALSE + class Order( schemas.DictSchema[schemas.T] @@ -24,52 +69,9 @@ class Order( class Schema_: types = {frozendict.frozendict} - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - PetId: typing_extensions.TypeAlias = schemas.Int64Schema[U] - Quantity: typing_extensions.TypeAlias = schemas.Int32Schema[U] - ShipDate: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] - - - class Status( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "placed": "PLACED", - "approved": "APPROVED", - "delivered": "DELIVERED", - } - - @schemas.classproperty - def PLACED(cls): - return cls("placed") # type: ignore - - @schemas.classproperty - def APPROVED(cls): - return cls("approved") # type: ignore - - @schemas.classproperty - def DELIVERED(cls): - return cls("delivered") # type: ignore - - - class Complete( - schemas.BoolSchema[schemas.T] - ): - - - class Schema_: - types = { - schemas.BoolClass, - } - default = schemas.BoolClass.FALSE - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, "petId": PetId, "quantity": Quantity, @@ -79,22 +81,22 @@ class Schema_: } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["petId"]) -> Schema_.Properties.PetId[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["petId"]) -> PetId[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["quantity"]) -> Schema_.Properties.Quantity[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["quantity"]) -> Quantity[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["shipDate"]) -> Schema_.Properties.ShipDate[str]: ... + def __getitem__(self, name: typing_extensions.Literal["shipDate"]) -> ShipDate[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> Schema_.Properties.Status[str]: ... + def __getitem__(self, name: typing_extensions.Literal["status"]) -> Status[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["complete"]) -> Schema_.Properties.Complete[schemas.BoolClass]: ... + def __getitem__(self, name: typing_extensions.Literal["complete"]) -> Complete[schemas.BoolClass]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -127,36 +129,36 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, petId: typing.Union[ - Schema_.Properties.PetId[decimal.Decimal], + PetId[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, quantity: typing.Union[ - Schema_.Properties.Quantity[decimal.Decimal], + Quantity[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, shipDate: typing.Union[ - Schema_.Properties.ShipDate[str], + ShipDate[str], schemas.Unset, str, datetime.datetime ] = schemas.unset, status: typing.Union[ - Schema_.Properties.Status[str], + Status[str], schemas.Unset, str ] = schemas.unset, complete: typing.Union[ - Schema_.Properties.Complete[schemas.BoolClass], + Complete[schemas.BoolClass], schemas.Unset, bool ] = schemas.unset, @@ -198,3 +200,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/parent_pet.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/parent_pet.py index 80b036939f4a..b403123fbb2d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/parent_pet.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/parent_pet.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ParentPet( schemas.DictSchema[schemas.T] ): @@ -34,14 +35,11 @@ def discriminator(): } } - class AllOf: - - @staticmethod - def _0() -> typing.Type[grandparent_animal.GrandparentAnimal]: - return grandparent_animal.GrandparentAnimal - classes = [ - _0, - ] + @staticmethod + def all_of(): + return ( + grandparent_animal.GrandparentAnimal, + ) def __new__( @@ -80,5 +78,6 @@ def __new__( ) return inst + from petstore_api.components.schema import child_cat from petstore_api.components.schema import grandparent_animal diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pet.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pet.py index 2b03afede87d..66817b5e311e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pet.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pet.py @@ -10,6 +10,115 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + +class PhotoUrls( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[str], + str + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> PhotoUrls[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + PhotoUrls[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[str]: + return super().__getitem__(name) + + + +class Tags( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return tag.Tag + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + tag.Tag[frozendict.frozendict], + dict, + frozendict.frozendict + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Tags[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Tags[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> tag.Tag[frozendict.frozendict]: + return super().__getitem__(name) + + + +class Status( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "available": "AVAILABLE", + "pending": "PENDING", + "sold": "SOLD", + } + + @schemas.classproperty + def AVAILABLE(cls): + return cls("available") # type: ignore + + @schemas.classproperty + def PENDING(cls): + return cls("pending") # type: ignore + + @schemas.classproperty + def SOLD(cls): + return cls("sold") # type: ignore + class Pet( schemas.DictSchema[schemas.T] @@ -30,116 +139,11 @@ class Schema_: "photoUrls", } - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - - @staticmethod - def category() -> typing.Type[category.Category]: - return category.Category - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - - - class PhotoUrls( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[str], - str - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> Pet.Schema_.Properties.PhotoUrls[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - Pet.Schema_.Properties.PhotoUrls[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[str]: - return super().__getitem__(name) - - - class Tags( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - @staticmethod - def items() -> typing.Type[tag.Tag]: - return tag.Tag - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - tag.Tag[frozendict.frozendict], - dict, - frozendict.frozendict - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> Pet.Schema_.Properties.Tags[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - Pet.Schema_.Properties.Tags[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> tag.Tag[frozendict.frozendict]: - return super().__getitem__(name) - - - class Status( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "available": "AVAILABLE", - "pending": "PENDING", - "sold": "SOLD", - } - - @schemas.classproperty - def AVAILABLE(cls): - return cls("available") # type: ignore - - @schemas.classproperty - def PENDING(cls): - return cls("pending") # type: ignore - - @schemas.classproperty - def SOLD(cls): - return cls("sold") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, - "category": category, + "category": category.Category, "name": Name, "photoUrls": PhotoUrls, "tags": Tags, @@ -147,30 +151,30 @@ def SOLD(cls): } @property - def name(self) -> Schema_.Properties.Name[str]: + def name(self) -> Name[str]: return self.__getitem__("name") @property - def photoUrls(self) -> Schema_.Properties.PhotoUrls[tuple]: + def photoUrls(self) -> PhotoUrls[tuple]: return self.__getitem__("photoUrls") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["photoUrls"]) -> Schema_.Properties.PhotoUrls[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["photoUrls"]) -> PhotoUrls[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["category"]) -> category.Category[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["tags"]) -> Schema_.Properties.Tags[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["tags"]) -> Tags[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> Schema_.Properties.Status[str]: ... + def __getitem__(self, name: typing_extensions.Literal["status"]) -> Status[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -203,16 +207,16 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], name: typing.Union[ - Schema_.Properties.Name[str], + Name[str], str ], photoUrls: typing.Union[ - Schema_.Properties.PhotoUrls[tuple], + PhotoUrls[tuple], list, tuple ], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int @@ -224,13 +228,13 @@ def __new__( frozendict.frozendict ] = schemas.unset, tags: typing.Union[ - Schema_.Properties.Tags[tuple], + Tags[tuple], schemas.Unset, list, tuple ] = schemas.unset, status: typing.Union[ - Schema_.Properties.Status[str], + Status[str], schemas.Unset, str ] = schemas.unset, @@ -273,5 +277,6 @@ def __new__( ) return inst + from petstore_api.components.schema import category from petstore_api.components.schema import tag diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pig.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pig.py index 47493c996079..d8bc435bca32 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pig.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/pig.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Pig( schemas.AnyTypeSchema[schemas.T], ): @@ -33,19 +34,12 @@ def discriminator(): } } - class OneOf: - - @staticmethod - def _0() -> typing.Type[basque_pig.BasquePig]: - return basque_pig.BasquePig - - @staticmethod - def _1() -> typing.Type[danish_pig.DanishPig]: - return danish_pig.DanishPig - classes = [ - _0, - _1, - ] + @staticmethod + def one_of(): + return ( + basque_pig.BasquePig, + danish_pig.DanishPig, + ) def __new__( @@ -123,5 +117,6 @@ def __new__( ) return inst + from petstore_api.components.schema import basque_pig from petstore_api.components.schema import danish_pig diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/player.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/player.py index a9d294b8b7a2..e8b00b3c716e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/player.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/player.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Player( schemas.DictSchema[schemas.T] @@ -26,19 +28,15 @@ class Player( class Schema_: types = {frozendict.frozendict} - class Properties: - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - - @staticmethod - def enemy_player() -> typing.Type[Player]: - return Player - __annotations__ = { + @staticmethod + def properties(): + return { "name": Name, - "enemyPlayer": enemy_player, + "enemyPlayer": Player, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["enemyPlayer"]) -> Player[frozendict.frozendict]: ... @@ -70,7 +68,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], name: typing.Union[ - Schema_.Properties.Name[str], + Name[str], schemas.Unset, str ] = schemas.unset, @@ -114,3 +112,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral.py index 98fa8bec5994..d0cc3f1c2d3b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Quadrilateral( schemas.AnyTypeSchema[schemas.T], ): @@ -33,19 +34,12 @@ def discriminator(): } } - class OneOf: - - @staticmethod - def _0() -> typing.Type[simple_quadrilateral.SimpleQuadrilateral]: - return simple_quadrilateral.SimpleQuadrilateral - - @staticmethod - def _1() -> typing.Type[complex_quadrilateral.ComplexQuadrilateral]: - return complex_quadrilateral.ComplexQuadrilateral - classes = [ - _0, - _1, - ] + @staticmethod + def one_of(): + return ( + simple_quadrilateral.SimpleQuadrilateral, + complex_quadrilateral.ComplexQuadrilateral, + ) def __new__( @@ -123,5 +117,6 @@ def __new__( ) return inst + from petstore_api.components.schema import complex_quadrilateral from petstore_api.components.schema import simple_quadrilateral diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral_interface.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral_interface.py index 6228c6492159..c33af7c9c597 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/quadrilateral_interface.py @@ -11,6 +11,26 @@ from petstore_api.shared_imports.schema_imports import * + +class ShapeType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "Quadrilateral": "QUADRILATERAL", + } + + @schemas.classproperty + def QUADRILATERAL(cls): + return cls("Quadrilateral") # type: ignore +QuadrilateralType: typing_extensions.TypeAlias = schemas.StrSchema[U] + + class QuadrilateralInterface( schemas.AnyTypeSchema[schemas.T], ): @@ -28,45 +48,27 @@ class Schema_: "shapeType", } - class Properties: - - - class ShapeType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "Quadrilateral": "QUADRILATERAL", - } - - @schemas.classproperty - def QUADRILATERAL(cls): - return cls("Quadrilateral") # type: ignore - QuadrilateralType: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "shapeType": ShapeType, "quadrilateralType": QuadrilateralType, } @property - def quadrilateralType(self) -> Schema_.Properties.QuadrilateralType[str]: + def quadrilateralType(self) -> QuadrilateralType[str]: return self.__getitem__("quadrilateralType") @property - def shapeType(self) -> Schema_.Properties.ShapeType[str]: + def shapeType(self) -> ShapeType[str]: return self.__getitem__("shapeType") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> Schema_.Properties.QuadrilateralType[str]: ... + def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> QuadrilateralType[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["shapeType"]) -> Schema_.Properties.ShapeType[str]: ... + def __getitem__(self, name: typing_extensions.Literal["shapeType"]) -> ShapeType[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -165,3 +167,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/read_only_first.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/read_only_first.py index bd7ed788b4e4..5739a784e80d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/read_only_first.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/read_only_first.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Bar: typing_extensions.TypeAlias = schemas.StrSchema[U] +Baz: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ReadOnlyFirst( schemas.DictSchema[schemas.T] @@ -24,19 +27,18 @@ class ReadOnlyFirst( class Schema_: types = {frozendict.frozendict} - class Properties: - Bar: typing_extensions.TypeAlias = schemas.StrSchema[U] - Baz: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "bar": Bar, "baz": Baz, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["bar"]) -> Schema_.Properties.Bar[str]: ... + def __getitem__(self, name: typing_extensions.Literal["bar"]) -> Bar[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["baz"]) -> Schema_.Properties.Baz[str]: ... + def __getitem__(self, name: typing_extensions.Literal["baz"]) -> Baz[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -65,12 +67,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], bar: typing.Union[ - Schema_.Properties.Bar[str], + Bar[str], schemas.Unset, str ] = schemas.unset, baz: typing.Union[ - Schema_.Properties.Baz[str], + Baz[str], schemas.Unset, str ] = schemas.unset, @@ -108,3 +110,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_explicit_add_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_explicit_add_props.py index a9049a2fe736..0ccad4470bb9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_explicit_add_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_explicit_add_props.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + class ReqPropsFromExplicitAddProps( schemas.DictSchema[schemas.T] @@ -27,20 +29,23 @@ class Schema_: "invalid-name", "validName", } - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def validName(self) -> Schema_.AdditionalProperties[str]: + def validName(self) -> AdditionalProperties[str]: return self.__getitem__("validName") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["invalid-name"]) -> Schema_.AdditionalProperties[str]: ... + def __getitem__(self, name: typing_extensions.Literal["invalid-name"]) -> AdditionalProperties[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["validName"]) -> Schema_.AdditionalProperties[str]: ... + def __getitem__(self, name: typing_extensions.Literal["validName"]) -> AdditionalProperties[str]: ... @typing.overload - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: ... + def __getitem__(self, name: str) -> AdditionalProperties[str]: ... def __getitem__( self, @@ -57,12 +62,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], validName: typing.Union[ - Schema_.AdditionalProperties[str], + AdditionalProperties[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], + AdditionalProperties[str], str ], ) -> ReqPropsFromExplicitAddProps[frozendict.frozendict]: @@ -78,3 +83,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_true_add_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_true_add_props.py index ec6a08871cb8..1ec053ac53b2 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_true_add_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_true_add_props.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class ReqPropsFromTrueAddProps( schemas.DictSchema[schemas.T] @@ -27,10 +29,13 @@ class Schema_: "invalid-name", "validName", } - AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def validName(self) -> Schema_.AdditionalProperties[typing.Union[ + def validName(self) -> AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -43,7 +48,7 @@ def validName(self) -> Schema_.AdditionalProperties[typing.Union[ return self.__getitem__("validName") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["invalid-name"]) -> Schema_.AdditionalProperties[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["invalid-name"]) -> AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -55,7 +60,7 @@ def __getitem__(self, name: typing_extensions.Literal["invalid-name"]) -> Schema ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["validName"]) -> Schema_.AdditionalProperties[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["validName"]) -> AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -67,7 +72,7 @@ def __getitem__(self, name: typing_extensions.Literal["validName"]) -> Schema_.A ]]: ... @typing.overload - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -93,7 +98,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], validName: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ + AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -122,7 +127,7 @@ def __new__( ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ + AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -162,3 +167,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_unset_add_props.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_unset_add_props.py index 922083c5374d..7e730f9fed57 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_unset_add_props.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/req_props_from_unset_add_props.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class ReqPropsFromUnsetAddProps( schemas.DictSchema[schemas.T] ): @@ -152,3 +153,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/scalene_triangle.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/scalene_triangle.py index da55a3ef1291..a2be26159f65 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/scalene_triangle.py @@ -11,6 +11,108 @@ from petstore_api.shared_imports.schema_imports import * + +class TriangleType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "ScaleneTriangle": "SCALENE_TRIANGLE", + } + + @schemas.classproperty + def SCALENE_TRIANGLE(cls): + return cls("ScaleneTriangle") # type: ignore + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "triangleType": TriangleType, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> TriangleType[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["triangleType"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + triangleType: typing.Union[ + TriangleType[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + triangleType=triangleType, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + class ScaleneTriangle( schemas.AnyTypeSchema[schemas.T], ): @@ -24,114 +126,12 @@ class ScaleneTriangle( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[triangle_interface.TriangleInterface]: - return triangle_interface.TriangleInterface - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - - - class TriangleType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "ScaleneTriangle": "SCALENE_TRIANGLE", - } - - @schemas.classproperty - def SCALENE_TRIANGLE(cls): - return cls("ScaleneTriangle") # type: ignore - __annotations__ = { - "triangleType": TriangleType, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> Schema_.Properties.TriangleType[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["triangleType"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - triangleType: typing.Union[ - Schema_.Properties.TriangleType[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> ScaleneTriangle.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - triangleType=triangleType, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - ScaleneTriangle.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + triangle_interface.TriangleInterface, _1, - ] + ) def __new__( @@ -209,4 +209,5 @@ def __new__( ) return inst + from petstore_api.components.schema import triangle_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_array_model.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_array_model.py index 6dfafa9f5f72..f4fb92cda782 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_array_model.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_array_model.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class SelfReferencingArrayModel( schemas.ListSchema[schemas.T] ): @@ -25,7 +26,7 @@ class Schema_: types = {tuple} @staticmethod - def items() -> typing.Type[SelfReferencingArrayModel]: + def items(): return SelfReferencingArrayModel def __new__( @@ -52,3 +53,4 @@ def __new__( def __getitem__(self, name: int) -> SelfReferencingArrayModel[tuple]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_object_model.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_object_model.py index 780922a2bbe6..36bb7dea60a2 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_object_model.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/self_referencing_object_model.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class SelfReferencingObjectModel( schemas.DictSchema[schemas.T] ): @@ -24,17 +25,14 @@ class SelfReferencingObjectModel( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def self_ref() -> typing.Type[SelfReferencingObjectModel]: - return SelfReferencingObjectModel - __annotations__ = { - "selfRef": self_ref, + @staticmethod + def properties(): + return { + "selfRef": SelfReferencingObjectModel, } @staticmethod - def additional_properties() -> typing.Type[SelfReferencingObjectModel]: + def additional_properties(): return SelfReferencingObjectModel @typing.overload @@ -81,3 +79,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape.py index f3b7ee652998..51834924ee82 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Shape( schemas.AnyTypeSchema[schemas.T], ): @@ -33,19 +34,12 @@ def discriminator(): } } - class OneOf: - - @staticmethod - def _0() -> typing.Type[triangle.Triangle]: - return triangle.Triangle - - @staticmethod - def _1() -> typing.Type[quadrilateral.Quadrilateral]: - return quadrilateral.Quadrilateral - classes = [ - _0, - _1, - ] + @staticmethod + def one_of(): + return ( + triangle.Triangle, + quadrilateral.Quadrilateral, + ) def __new__( @@ -123,5 +117,6 @@ def __new__( ) return inst + from petstore_api.components.schema import quadrilateral from petstore_api.components.schema import triangle diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape_or_null.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape_or_null.py index b1abd2a96c7b..8a6618cc4dfe 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape_or_null.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/shape_or_null.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +_0: typing_extensions.TypeAlias = schemas.NoneSchema[U] + class ShapeOrNull( schemas.AnyTypeSchema[schemas.T], @@ -35,21 +37,13 @@ def discriminator(): } } - class OneOf: - _0: typing_extensions.TypeAlias = schemas.NoneSchema[U] - - @staticmethod - def _1() -> typing.Type[triangle.Triangle]: - return triangle.Triangle - - @staticmethod - def _2() -> typing.Type[quadrilateral.Quadrilateral]: - return quadrilateral.Quadrilateral - classes = [ + @staticmethod + def one_of(): + return ( _0, - _1, - _2, - ] + triangle.Triangle, + quadrilateral.Quadrilateral, + ) def __new__( @@ -127,5 +121,6 @@ def __new__( ) return inst + from petstore_api.components.schema import quadrilateral from petstore_api.components.schema import triangle diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/simple_quadrilateral.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/simple_quadrilateral.py index 7e7786c516a7..1604cec8f400 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/simple_quadrilateral.py @@ -11,6 +11,108 @@ from petstore_api.shared_imports.schema_imports import * + +class QuadrilateralType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "SimpleQuadrilateral": "SIMPLE_QUADRILATERAL", + } + + @schemas.classproperty + def SIMPLE_QUADRILATERAL(cls): + return cls("SimpleQuadrilateral") # type: ignore + + +class _1( + schemas.DictSchema[schemas.T] +): + + + class Schema_: + types = {frozendict.frozendict} + + @staticmethod + def properties(): + return { + "quadrilateralType": QuadrilateralType, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> QuadrilateralType[str]: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ]]: ... + + def __getitem__( + self, + name: typing.Union[ + typing_extensions.Literal["quadrilateralType"], + str + ] + ): + # dict_instance[name] accessor + return super().__getitem__(name) + + def __new__( + cls, + *args_: typing.Union[dict, frozendict.frozendict], + quadrilateralType: typing.Union[ + QuadrilateralType[str], + schemas.Unset, + str + ] = schemas.unset, + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> _1[frozendict.frozendict]: + inst = super().__new__( + cls, + *args_, + quadrilateralType=quadrilateralType, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + _1[frozendict.frozendict], + inst + ) + return inst + + + class SimpleQuadrilateral( schemas.AnyTypeSchema[schemas.T], ): @@ -24,114 +126,12 @@ class SimpleQuadrilateral( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[quadrilateral_interface.QuadrilateralInterface]: - return quadrilateral_interface.QuadrilateralInterface - - - class _1( - schemas.DictSchema[schemas.T] - ): - - - class Schema_: - types = {frozendict.frozendict} - - class Properties: - - - class QuadrilateralType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "SimpleQuadrilateral": "SIMPLE_QUADRILATERAL", - } - - @schemas.classproperty - def SIMPLE_QUADRILATERAL(cls): - return cls("SimpleQuadrilateral") # type: ignore - __annotations__ = { - "quadrilateralType": QuadrilateralType, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["quadrilateralType"]) -> Schema_.Properties.QuadrilateralType[str]: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ]]: ... - - def __getitem__( - self, - name: typing.Union[ - typing_extensions.Literal["quadrilateralType"], - str - ] - ): - # dict_instance[name] accessor - return super().__getitem__(name) - - def __new__( - cls, - *args_: typing.Union[dict, frozendict.frozendict], - quadrilateralType: typing.Union[ - Schema_.Properties.QuadrilateralType[str], - schemas.Unset, - str - ] = schemas.unset, - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> SimpleQuadrilateral.Schema_.AllOf._1[frozendict.frozendict]: - inst = super().__new__( - cls, - *args_, - quadrilateralType=quadrilateralType, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - SimpleQuadrilateral.Schema_.AllOf._1[frozendict.frozendict], - inst - ) - return inst - classes = [ - _0, + @staticmethod + def all_of(): + return ( + quadrilateral_interface.QuadrilateralInterface, _1, - ] + ) def __new__( @@ -209,4 +209,5 @@ def __new__( ) return inst + from petstore_api.components.schema import quadrilateral_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/some_object.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/some_object.py index a2ee26dfdd9e..e2eeedac3543 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/some_object.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/some_object.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class SomeObject( schemas.AnyTypeSchema[schemas.T], ): @@ -24,14 +25,11 @@ class SomeObject( class Schema_: # any type - class AllOf: - - @staticmethod - def _0() -> typing.Type[object_interface.ObjectInterface]: - return object_interface.ObjectInterface - classes = [ - _0, - ] + @staticmethod + def all_of(): + return ( + object_interface.ObjectInterface, + ) def __new__( @@ -109,4 +107,5 @@ def __new__( ) return inst + from petstore_api.components.schema import object_interface diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/special_model_name.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/special_model_name.py index 2f038b7d7c6f..e3f4ac32f035 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/special_model_name.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/special_model_name.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +A: typing_extensions.TypeAlias = schemas.StrSchema[U] + class SpecialModelName( schemas.DictSchema[schemas.T] @@ -26,14 +28,14 @@ class SpecialModelName( class Schema_: types = {frozendict.frozendict} - class Properties: - A: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "a": A, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["a"]) -> Schema_.Properties.A[str]: ... + def __getitem__(self, name: typing_extensions.Literal["a"]) -> A[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -61,7 +63,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], a: typing.Union[ - Schema_.Properties.A[str], + A[str], schemas.Unset, str ] = schemas.unset, @@ -98,3 +100,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string.py index bb7428c5242e..0320d99e1281 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + String: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_boolean_map.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_boolean_map.py index 352be6233535..2cb73968fb13 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_boolean_map.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_boolean_map.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.BoolSchema[U] + class StringBooleanMap( schemas.DictSchema[schemas.T] @@ -23,9 +25,12 @@ class StringBooleanMap( class Schema_: types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.BoolSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[schemas.BoolClass]: + def __getitem__(self, name: str) -> AdditionalProperties[schemas.BoolClass]: # dict_instance[name] accessor return super().__getitem__(name) @@ -34,7 +39,7 @@ def __new__( *args_: typing.Union[dict, frozendict.frozendict], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[schemas.BoolClass], + AdditionalProperties[schemas.BoolClass], bool ], ) -> StringBooleanMap[frozendict.frozendict]: @@ -49,3 +54,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum.py index 3d3a3a6d82de..82a5d64f9d72 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class StringEnum( schemas.NoneBase, schemas.StrBase, @@ -96,3 +97,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum_with_default_value.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum_with_default_value.py index 7ddcd057da18..34d9bff55c1e 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum_with_default_value.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_enum_with_default_value.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class StringEnumWithDefaultValue( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_with_validation.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_with_validation.py index aac797b4e9f3..e792cb4cdcb4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_with_validation.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/string_with_validation.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class StringWithValidation( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/tag.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/tag.py index 2e749c27f199..d400686859ed 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/tag.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/tag.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Tag( schemas.DictSchema[schemas.T] @@ -24,19 +27,18 @@ class Tag( class Schema_: types = {frozendict.frozendict} - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, "name": Name, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -65,13 +67,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, name: typing.Union[ - Schema_.Properties.Name[str], + Name[str], schemas.Unset, str ] = schemas.unset, @@ -109,3 +111,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle.py index a12d4387b7fc..82fbd60689be 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Triangle( schemas.AnyTypeSchema[schemas.T], ): @@ -34,24 +35,13 @@ def discriminator(): } } - class OneOf: - - @staticmethod - def _0() -> typing.Type[equilateral_triangle.EquilateralTriangle]: - return equilateral_triangle.EquilateralTriangle - - @staticmethod - def _1() -> typing.Type[isosceles_triangle.IsoscelesTriangle]: - return isosceles_triangle.IsoscelesTriangle - - @staticmethod - def _2() -> typing.Type[scalene_triangle.ScaleneTriangle]: - return scalene_triangle.ScaleneTriangle - classes = [ - _0, - _1, - _2, - ] + @staticmethod + def one_of(): + return ( + equilateral_triangle.EquilateralTriangle, + isosceles_triangle.IsoscelesTriangle, + scalene_triangle.ScaleneTriangle, + ) def __new__( @@ -129,6 +119,7 @@ def __new__( ) return inst + from petstore_api.components.schema import equilateral_triangle from petstore_api.components.schema import isosceles_triangle from petstore_api.components.schema import scalene_triangle diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle_interface.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle_interface.py index 3cea7493ca7d..75fda37b5489 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle_interface.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/triangle_interface.py @@ -11,6 +11,26 @@ from petstore_api.shared_imports.schema_imports import * + +class ShapeType( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "Triangle": "TRIANGLE", + } + + @schemas.classproperty + def TRIANGLE(cls): + return cls("Triangle") # type: ignore +TriangleType: typing_extensions.TypeAlias = schemas.StrSchema[U] + + class TriangleInterface( schemas.AnyTypeSchema[schemas.T], ): @@ -28,45 +48,27 @@ class Schema_: "triangleType", } - class Properties: - - - class ShapeType( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "Triangle": "TRIANGLE", - } - - @schemas.classproperty - def TRIANGLE(cls): - return cls("Triangle") # type: ignore - TriangleType: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "shapeType": ShapeType, "triangleType": TriangleType, } @property - def shapeType(self) -> Schema_.Properties.ShapeType[str]: + def shapeType(self) -> ShapeType[str]: return self.__getitem__("shapeType") @property - def triangleType(self) -> Schema_.Properties.TriangleType[str]: + def triangleType(self) -> TriangleType[str]: return self.__getitem__("triangleType") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["shapeType"]) -> Schema_.Properties.ShapeType[str]: ... + def __getitem__(self, name: typing_extensions.Literal["shapeType"]) -> ShapeType[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> Schema_.Properties.TriangleType[str]: ... + def __getitem__(self, name: typing_extensions.Literal["triangleType"]) -> TriangleType[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -165,3 +167,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/user.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/user.py index 12e24f6bfd2c..25ccb1240a50 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/user.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/user.py @@ -10,6 +10,176 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] +Username: typing_extensions.TypeAlias = schemas.StrSchema[U] +FirstName: typing_extensions.TypeAlias = schemas.StrSchema[U] +LastName: typing_extensions.TypeAlias = schemas.StrSchema[U] +Email: typing_extensions.TypeAlias = schemas.StrSchema[U] +Password: typing_extensions.TypeAlias = schemas.StrSchema[U] +Phone: typing_extensions.TypeAlias = schemas.StrSchema[U] +UserStatus: typing_extensions.TypeAlias = schemas.Int32Schema[U] +ObjectWithNoDeclaredProps: typing_extensions.TypeAlias = schemas.DictSchema[U] + + +class ObjectWithNoDeclaredPropsNullable( + schemas.NoneBase, + schemas.DictBase, + schemas.Schema[schemas.T], + schemas.NoneFrozenDictMixin +): + + + class Schema_: + types = { + schemas.NoneClass, + frozendict.frozendict, + } + + + def __new__( + cls, + *args_: typing.Union[ + None, + dict, + frozendict.frozendict + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> ObjectWithNoDeclaredPropsNullable[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + ObjectWithNoDeclaredPropsNullable[ + typing.Union[ + schemas.NoneClass, + frozendict.frozendict + ] + ], + inst + ) + return inst + +AnyTypeProp: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] +_Not: typing_extensions.TypeAlias = schemas.NoneSchema[U] + + +class AnyTypeExceptNullProp( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + + @staticmethod + def not_(): + return _Not + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> AnyTypeExceptNullProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + AnyTypeExceptNullProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + +AnyTypePropNullable: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + class User( schemas.DictSchema[schemas.T] @@ -24,171 +194,9 @@ class User( class Schema_: types = {frozendict.frozendict} - class Properties: - Id: typing_extensions.TypeAlias = schemas.Int64Schema[U] - Username: typing_extensions.TypeAlias = schemas.StrSchema[U] - FirstName: typing_extensions.TypeAlias = schemas.StrSchema[U] - LastName: typing_extensions.TypeAlias = schemas.StrSchema[U] - Email: typing_extensions.TypeAlias = schemas.StrSchema[U] - Password: typing_extensions.TypeAlias = schemas.StrSchema[U] - Phone: typing_extensions.TypeAlias = schemas.StrSchema[U] - UserStatus: typing_extensions.TypeAlias = schemas.Int32Schema[U] - ObjectWithNoDeclaredProps: typing_extensions.TypeAlias = schemas.DictSchema[U] - - - class ObjectWithNoDeclaredPropsNullable( - schemas.NoneBase, - schemas.DictBase, - schemas.Schema[schemas.T], - schemas.NoneFrozenDictMixin - ): - - - class Schema_: - types = { - schemas.NoneClass, - frozendict.frozendict, - } - - - def __new__( - cls, - *args_: typing.Union[ - None, - dict, - frozendict.frozendict - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> User.Schema_.Properties.ObjectWithNoDeclaredPropsNullable[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - User.Schema_.Properties.ObjectWithNoDeclaredPropsNullable[ - typing.Union[ - schemas.NoneClass, - frozendict.frozendict - ] - ], - inst - ) - return inst - AnyTypeProp: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - - - class AnyTypeExceptNullProp( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - _Not: typing_extensions.TypeAlias = schemas.NoneSchema[U] - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> User.Schema_.Properties.AnyTypeExceptNullProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - User.Schema_.Properties.AnyTypeExceptNullProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - AnyTypePropNullable: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "id": Id, "username": Username, "firstName": FirstName, @@ -205,40 +213,40 @@ def __new__( } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> Schema_.Properties.Id[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["id"]) -> Id[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["username"]) -> Schema_.Properties.Username[str]: ... + def __getitem__(self, name: typing_extensions.Literal["username"]) -> Username[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["firstName"]) -> Schema_.Properties.FirstName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["firstName"]) -> FirstName[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["lastName"]) -> Schema_.Properties.LastName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["lastName"]) -> LastName[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["email"]) -> Schema_.Properties.Email[str]: ... + def __getitem__(self, name: typing_extensions.Literal["email"]) -> Email[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["password"]) -> Schema_.Properties.Password[str]: ... + def __getitem__(self, name: typing_extensions.Literal["password"]) -> Password[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["phone"]) -> Schema_.Properties.Phone[str]: ... + def __getitem__(self, name: typing_extensions.Literal["phone"]) -> Phone[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["userStatus"]) -> Schema_.Properties.UserStatus[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["userStatus"]) -> UserStatus[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["objectWithNoDeclaredProps"]) -> Schema_.Properties.ObjectWithNoDeclaredProps[frozendict.frozendict]: ... + def __getitem__(self, name: typing_extensions.Literal["objectWithNoDeclaredProps"]) -> ObjectWithNoDeclaredProps[frozendict.frozendict]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["objectWithNoDeclaredPropsNullable"]) -> Schema_.Properties.ObjectWithNoDeclaredPropsNullable[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["objectWithNoDeclaredPropsNullable"]) -> ObjectWithNoDeclaredPropsNullable[typing.Union[ schemas.NoneClass, frozendict.frozendict ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["anyTypeProp"]) -> Schema_.Properties.AnyTypeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["anyTypeProp"]) -> AnyTypeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -250,7 +258,7 @@ def __getitem__(self, name: typing_extensions.Literal["anyTypeProp"]) -> Schema_ ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["anyTypeExceptNullProp"]) -> Schema_.Properties.AnyTypeExceptNullProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["anyTypeExceptNullProp"]) -> AnyTypeExceptNullProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -262,7 +270,7 @@ def __getitem__(self, name: typing_extensions.Literal["anyTypeExceptNullProp"]) ]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["anyTypePropNullable"]) -> Schema_.Properties.AnyTypePropNullable[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["anyTypePropNullable"]) -> AnyTypePropNullable[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -311,55 +319,55 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], id: typing.Union[ - Schema_.Properties.Id[decimal.Decimal], + Id[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, username: typing.Union[ - Schema_.Properties.Username[str], + Username[str], schemas.Unset, str ] = schemas.unset, firstName: typing.Union[ - Schema_.Properties.FirstName[str], + FirstName[str], schemas.Unset, str ] = schemas.unset, lastName: typing.Union[ - Schema_.Properties.LastName[str], + LastName[str], schemas.Unset, str ] = schemas.unset, email: typing.Union[ - Schema_.Properties.Email[str], + Email[str], schemas.Unset, str ] = schemas.unset, password: typing.Union[ - Schema_.Properties.Password[str], + Password[str], schemas.Unset, str ] = schemas.unset, phone: typing.Union[ - Schema_.Properties.Phone[str], + Phone[str], schemas.Unset, str ] = schemas.unset, userStatus: typing.Union[ - Schema_.Properties.UserStatus[decimal.Decimal], + UserStatus[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, objectWithNoDeclaredProps: typing.Union[ - Schema_.Properties.ObjectWithNoDeclaredProps[frozendict.frozendict], + ObjectWithNoDeclaredProps[frozendict.frozendict], schemas.Unset, dict, frozendict.frozendict ] = schemas.unset, objectWithNoDeclaredPropsNullable: typing.Union[ - Schema_.Properties.ObjectWithNoDeclaredPropsNullable[typing.Union[ + ObjectWithNoDeclaredPropsNullable[typing.Union[ schemas.NoneClass, frozendict.frozendict ]], @@ -369,7 +377,7 @@ def __new__( frozendict.frozendict ] = schemas.unset, anyTypeProp: typing.Union[ - Schema_.Properties.AnyTypeProp[typing.Union[ + AnyTypeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -398,7 +406,7 @@ def __new__( io.BufferedReader ] = schemas.unset, anyTypeExceptNullProp: typing.Union[ - Schema_.Properties.AnyTypeExceptNullProp[typing.Union[ + AnyTypeExceptNullProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -427,7 +435,7 @@ def __new__( io.BufferedReader ] = schemas.unset, anyTypePropNullable: typing.Union[ - Schema_.Properties.AnyTypePropNullable[typing.Union[ + AnyTypePropNullable[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -500,3 +508,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/uuid_string.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/uuid_string.py index 34aa23ea49ea..13fd0cb22b5d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/uuid_string.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/uuid_string.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class UUIDString( schemas.UUIDSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/whale.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/whale.py index c9eae619c4e1..1245b6b382cc 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/whale.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/whale.py @@ -10,6 +10,27 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +HasBaleen: typing_extensions.TypeAlias = schemas.BoolSchema[U] +HasTeeth: typing_extensions.TypeAlias = schemas.BoolSchema[U] + + +class ClassName( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "whale": "WHALE", + } + + @schemas.classproperty + def WHALE(cls): + return cls("whale") # type: ignore + class Whale( schemas.DictSchema[schemas.T] @@ -27,45 +48,26 @@ class Schema_: "className", } - class Properties: - HasBaleen: typing_extensions.TypeAlias = schemas.BoolSchema[U] - HasTeeth: typing_extensions.TypeAlias = schemas.BoolSchema[U] - - - class ClassName( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "whale": "WHALE", - } - - @schemas.classproperty - def WHALE(cls): - return cls("whale") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "hasBaleen": HasBaleen, "hasTeeth": HasTeeth, "className": ClassName, } @property - def className(self) -> Schema_.Properties.ClassName[str]: + def className(self) -> ClassName[str]: return self.__getitem__("className") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["className"]) -> Schema_.Properties.ClassName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["className"]) -> ClassName[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["hasBaleen"]) -> Schema_.Properties.HasBaleen[schemas.BoolClass]: ... + def __getitem__(self, name: typing_extensions.Literal["hasBaleen"]) -> HasBaleen[schemas.BoolClass]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["hasTeeth"]) -> Schema_.Properties.HasTeeth[schemas.BoolClass]: ... + def __getitem__(self, name: typing_extensions.Literal["hasTeeth"]) -> HasTeeth[schemas.BoolClass]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -95,16 +97,16 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], className: typing.Union[ - Schema_.Properties.ClassName[str], + ClassName[str], str ], hasBaleen: typing.Union[ - Schema_.Properties.HasBaleen[schemas.BoolClass], + HasBaleen[schemas.BoolClass], schemas.Unset, bool ] = schemas.unset, hasTeeth: typing.Union[ - Schema_.Properties.HasTeeth[schemas.BoolClass], + HasTeeth[schemas.BoolClass], schemas.Unset, bool ] = schemas.unset, @@ -143,3 +145,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/zebra.py b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/zebra.py index 3418b48e5254..2d3f8904164b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/zebra.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/components/schema/zebra.py @@ -10,6 +10,54 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + +class Type( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "plains": "PLAINS", + "mountain": "MOUNTAIN", + "grevys": "GREVYS", + } + + @schemas.classproperty + def PLAINS(cls): + return cls("plains") # type: ignore + + @schemas.classproperty + def MOUNTAIN(cls): + return cls("mountain") # type: ignore + + @schemas.classproperty + def GREVYS(cls): + return cls("grevys") # type: ignore + + +class ClassName( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + enum_value_to_name = { + "zebra": "ZEBRA", + } + + @schemas.classproperty + def ZEBRA(cls): + return cls("zebra") # type: ignore + class Zebra( schemas.DictSchema[schemas.T] @@ -27,71 +75,29 @@ class Schema_: "className", } - class Properties: - - - class Type( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "plains": "PLAINS", - "mountain": "MOUNTAIN", - "grevys": "GREVYS", - } - - @schemas.classproperty - def PLAINS(cls): - return cls("plains") # type: ignore - - @schemas.classproperty - def MOUNTAIN(cls): - return cls("mountain") # type: ignore - - @schemas.classproperty - def GREVYS(cls): - return cls("grevys") # type: ignore - - - class ClassName( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - enum_value_to_name = { - "zebra": "ZEBRA", - } - - @schemas.classproperty - def ZEBRA(cls): - return cls("zebra") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "type": Type, "className": ClassName, } - AdditionalProperties: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties @property - def className(self) -> Schema_.Properties.ClassName[str]: + def className(self) -> ClassName[str]: return self.__getitem__("className") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["className"]) -> Schema_.Properties.ClassName[str]: ... + def __getitem__(self, name: typing_extensions.Literal["className"]) -> ClassName[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> Schema_.Properties.Type[str]: ... + def __getitem__(self, name: typing_extensions.Literal["type"]) -> Type[str]: ... @typing.overload - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[typing.Union[ + def __getitem__(self, name: str) -> AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -117,17 +123,17 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], className: typing.Union[ - Schema_.Properties.ClassName[str], + ClassName[str], str ], type: typing.Union[ - Schema_.Properties.Type[str], + Type[str], schemas.Unset, str ] = schemas.unset, configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[typing.Union[ + AdditionalProperties[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -168,3 +174,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/configurations/schema_configuration.py b/samples/openapi3/client/petstore/python/src/petstore_api/configurations/schema_configuration.py index 773588a3248c..756b946cf054 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/configurations/schema_configuration.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/configurations/schema_configuration.py @@ -31,15 +31,12 @@ 'format': 'format', 'required': 'required', 'items': 'items', - 'Items': 'items', - 'Properties': 'properties', + 'properties': 'properties', 'additional_properties': 'additionalProperties', - 'additionalProperties': 'additionalProperties', - 'OneOf': 'oneOf', - 'AnyOf': 'anyOf', - 'AllOf': 'allOf', - '_not': 'not', - '_Not': 'not', + 'one_of': 'oneOf', + 'any_of': 'anyOf', + 'all_of': 'allOf', + 'not_': 'not', 'discriminator': 'discriminator' } diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_1/schema.py index af34848077fb..9eb9c650abfe 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_1/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_2/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_2/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_2/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_2/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_3/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_3/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_3/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_3/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_4/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_4/schema.py index af34848077fb..9eb9c650abfe 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_4/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_4/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_5/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_5/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_5/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/delete/parameters/parameter_5/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_0/schema.py index 9b7c4fcf5b04..64a8cad64b58 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_0/schema.py @@ -11,6 +11,31 @@ from petstore_api.shared_imports.schema_imports import * + +class Items( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "$" + enum_value_to_name = { + ">": "GREATER_THAN_SIGN", + "$": "DOLLAR_SIGN", + } + + @schemas.classproperty + def GREATER_THAN_SIGN(cls): + return cls(">") # type: ignore + + @schemas.classproperty + def DOLLAR_SIGN(cls): + return cls("$") # type: ignore + + class Schema( schemas.ListSchema[schemas.T] ): @@ -19,35 +44,15 @@ class Schema( class Schema_: types = {tuple} - - class Items( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "$" - enum_value_to_name = { - ">": "GREATER_THAN_SIGN", - "$": "DOLLAR_SIGN", - } - - @schemas.classproperty - def GREATER_THAN_SIGN(cls): - return cls(">") # type: ignore - - @schemas.classproperty - def DOLLAR_SIGN(cls): - return cls("$") # type: ignore + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -64,5 +69,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_1/schema.py index d1695293c617..45de909966e3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_1/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_2/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_2/schema.py index 9b7c4fcf5b04..64a8cad64b58 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_2/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_2/schema.py @@ -11,6 +11,31 @@ from petstore_api.shared_imports.schema_imports import * + +class Items( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "$" + enum_value_to_name = { + ">": "GREATER_THAN_SIGN", + "$": "DOLLAR_SIGN", + } + + @schemas.classproperty + def GREATER_THAN_SIGN(cls): + return cls(">") # type: ignore + + @schemas.classproperty + def DOLLAR_SIGN(cls): + return cls("$") # type: ignore + + class Schema( schemas.ListSchema[schemas.T] ): @@ -19,35 +44,15 @@ class Schema( class Schema_: types = {tuple} - - class Items( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "$" - enum_value_to_name = { - ">": "GREATER_THAN_SIGN", - "$": "DOLLAR_SIGN", - } - - @schemas.classproperty - def GREATER_THAN_SIGN(cls): - return cls(">") # type: ignore - - @schemas.classproperty - def DOLLAR_SIGN(cls): - return cls("$") # type: ignore + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -64,5 +69,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_3/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_3/schema.py index d1695293c617..45de909966e3 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_3/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_3/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.StrSchema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_4/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_4/schema.py index b15e843337e3..224e77582810 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_4/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_4/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.Int32Schema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_5/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_5/schema.py index 59fe5d41bf8b..73b70d8bc02b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_5/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/parameters/parameter_5/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.Float64Schema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/request_body/content/application_x_www_form_urlencoded/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/request_body/content/application_x_www_form_urlencoded/schema.py index 17f6ad25d7cf..7e018ff3e902 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/request_body/content/application_x_www_form_urlencoded/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/request_body/content/application_x_www_form_urlencoded/schema.py @@ -11,6 +11,98 @@ from petstore_api.shared_imports.schema_imports import * + +class Items( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "$" + enum_value_to_name = { + ">": "GREATER_THAN_SIGN", + "$": "DOLLAR_SIGN", + } + + @schemas.classproperty + def GREATER_THAN_SIGN(cls): + return cls(">") # type: ignore + + @schemas.classproperty + def DOLLAR_SIGN(cls): + return cls("$") # type: ignore + + +class EnumFormStringArray( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[str], + str + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> EnumFormStringArray[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + EnumFormStringArray[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[str]: + return super().__getitem__(name) + + + +class EnumFormString( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "-efg" + enum_value_to_name = { + "_abc": "_ABC", + "-efg": "HYPHEN_MINUS_EFG", + "(xyz)": "LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS", + } + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") # type: ignore + + @schemas.classproperty + def HYPHEN_MINUS_EFG(cls): + return cls("-efg") # type: ignore + + @schemas.classproperty + def LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS(cls): + return cls("(xyz)") # type: ignore + + class Schema( schemas.DictSchema[schemas.T] ): @@ -19,103 +111,18 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class EnumFormStringArray( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - - - class Items( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "$" - enum_value_to_name = { - ">": "GREATER_THAN_SIGN", - "$": "DOLLAR_SIGN", - } - - @schemas.classproperty - def GREATER_THAN_SIGN(cls): - return cls(">") # type: ignore - - @schemas.classproperty - def DOLLAR_SIGN(cls): - return cls("$") # type: ignore - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[str], - str - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> Schema.Schema_.Properties.EnumFormStringArray[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - Schema.Schema_.Properties.EnumFormStringArray[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[str]: - return super().__getitem__(name) - - - class EnumFormString( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "-efg" - enum_value_to_name = { - "_abc": "_ABC", - "-efg": "HYPHEN_MINUS_EFG", - "(xyz)": "LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS", - } - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") # type: ignore - - @schemas.classproperty - def HYPHEN_MINUS_EFG(cls): - return cls("-efg") # type: ignore - - @schemas.classproperty - def LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS(cls): - return cls("(xyz)") # type: ignore - __annotations__ = { + @staticmethod + def properties(): + return { "enum_form_string_array": EnumFormStringArray, "enum_form_string": EnumFormString, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> Schema_.Properties.EnumFormStringArray[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> EnumFormStringArray[tuple]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> Schema_.Properties.EnumFormString[str]: ... + def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> EnumFormString[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -144,13 +151,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], enum_form_string_array: typing.Union[ - Schema_.Properties.EnumFormStringArray[tuple], + EnumFormStringArray[tuple], schemas.Unset, list, tuple ] = schemas.unset, enum_form_string: typing.Union[ - Schema_.Properties.EnumFormString[str], + EnumFormString[str], schemas.Unset, str ] = schemas.unset, @@ -188,3 +195,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/responses/response_404/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/responses/response_404/content/application_json/schema.py index 218cec972dea..b8bcb2051e97 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/responses/response_404/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/get/responses/response_404/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.DictSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/post/request_body/content/application_x_www_form_urlencoded/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/post/request_body/content/application_x_www_form_urlencoded/schema.py index e20d6064bbaa..100ab0d0c2cd 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/post/request_body/content/application_x_www_form_urlencoded/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/post/request_body/content/application_x_www_form_urlencoded/schema.py @@ -11,6 +11,135 @@ from petstore_api.shared_imports.schema_imports import * + +class Integer( + schemas.IntSchema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int' + inclusive_maximum = 100 + inclusive_minimum = 10 + + +class Int32( + schemas.Int32Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'int32' + inclusive_maximum = 200 + inclusive_minimum = 20 +Int64: typing_extensions.TypeAlias = schemas.Int64Schema[U] + + +class Number( + schemas.NumberSchema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + inclusive_maximum = 543.2 + inclusive_minimum = 32.1 + + +class _Float( + schemas.Float32Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'float' + inclusive_maximum = 987.6 + + +class Double( + schemas.Float64Schema[schemas.T] +): + + + class Schema_: + types = { + decimal.Decimal, + } + format = 'double' + inclusive_maximum = 123.4 + inclusive_minimum = 67.8 + + +class String( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'[a-z]', # noqa: E501 + 'flags': re.I, + } + + +class PatternWithoutDelimiter( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + regex={ + 'pattern': r'^[A-Z].*', # noqa: E501 + } +Byte: typing_extensions.TypeAlias = schemas.StrSchema[U] +Binary: typing_extensions.TypeAlias = schemas.BinarySchema[U] +Date: typing_extensions.TypeAlias = schemas.DateSchema[U] + + +class DateTime( + schemas.DateTimeSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + format = 'date-time' + + +class Password( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + format = 'password' + max_length = 64 + min_length = 10 +Callback: typing_extensions.TypeAlias = schemas.StrSchema[U] + + class Schema( schemas.DictSchema[schemas.T] ): @@ -25,136 +154,9 @@ class Schema_: "pattern_without_delimiter", } - class Properties: - - - class Integer( - schemas.IntSchema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int' - inclusive_maximum = 100 - inclusive_minimum = 10 - - - class Int32( - schemas.Int32Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'int32' - inclusive_maximum = 200 - inclusive_minimum = 20 - Int64: typing_extensions.TypeAlias = schemas.Int64Schema[U] - - - class Number( - schemas.NumberSchema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - inclusive_maximum = 543.2 - inclusive_minimum = 32.1 - - - class _Float( - schemas.Float32Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'float' - inclusive_maximum = 987.6 - - - class Double( - schemas.Float64Schema[schemas.T] - ): - - - class Schema_: - types = { - decimal.Decimal, - } - format = 'double' - inclusive_maximum = 123.4 - inclusive_minimum = 67.8 - - - class String( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'[a-z]', # noqa: E501 - 'flags': re.I, - } - - - class PatternWithoutDelimiter( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - regex={ - 'pattern': r'^[A-Z].*', # noqa: E501 - } - Byte: typing_extensions.TypeAlias = schemas.StrSchema[U] - Binary: typing_extensions.TypeAlias = schemas.BinarySchema[U] - Date: typing_extensions.TypeAlias = schemas.DateSchema[U] - - - class DateTime( - schemas.DateTimeSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - format = 'date-time' - - - class Password( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - format = 'password' - max_length = 64 - min_length = 10 - Callback: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "integer": Integer, "int32": Int32, "int64": Int64, @@ -172,62 +174,62 @@ class Schema_: } @property - def byte(self) -> Schema_.Properties.Byte[str]: + def byte(self) -> Byte[str]: return self.__getitem__("byte") @property - def double(self) -> Schema_.Properties.Double[decimal.Decimal]: + def double(self) -> Double[decimal.Decimal]: return self.__getitem__("double") @property - def number(self) -> Schema_.Properties.Number[decimal.Decimal]: + def number(self) -> Number[decimal.Decimal]: return self.__getitem__("number") @property - def pattern_without_delimiter(self) -> Schema_.Properties.PatternWithoutDelimiter[str]: + def pattern_without_delimiter(self) -> PatternWithoutDelimiter[str]: return self.__getitem__("pattern_without_delimiter") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["byte"]) -> Schema_.Properties.Byte[str]: ... + def __getitem__(self, name: typing_extensions.Literal["byte"]) -> Byte[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["double"]) -> Schema_.Properties.Double[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["double"]) -> Double[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number"]) -> Schema_.Properties.Number[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["number"]) -> Number[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> Schema_.Properties.PatternWithoutDelimiter[str]: ... + def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> PatternWithoutDelimiter[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["integer"]) -> Schema_.Properties.Integer[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["integer"]) -> Integer[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Schema_.Properties.Int32[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["int32"]) -> Int32[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Schema_.Properties.Int64[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["int64"]) -> Int64[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float"]) -> Schema_.Properties._Float[decimal.Decimal]: ... + def __getitem__(self, name: typing_extensions.Literal["float"]) -> _Float[decimal.Decimal]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["string"]) -> Schema_.Properties.String[str]: ... + def __getitem__(self, name: typing_extensions.Literal["string"]) -> String[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Schema_.Properties.Binary[typing.Union[bytes, schemas.FileIO]]: ... + def __getitem__(self, name: typing_extensions.Literal["binary"]) -> Binary[typing.Union[bytes, schemas.FileIO]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date"]) -> Schema_.Properties.Date[str]: ... + def __getitem__(self, name: typing_extensions.Literal["date"]) -> Date[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> Schema_.Properties.DateTime[str]: ... + def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> DateTime[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["password"]) -> Schema_.Properties.Password[str]: ... + def __getitem__(self, name: typing_extensions.Literal["password"]) -> Password[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["callback"]) -> Schema_.Properties.Callback[str]: ... + def __getitem__(self, name: typing_extensions.Literal["callback"]) -> Callback[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -268,74 +270,74 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], byte: typing.Union[ - Schema_.Properties.Byte[str], + Byte[str], str ], double: typing.Union[ - Schema_.Properties.Double[decimal.Decimal], + Double[decimal.Decimal], decimal.Decimal, int, float ], number: typing.Union[ - Schema_.Properties.Number[decimal.Decimal], + Number[decimal.Decimal], decimal.Decimal, int, float ], pattern_without_delimiter: typing.Union[ - Schema_.Properties.PatternWithoutDelimiter[str], + PatternWithoutDelimiter[str], str ], integer: typing.Union[ - Schema_.Properties.Integer[decimal.Decimal], + Integer[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, int32: typing.Union[ - Schema_.Properties.Int32[decimal.Decimal], + Int32[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, int64: typing.Union[ - Schema_.Properties.Int64[decimal.Decimal], + Int64[decimal.Decimal], schemas.Unset, decimal.Decimal, int ] = schemas.unset, string: typing.Union[ - Schema_.Properties.String[str], + String[str], schemas.Unset, str ] = schemas.unset, binary: typing.Union[ - Schema_.Properties.Binary[typing.Union[bytes, schemas.FileIO]], + Binary[typing.Union[bytes, schemas.FileIO]], schemas.Unset, bytes, io.FileIO, io.BufferedReader ] = schemas.unset, date: typing.Union[ - Schema_.Properties.Date[str], + Date[str], schemas.Unset, str, datetime.date ] = schemas.unset, dateTime: typing.Union[ - Schema_.Properties.DateTime[str], + DateTime[str], schemas.Unset, str, datetime.datetime ] = schemas.unset, password: typing.Union[ - Schema_.Properties.Password[str], + Password[str], schemas.Unset, str ] = schemas.unset, callback: typing.Union[ - Schema_.Properties.Callback[str], + Callback[str], schemas.Unset, str ] = schemas.unset, @@ -384,3 +386,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_body_with_query_params/put/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_body_with_query_params/put/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_body_with_query_params/put/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_body_with_query_params/put/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_1/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_1/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_2/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_2/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_2/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_case_sensitive_params/put/parameters/parameter_2/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_delete_coffee_id/delete/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_delete_coffee_id/delete/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_delete_coffee_id/delete/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_delete_coffee_id/delete/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_additional_properties/post/request_body/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_additional_properties/post/request_body/content/application_json/schema.py index 40dd94f5e63d..c41fccea498d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_additional_properties/post/request_body/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_additional_properties/post/request_body/content/application_json/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -18,9 +20,12 @@ class Schema( class Schema_: types = {frozendict.frozendict} - AdditionalProperties: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def additional_properties(): + return AdditionalProperties - def __getitem__(self, name: str) -> Schema_.AdditionalProperties[str]: + def __getitem__(self, name: str) -> AdditionalProperties[str]: # dict_instance[name] accessor return super().__getitem__(name) @@ -29,7 +34,7 @@ def __new__( *args_: typing.Union[dict, frozendict.frozendict], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ - Schema_.AdditionalProperties[str], + AdditionalProperties[str], str ], ) -> Schema[frozendict.frozendict]: @@ -44,3 +49,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_0/schema.py index c7de2034f622..7f6f457a8a0b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_0/schema.py @@ -11,6 +11,19 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + class Schema( schemas.AnyTypeSchema[schemas.T], ): @@ -19,22 +32,11 @@ class Schema( class Schema_: # any type - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -111,3 +113,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_1/schema.py index f11e82c626e9..9d6144428e0a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/parameters/parameter_1/schema.py @@ -11,6 +11,111 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + +class SomeProp( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + + @staticmethod + def all_of(): + return ( + _0, + ) + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + class Schema( schemas.DictSchema[schemas.T] ): @@ -19,115 +124,14 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class SomeProp( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ - _0, - ] - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "someProp": SomeProp, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> Schema_.Properties.SomeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -164,7 +168,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], someProp: typing.Union[ - Schema_.Properties.SomeProp[typing.Union[ + SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -225,3 +229,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/application_json/schema.py index c7de2034f622..7f6f457a8a0b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/application_json/schema.py @@ -11,6 +11,19 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + class Schema( schemas.AnyTypeSchema[schemas.T], ): @@ -19,22 +32,11 @@ class Schema( class Schema_: # any type - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -111,3 +113,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/multipart_form_data/schema.py index f11e82c626e9..9d6144428e0a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/request_body/content/multipart_form_data/schema.py @@ -11,6 +11,111 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + +class SomeProp( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + + @staticmethod + def all_of(): + return ( + _0, + ) + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + class Schema( schemas.DictSchema[schemas.T] ): @@ -19,115 +124,14 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class SomeProp( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ - _0, - ] - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "someProp": SomeProp, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> Schema_.Properties.SomeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -164,7 +168,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], someProp: typing.Union[ - Schema_.Properties.SomeProp[typing.Union[ + SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -225,3 +229,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/application_json/schema.py index c7de2034f622..7f6f457a8a0b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/application_json/schema.py @@ -11,6 +11,19 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + class Schema( schemas.AnyTypeSchema[schemas.T], ): @@ -19,22 +32,11 @@ class Schema( class Schema_: # any type - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ + @staticmethod + def all_of(): + return ( _0, - ] + ) def __new__( @@ -111,3 +113,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/multipart_form_data/schema.py index f11e82c626e9..9d6144428e0a 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_inline_composition/post/responses/response_200/content/multipart_form_data/schema.py @@ -11,6 +11,111 @@ from petstore_api.shared_imports.schema_imports import * + +class _0( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + min_length = 1 + + +class SomeProp( + schemas.AnyTypeSchema[schemas.T], +): + + + class Schema_: + # any type + + @staticmethod + def all_of(): + return ( + _0, + ) + + + def __new__( + cls, + *args_: typing.Union[ + dict, + frozendict.frozendict, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + int, + float, + decimal.Decimal, + bool, + None, + list, + tuple, + bytes, + io.FileIO, + io.BufferedReader + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + **kwargs: typing.Union[ + dict, + frozendict.frozendict, + list, + tuple, + decimal.Decimal, + float, + int, + str, + datetime.date, + datetime.datetime, + uuid.UUID, + bool, + None, + bytes, + io.FileIO, + io.BufferedReader, + schemas.Schema + ], + ) -> SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ]: + inst = super().__new__( + cls, + *args_, + configuration_=configuration_, + **kwargs, + ) + inst = typing.cast( + SomeProp[ + typing.Union[ + frozendict.frozendict, + str, + decimal.Decimal, + schemas.BoolClass, + schemas.NoneClass, + tuple, + bytes, + schemas.FileIO + ] + ], + inst + ) + return inst + + + class Schema( schemas.DictSchema[schemas.T] ): @@ -19,115 +124,14 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class SomeProp( - schemas.AnyTypeSchema[schemas.T], - ): - - - class Schema_: - # any type - - class AllOf: - - - class _0( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - min_length = 1 - classes = [ - _0, - ] - - - def __new__( - cls, - *args_: typing.Union[ - dict, - frozendict.frozendict, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - int, - float, - decimal.Decimal, - bool, - None, - list, - tuple, - bytes, - io.FileIO, - io.BufferedReader - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - **kwargs: typing.Union[ - dict, - frozendict.frozendict, - list, - tuple, - decimal.Decimal, - float, - int, - str, - datetime.date, - datetime.datetime, - uuid.UUID, - bool, - None, - bytes, - io.FileIO, - io.BufferedReader, - schemas.Schema - ], - ) -> Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ]: - inst = super().__new__( - cls, - *args_, - configuration_=configuration_, - **kwargs, - ) - inst = typing.cast( - Schema.Schema_.Properties.SomeProp[ - typing.Union[ - frozendict.frozendict, - str, - decimal.Decimal, - schemas.BoolClass, - schemas.NoneClass, - tuple, - bytes, - schemas.FileIO - ] - ], - inst - ) - return inst - __annotations__ = { + @staticmethod + def properties(): + return { "someProp": SomeProp, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> Schema_.Properties.SomeProp[typing.Union[ + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -164,7 +168,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], someProp: typing.Union[ - Schema_.Properties.SomeProp[typing.Union[ + SomeProp[typing.Union[ frozendict.frozendict, str, decimal.Decimal, @@ -225,3 +229,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_form_data/get/request_body/content/application_x_www_form_urlencoded/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_form_data/get/request_body/content/application_x_www_form_urlencoded/schema.py index 34421180f3d4..14b9dc34d1ee 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_form_data/get/request_body/content/application_x_www_form_urlencoded/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_form_data/get/request_body/content/application_x_www_form_urlencoded/schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Param: typing_extensions.TypeAlias = schemas.StrSchema[U] +Param2: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -23,27 +26,26 @@ class Schema_: "param2", } - class Properties: - Param: typing_extensions.TypeAlias = schemas.StrSchema[U] - Param2: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "param": Param, "param2": Param2, } @property - def param(self) -> Schema_.Properties.Param[str]: + def param(self) -> Param[str]: return self.__getitem__("param") @property - def param2(self) -> Schema_.Properties.Param2[str]: + def param2(self) -> Param2[str]: return self.__getitem__("param2") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param"]) -> Schema_.Properties.Param[str]: ... + def __getitem__(self, name: typing_extensions.Literal["param"]) -> Param[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param2"]) -> Schema_.Properties.Param2[str]: ... + def __getitem__(self, name: typing_extensions.Literal["param2"]) -> Param2[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -72,11 +74,11 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], param: typing.Union[ - Schema_.Properties.Param[str], + Param[str], str ], param2: typing.Union[ - Schema_.Properties.Param2[str], + Param2[str], str ], configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, @@ -113,3 +115,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/request_body/content/application_json_charsetutf8/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/request_body/content/application_json_charsetutf8/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/request_body/content/application_json_charsetutf8/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/request_body/content/application_json_charsetutf8/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/responses/response_200/content/application_json_charsetutf8/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/responses/response_200/content/application_json_charsetutf8/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/responses/response_200/content/application_json_charsetutf8/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_json_with_charset/post/responses/response_200/content/application_json_charsetutf8/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_200/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_202/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_202/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_202/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_response_bodies/get/responses/response_202/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_securities/get/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_securities/get/responses/response_200/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_securities/get/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_multiple_securities/get/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_obj_in_query/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_obj_in_query/get/parameters/parameter_0/schema.py index 87202840d8b9..3fca2ebc9d8b 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_obj_in_query/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_obj_in_query/get/parameters/parameter_0/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Keyword: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -19,14 +21,14 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - Keyword: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "keyword": Keyword, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["keyword"]) -> Schema_.Properties.Keyword[str]: ... + def __getitem__(self, name: typing_extensions.Literal["keyword"]) -> Keyword[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -54,7 +56,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], keyword: typing.Union[ - Schema_.Properties.Keyword[str], + Keyword[str], schemas.Unset, str ] = schemas.unset, @@ -91,3 +93,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_1/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_1/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_10/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_10/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_10/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_10/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_11/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_11/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_11/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_11/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_12/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_12/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_12/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_12/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_13/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_13/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_13/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_13/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_14/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_14/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_14/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_14/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_15/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_15/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_15/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_15/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_16/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_16/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_16/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_16/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_17/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_17/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_17/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_17/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_18/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_18/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_18/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_18/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_2/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_2/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_2/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_2/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_3/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_3/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_3/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_3/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_4/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_4/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_4/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_4/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_5/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_5/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_5/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_5/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_6/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_6/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_6/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_6/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_7/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_7/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_7/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_7/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.py index 1875a8012a62..d479efa3aa10 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] +RequiredFile: typing_extensions.TypeAlias = schemas.BinarySchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -22,23 +25,22 @@ class Schema_: "requiredFile", } - class Properties: - AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] - RequiredFile: typing_extensions.TypeAlias = schemas.BinarySchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "additionalMetadata": AdditionalMetadata, "requiredFile": RequiredFile, } @property - def requiredFile(self) -> Schema_.Properties.RequiredFile[typing.Union[bytes, schemas.FileIO]]: + def requiredFile(self) -> RequiredFile[typing.Union[bytes, schemas.FileIO]]: return self.__getitem__("requiredFile") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> Schema_.Properties.RequiredFile[typing.Union[bytes, schemas.FileIO]]: ... + def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> RequiredFile[typing.Union[bytes, schemas.FileIO]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> Schema_.Properties.AdditionalMetadata[str]: ... + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> AdditionalMetadata[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -67,13 +69,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], requiredFile: typing.Union[ - Schema_.Properties.RequiredFile[typing.Union[bytes, schemas.FileIO]], + RequiredFile[typing.Union[bytes, schemas.FileIO]], bytes, io.FileIO, io.BufferedReader ], additionalMetadata: typing.Union[ - Schema_.Properties.AdditionalMetadata[str], + AdditionalMetadata[str], schemas.Unset, str ] = schemas.unset, @@ -111,3 +113,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/parameters/parameter_0/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/parameters/parameter_0/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/parameters/parameter_0/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/parameters/parameter_0/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/responses/response_200/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_query_param_with_json_content_type/get/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_0/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_0/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_1/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_1/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_2/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_2/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_2/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_2/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_3/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_3/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_3/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_3/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_4/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_4/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_4/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_test_query_paramters/put/parameters/parameter_4/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/request_body/content/application_octet_stream/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/request_body/content/application_octet_stream/schema.py index ec7153b02a5b..2d4bbce1d221 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/request_body/content/application_octet_stream/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/request_body/content/application_octet_stream/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.BinarySchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/responses/response_200/content/application_octet_stream/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/responses/response_200/content/application_octet_stream/schema.py index ec7153b02a5b..2d4bbce1d221 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/responses/response_200/content/application_octet_stream/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_download_file/post/responses/response_200/content/application_octet_stream/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.BinarySchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_file/post/request_body/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_file/post/request_body/content/multipart_form_data/schema.py index 9f28a0fca8d8..bc1fa21c4986 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_file/post/request_body/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_file/post/request_body/content/multipart_form_data/schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] +File: typing_extensions.TypeAlias = schemas.BinarySchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -22,23 +25,22 @@ class Schema_: "file", } - class Properties: - AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] - File: typing_extensions.TypeAlias = schemas.BinarySchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "additionalMetadata": AdditionalMetadata, "file": File, } @property - def file(self) -> Schema_.Properties.File[typing.Union[bytes, schemas.FileIO]]: + def file(self) -> File[typing.Union[bytes, schemas.FileIO]]: return self.__getitem__("file") @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> Schema_.Properties.File[typing.Union[bytes, schemas.FileIO]]: ... + def __getitem__(self, name: typing_extensions.Literal["file"]) -> File[typing.Union[bytes, schemas.FileIO]]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> Schema_.Properties.AdditionalMetadata[str]: ... + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> AdditionalMetadata[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -67,13 +69,13 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], file: typing.Union[ - Schema_.Properties.File[typing.Union[bytes, schemas.FileIO]], + File[typing.Union[bytes, schemas.FileIO]], bytes, io.FileIO, io.BufferedReader ], additionalMetadata: typing.Union[ - Schema_.Properties.AdditionalMetadata[str], + AdditionalMetadata[str], schemas.Unset, str ] = schemas.unset, @@ -111,3 +113,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_files/post/request_body/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_files/post/request_body/content/multipart_form_data/schema.py index cbc589a3c57b..dd4a2665bde7 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_files/post/request_body/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_upload_files/post/request_body/content/multipart_form_data/schema.py @@ -10,6 +10,48 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.BinarySchema[U] + + +class Files( + schemas.ListSchema[schemas.T] +): + + + class Schema_: + types = {tuple} + + @staticmethod + def items(): + return Items + + def __new__( + cls, + arg_: typing.Sequence[ + typing.Union[ + Items[typing.Union[bytes, schemas.FileIO]], + bytes, + io.FileIO, + io.BufferedReader + ] + ], + configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, + ) -> Files[tuple]: + inst = super().__new__( + cls, + arg_, + configuration_=configuration_, + ) + inst = typing.cast( + Files[tuple], + inst + ) + return inst + + def __getitem__(self, name: int) -> Items[typing.Union[bytes, schemas.FileIO]]: + return super().__getitem__(name) + + class Schema( schemas.DictSchema[schemas.T] @@ -19,49 +61,14 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - - class Files( - schemas.ListSchema[schemas.T] - ): - - - class Schema_: - types = {tuple} - Items: typing_extensions.TypeAlias = schemas.BinarySchema[U] - - def __new__( - cls, - arg_: typing.Sequence[ - typing.Union[ - Schema_.Items[typing.Union[bytes, schemas.FileIO]], - bytes, - io.FileIO, - io.BufferedReader - ] - ], - configuration_: typing.Optional[schemas.schema_configuration.SchemaConfiguration] = None, - ) -> Schema.Schema_.Properties.Files[tuple]: - inst = super().__new__( - cls, - arg_, - configuration_=configuration_, - ) - inst = typing.cast( - Schema.Schema_.Properties.Files[tuple], - inst - ) - return inst - - def __getitem__(self, name: int) -> Schema_.Items[typing.Union[bytes, schemas.FileIO]]: - return super().__getitem__(name) - __annotations__ = { + @staticmethod + def properties(): + return { "files": Files, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["files"]) -> Schema_.Properties.Files[tuple]: ... + def __getitem__(self, name: typing_extensions.Literal["files"]) -> Files[tuple]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -89,7 +96,7 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], files: typing.Union[ - Schema_.Properties.Files[tuple], + Files[tuple], schemas.Unset, list, tuple @@ -127,3 +134,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_1xx/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_1xx/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_1xx/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_1xx/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_200/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_2xx/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_2xx/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_2xx/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_2xx/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_3xx/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_3xx/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_3xx/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_3xx/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_4xx/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_4xx/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_4xx/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_4xx/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_5xx/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_5xx/content/application_json/schema.py index 83bd5a9325f4..072e994d56d4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_5xx/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/fake_wild_card_responses/get/responses/response_5xx/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.AnyTypeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/foo/get/responses/response_default/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/foo/get/responses/response_default/content/application_json/schema.py index eacd76cfd2fe..4a22b1485eaa 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/foo/get/responses/response_default/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/foo/get/responses/response_default/content/application_json/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.DictSchema[schemas.T] ): @@ -19,13 +20,10 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - - @staticmethod - def string() -> typing.Type[foo.Foo]: - return foo.Foo - __annotations__ = { - "string": string, + @staticmethod + def properties(): + return { + "string": foo.Foo, } @typing.overload @@ -96,4 +94,5 @@ def __new__( ) return inst + from petstore_api.components.schema import foo diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_status/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_status/get/parameters/parameter_0/schema.py index f5d206ef46c2..2890403abdb9 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_status/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_status/get/parameters/parameter_0/schema.py @@ -11,6 +11,36 @@ from petstore_api.shared_imports.schema_imports import * + +class Items( + schemas.StrSchema[schemas.T] +): + + + class Schema_: + types = { + str, + } + default = "available" + enum_value_to_name = { + "available": "AVAILABLE", + "pending": "PENDING", + "sold": "SOLD", + } + + @schemas.classproperty + def AVAILABLE(cls): + return cls("available") # type: ignore + + @schemas.classproperty + def PENDING(cls): + return cls("pending") # type: ignore + + @schemas.classproperty + def SOLD(cls): + return cls("sold") # type: ignore + + class Schema( schemas.ListSchema[schemas.T] ): @@ -19,40 +49,15 @@ class Schema( class Schema_: types = {tuple} - - class Items( - schemas.StrSchema[schemas.T] - ): - - - class Schema_: - types = { - str, - } - default = "available" - enum_value_to_name = { - "available": "AVAILABLE", - "pending": "PENDING", - "sold": "SOLD", - } - - @schemas.classproperty - def AVAILABLE(cls): - return cls("available") # type: ignore - - @schemas.classproperty - def PENDING(cls): - return cls("pending") # type: ignore - - @schemas.classproperty - def SOLD(cls): - return cls("sold") # type: ignore + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -69,5 +74,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py index da15d120e4a4..2e5d44c25c09 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py @@ -10,6 +10,8 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.ListSchema[schemas.T] @@ -18,13 +20,16 @@ class Schema( class Schema_: types = {tuple} - Items: typing_extensions.TypeAlias = schemas.StrSchema[U] + + @staticmethod + def items(): + return Items def __new__( cls, arg_: typing.Sequence[ typing.Union[ - Schema_.Items[str], + Items[str], str ] ], @@ -41,5 +46,6 @@ def __new__( ) return inst - def __getitem__(self, name: int) -> Schema_.Items[str]: + def __getitem__(self, name: int) -> Items[str]: return super().__getitem__(name) + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_1/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/delete/parameters/parameter_1/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/get/parameters/parameter_0/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/get/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/parameters/parameter_0/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py index 48f30d5e6205..8a67c6671534 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +Name: typing_extensions.TypeAlias = schemas.StrSchema[U] +Status: typing_extensions.TypeAlias = schemas.StrSchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -19,19 +22,18 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - Name: typing_extensions.TypeAlias = schemas.StrSchema[U] - Status: typing_extensions.TypeAlias = schemas.StrSchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "name": Name, "status": Status, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> Schema_.Properties.Name[str]: ... + def __getitem__(self, name: typing_extensions.Literal["name"]) -> Name[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> Schema_.Properties.Status[str]: ... + def __getitem__(self, name: typing_extensions.Literal["status"]) -> Status[str]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -60,12 +62,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], name: typing.Union[ - Schema_.Properties.Name[str], + Name[str], schemas.Unset, str ] = schemas.unset, status: typing.Union[ - Schema_.Properties.Status[str], + Status[str], schemas.Unset, str ] = schemas.unset, @@ -103,3 +105,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py index cc2fd90961c4..db592ea3e5b4 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int64Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py index 16f492dd51a5..e4cff9964b19 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py @@ -10,6 +10,9 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * +AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] +File: typing_extensions.TypeAlias = schemas.BinarySchema[U] + class Schema( schemas.DictSchema[schemas.T] @@ -19,19 +22,18 @@ class Schema( class Schema_: types = {frozendict.frozendict} - class Properties: - AdditionalMetadata: typing_extensions.TypeAlias = schemas.StrSchema[U] - File: typing_extensions.TypeAlias = schemas.BinarySchema[U] - __annotations__ = { + @staticmethod + def properties(): + return { "additionalMetadata": AdditionalMetadata, "file": File, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> Schema_.Properties.AdditionalMetadata[str]: ... + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> AdditionalMetadata[str]: ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> Schema_.Properties.File[typing.Union[bytes, schemas.FileIO]]: ... + def __getitem__(self, name: typing_extensions.Literal["file"]) -> File[typing.Union[bytes, schemas.FileIO]]: ... @typing.overload def __getitem__(self, name: str) -> schemas.AnyTypeSchema[typing.Union[ @@ -60,12 +62,12 @@ def __new__( cls, *args_: typing.Union[dict, frozendict.frozendict], additionalMetadata: typing.Union[ - Schema_.Properties.AdditionalMetadata[str], + AdditionalMetadata[str], schemas.Unset, str ] = schemas.unset, file: typing.Union[ - Schema_.Properties.File[typing.Union[bytes, schemas.FileIO]], + File[typing.Union[bytes, schemas.FileIO]], schemas.Unset, bytes, io.FileIO, @@ -105,3 +107,4 @@ def __new__( inst ) return inst + diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/delete/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/delete/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/delete/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/delete/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/get/parameters/parameter_0/schema.py index 96d158c3674a..663c72a20b8c 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/store_order_order_id/get/parameters/parameter_0/schema.py @@ -11,6 +11,7 @@ from petstore_api.shared_imports.schema_imports import * + class Schema( schemas.Int64Schema[schemas.T] ): diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_0/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_0/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_0/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_0/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_1/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_1/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_1/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/parameters/parameter_1/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_json/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_xml/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_xml/schema.py index 905311bf8add..1f544f8f7472 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_xml/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/content/application_xml/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.StrSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py index 12bceb3098d2..6354f6d5744d 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.DateTimeSchema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/content/application_json/schema.py b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/content/application_json/schema.py index af8e03d6a9c2..5af8b8a8edee 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/content/application_json/schema.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/content/application_json/schema.py @@ -9,4 +9,5 @@ from __future__ import annotations from petstore_api.shared_imports.schema_imports import * + Schema: typing_extensions.TypeAlias = schemas.Int32Schema[U] diff --git a/samples/openapi3/client/petstore/python/src/petstore_api/schemas.py b/samples/openapi3/client/petstore/python/src/petstore_api/schemas.py index fba4ffeff18a..c95f23293f50 100644 --- a/samples/openapi3/client/petstore/python/src/petstore_api/schemas.py +++ b/samples/openapi3/client/petstore/python/src/petstore_api/schemas.py @@ -13,6 +13,7 @@ import dataclasses import functools import decimal +import inspect import io import re import types @@ -193,22 +194,17 @@ class SchemaTyped: min_items: int discriminator: typing.Dict[str, typing.Dict[str, typing.Type['Schema']]] default: typing.Union[str, int, BoolClass] - - - class Properties: - # to hold object properties - pass - - additionalProperties: typing.Optional[typing.Type['Schema']] + properties: typing.Callable + additional_properties: typing.Callable max_properties: int min_properties: int - AllOf: typing.List[typing.Type['Schema']] - OneOf: typing.List[typing.Type['Schema']] - AnyOf: typing.List[typing.Type['Schema']] - _not: typing.Type['Schema'] + all_of: typing.Callable + one_of: typing.Callable + any_of: typing.Callable + not_: typing.Callable max_length: int min_length: int - items: typing.Type['Schema'] + items: typing.Callable PathToSchemasType = typing.Dict[ typing.Tuple[typing.Union[str, int], ...], @@ -786,18 +782,20 @@ def _get_class(item_cls: typing.Union[types.FunctionType, staticmethod, typing.T elif isinstance(item_cls, staticmethod): # referenced schema return item_cls.__func__() - return item_cls + elif isinstance(item_cls, type): + return item_cls + raise ValueError('invalid class value passed in') def validate_items( arg: typing.Any, - item_cls: typing.Type, + item_cls_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, ) -> typing.Optional[PathToSchemasType]: if not isinstance(arg, tuple): return None - item_cls = _get_class(item_cls) + item_cls = _get_class(item_cls_fn.__func__()) path_to_schemas = {} for i, value in enumerate(arg): item_validation_metadata = ValidationMetadata( @@ -816,17 +814,18 @@ def validate_items( def validate_properties( arg: typing.Any, - properties: typing.Type, + properties_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, ) -> typing.Optional[PathToSchemasType]: if not isinstance(arg, frozendict.frozendict): return None path_to_schemas = {} - present_properties = {k: v for k, v, in arg.items() if k in properties.__annotations__} + properties = properties_fn.__func__() + present_properties = {k: v for k, v, in arg.items() if k in properties} for property_name, value in present_properties.items(): path_to_item = validation_metadata.path_to_item + (property_name,) - schema = properties.__annotations__[property_name] + schema = properties[property_name] schema = _get_class(schema) arg_validation_metadata = ValidationMetadata( path_to_item=path_to_item, @@ -843,16 +842,16 @@ def validate_properties( def validate_additional_properties( arg: typing.Any, - additional_properties_schema: typing.Type, + additional_properties_schema_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, ) -> typing.Optional[PathToSchemasType]: if not isinstance(arg, frozendict.frozendict): return None - schema = _get_class(additional_properties_schema) + schema = _get_class(additional_properties_schema_fn.__func__()) path_to_schemas = {} - properties_annotations = cls.Schema_.Properties.__annotations__ if hasattr(cls.Schema_, 'Properties') else {} - present_additional_properties = {k: v for k, v, in arg.items() if k not in properties_annotations} + properties = cls.Schema_.properties() if hasattr(cls.Schema_, 'properties') else {} + present_additional_properties = {k: v for k, v, in arg.items() if k not in properties} for property_name, value in present_additional_properties.items(): path_to_item = validation_metadata.path_to_item + (property_name,) arg_validation_metadata = ValidationMetadata( @@ -870,14 +869,15 @@ def validate_additional_properties( def validate_one_of( arg: typing.Any, - one_of_container_cls: typing.Type, + classes_fn: typing.Callable, cls: 'Schema', validation_metadata: ValidationMetadata, ) -> PathToSchemasType: oneof_classes = [] path_to_schemas = collections.defaultdict(set) - for one_of_cls in one_of_container_cls.classes: - schema = _get_class(one_of_cls) + classes = classes_fn.__func__() + for schema in classes: + schema = _get_class(schema) if schema in path_to_schemas[validation_metadata.path_to_item]: oneof_classes.append(schema) continue @@ -914,14 +914,15 @@ def validate_one_of( def validate_any_of( arg: typing.Any, - any_of_container_cls: typing.Type, + classes_fn: typing.Callable, cls: 'Schema', validation_metadata: ValidationMetadata, ) -> PathToSchemasType: anyof_classes = [] path_to_schemas = collections.defaultdict(set) - for any_of_cls in any_of_container_cls.classes: - schema = _get_class(any_of_cls) + classes = classes_fn.__func__() + for schema in classes: + schema = _get_class(schema) if schema is cls: """ optimistically assume that cls schema will pass validation @@ -951,13 +952,13 @@ def validate_any_of( def validate_all_of( arg: typing.Any, - all_of_cls: typing.Type, + classes_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, ) -> PathToSchemasType: path_to_schemas = collections.defaultdict(set) - for allof_cls in all_of_cls.classes: - schema = _get_class(allof_cls) + classes = classes_fn.__func__() + for schema in classes: if schema is cls: """ optimistically assume that cls schema will pass validation @@ -974,11 +975,11 @@ def validate_all_of( def validate_not( arg: typing.Any, - not_cls: typing.Type, + not_cls_fn: typing.Callable, cls: typing.Type, validation_metadata: ValidationMetadata, ) -> None: - not_schema = _get_class(not_cls) + not_schema = _get_class(not_cls_fn.__func__()) other_path_to_schemas = None not_exception = exceptions.ApiValueError( "Invalid value '{}' was passed in to {}. Value is invalid because it is disallowed by {}".format( @@ -1025,29 +1026,26 @@ def __get_discriminated_class(cls, disc_property_name: str, disc_payload_value: if discriminated_cls is not None: return discriminated_cls if not ( - hasattr(cls.Schema_, 'AllOf') or - hasattr(cls.Schema_, 'OneOf') or - hasattr(cls.Schema_, 'AnyOf') + hasattr(cls.Schema_, 'all_of') or + hasattr(cls.Schema_, 'one_of') or + hasattr(cls.Schema_, 'any_of') ): return None # TODO stop traveling if a cycle is hit - if hasattr(cls.Schema_, 'AllOf'): - for allof_cls in cls.Schema_.AllOf.classes: - allof_cls = _get_class(allof_cls) + if hasattr(cls.Schema_, 'all_of'): + for allof_cls in cls.Schema_.all_of(): discriminated_cls = __get_discriminated_class( allof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: return discriminated_cls - if hasattr(cls.Schema_, 'OneOf'): - for oneof_cls in cls.Schema_.OneOf.classes: - oneof_cls = _get_class(oneof_cls) + if hasattr(cls.Schema_, 'one_of'): + for oneof_cls in cls.Schema_.one_of(): discriminated_cls = __get_discriminated_class( oneof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: return discriminated_cls - if hasattr(cls.Schema_, 'AnyOf'): - for anyof_cls in cls.Schema_.AnyOf.classes: - anyof_cls = _get_class(anyof_cls) + if hasattr(cls.Schema_, 'any_of'): + for anyof_cls in cls.Schema_.any_of(): discriminated_cls = __get_discriminated_class( anyof_cls, disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) if discriminated_cls is not None: @@ -1116,16 +1114,12 @@ def validate_discriminator( 'format': validate_format, 'required': validate_required, 'items': validate_items, - 'Items': validate_items, - 'Properties': validate_properties, - 'AdditionalProperties': validate_additional_properties, + 'properties': validate_properties, 'additional_properties': validate_additional_properties, - 'OneOf': validate_one_of, - 'AnyOf': validate_any_of, - 'AllOf': validate_all_of, - '_not': validate_not, - '_Not': validate_not, - 'ModelNot': validate_not, + 'one_of': validate_one_of, + 'any_of': validate_any_of, + 'all_of': validate_all_of, + 'not_': validate_not, 'discriminator': validate_discriminator } @@ -2350,11 +2344,12 @@ class Schema_: types = {FileIO, bytes} format = 'binary' - class OneOf: - classes = [ + @staticmethod + def one_of(): + return ( BytesSchema, FileSchema, - ] + ) def __new__(cls, arg_: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: schema_configuration.SchemaConfiguration) -> BinarySchema[typing.Union[FileIO, bytes]]: return super().__new__(cls, arg_) @@ -2408,7 +2403,8 @@ def __new__( Schema, bytes, io.FileIO, - io.BufferedReader + io.BufferedReader, + Unset ], configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None, **kwargs: typing.Union[ @@ -2427,7 +2423,8 @@ def __new__( Schema, bytes, io.FileIO, - io.BufferedReader + io.BufferedReader, + Unset ] ) -> AnyTypeSchema[typing.Union[ NoneClass, @@ -2499,7 +2496,9 @@ class NotAnyTypeSchema(AnyTypeSchema[T]): """ class Schema_: - _not = AnyTypeSchema[U] + @staticmethod + def not_(): + return AnyTypeSchema[U] def __new__( cls, diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_additional_properties_validator.py b/samples/openapi3/client/petstore/python/tests_manual/test_additional_properties_validator.py index cd5e601dea43..406ef1b8120a 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_additional_properties_validator.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_additional_properties_validator.py @@ -30,8 +30,8 @@ def test_additional_properties_validator(self): assert add_prop == 'abc' assert isinstance(add_prop, str) assert isinstance(add_prop, schemas.AnyTypeSchema) - assert isinstance(add_prop, AdditionalPropertiesValidator.Schema_.AllOf.classes[1].Schema_.AdditionalProperties) - assert isinstance(add_prop, AdditionalPropertiesValidator.Schema_.AllOf.classes[2].Schema_.AdditionalProperties) + assert isinstance(add_prop, AdditionalPropertiesValidator.Schema_.all_of()[1].Schema_.AdditionalProperties) + assert isinstance(add_prop, AdditionalPropertiesValidator.Schema_.all_of()[2].Schema_.AdditionalProperties) assert not isinstance(add_prop, schemas.UnsetAnyTypeSchema) diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_animal.py b/samples/openapi3/client/petstore/python/tests_manual/test_animal.py index fcbd99af52da..3972a5f2d6c7 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_animal.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_animal.py @@ -15,8 +15,8 @@ import frozendict import petstore_api -from petstore_api.components.schema.cat import Cat -from petstore_api.components.schema.dog import Dog +from petstore_api.components.schema import cat +from petstore_api.components.schema import dog from petstore_api.components.schema.animal import Animal from petstore_api.schemas import StrSchema, BoolSchema @@ -42,8 +42,8 @@ def testAnimal(self): animal = Animal(className='Cat', color='black') assert isinstance(animal, frozendict.frozendict) - assert isinstance(animal, Cat) - assert isinstance(animal, Cat.Schema_.AllOf.classes[1]) + assert isinstance(animal, cat.Cat) + assert isinstance(animal, cat._1) assert isinstance(animal, Animal) assert set(animal.keys()) == {'className', 'color'} assert animal.className == 'Cat' @@ -55,8 +55,8 @@ def testAnimal(self): animal = Animal(className='Cat', color='black', declawed=True) assert isinstance(animal, Animal) assert isinstance(animal, frozendict.frozendict) - assert isinstance(animal, Cat) - assert isinstance(animal, Cat.Schema_.AllOf.classes[1]) + assert isinstance(animal, cat.Cat) + assert isinstance(animal, cat._1) assert set(animal.keys()) == {'className', 'color', 'declawed'} assert animal.className == 'Cat' assert animal["color"] == 'black' @@ -69,8 +69,8 @@ def testAnimal(self): animal = Animal(className='Dog', color='black') assert isinstance(animal, Animal) assert isinstance(animal, frozendict.frozendict) - assert isinstance(animal, Dog) - assert isinstance(animal, Dog.Schema_.AllOf.classes[1]) + assert isinstance(animal, dog.Dog) + assert isinstance(animal, dog._1) assert set(animal.keys()) == {'className', 'color'} assert animal.className == 'Dog' assert animal["color"] == 'black' @@ -81,8 +81,8 @@ def testAnimal(self): animal = Animal(className='Dog', color='black', breed='Labrador') assert isinstance(animal, Animal) assert isinstance(animal, frozendict.frozendict) - assert isinstance(animal, Dog) - assert isinstance(animal, Dog.Schema_.AllOf.classes[1]) + assert isinstance(animal, dog.Dog) + assert isinstance(animal, dog._1) assert set(animal.keys()) == {'className', 'color', 'breed'} assert animal.className == 'Dog' assert animal["color"] == 'black' diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_any_type_schema.py b/samples/openapi3/client/petstore/python/tests_manual/test_any_type_schema.py index 69539c3bdab8..94dcb94e1b28 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_any_type_schema.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_any_type_schema.py @@ -12,6 +12,7 @@ import unittest from decimal import Decimal +import typing import frozendict @@ -39,11 +40,12 @@ def testDictSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, DictSchema, - ] + ) m = Model(a=1, b='hi') assert isinstance(m, Model) @@ -56,11 +58,12 @@ def testListSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, ListSchema, - ] + ) m = Model([1, 'hi']) assert isinstance(m, Model) @@ -73,11 +76,12 @@ def testStrSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, StrSchema, - ] + ) m = Model('hi') assert isinstance(m, Model) @@ -90,11 +94,12 @@ def testNumberSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, NumberSchema, - ] + ) m = Model(1) assert isinstance(m, Model) @@ -114,11 +119,12 @@ def testIntSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, IntSchema, - ] + ) m = Model(1) assert isinstance(m, Model) @@ -127,7 +133,7 @@ class AllOf: assert isinstance(m, Decimal) assert m == Decimal(1) - with self.assertRaises(petstore_api.exceptions.ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): # can't pass in float into Int Model(3.14) @@ -135,11 +141,12 @@ def testBoolSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, BoolSchema, - ] + ) m = Model(True) assert isinstance(m, Model) @@ -159,11 +166,12 @@ def testNoneSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, NoneSchema, - ] + ) m = Model(None) self.assertTrue(m.is_none_()) @@ -176,11 +184,12 @@ def testDateSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, DateSchema, - ] + ) m = Model('1970-01-01') assert isinstance(m, Model) @@ -193,11 +202,12 @@ def testDateTimeSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, DateTimeSchema, - ] + ) m = Model('2020-01-01T00:00:00') assert isinstance(m, Model) @@ -210,11 +220,12 @@ def testDecimalSchema(self): class Model(AnyTypeSchema): class Schema_: - class AllOf: - classes = [ + @staticmethod + def all_of(): + return ( AnyTypeSchema, DecimalSchema, - ] + ) m = Model('12.34') assert m == '12.34' diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_mammal.py b/samples/openapi3/client/petstore/python/tests_manual/test_mammal.py index 63fca5e4d50c..334b890c63ac 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_mammal.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_mammal.py @@ -43,7 +43,7 @@ def testMammal(self): assert isinstance(m, whale.Whale) # can use the enum value - m = Mammal(className=whale.Whale.Schema_.Properties.ClassName.WHALE) + m = Mammal(className=whale.ClassName.WHALE) assert isinstance(m, whale.Whale) from petstore_api.components.schema import zebra diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_obj_with_required_props.py b/samples/openapi3/client/petstore/python/tests_manual/test_obj_with_required_props.py index f9639468b106..53b735f16ff4 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_obj_with_required_props.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_obj_with_required_props.py @@ -13,22 +13,22 @@ import typing_extensions -from petstore_api.components.schema.obj_with_required_props import ObjWithRequiredProps -from petstore_api.components.schema.obj_with_required_props_base import ObjWithRequiredPropsBase +from petstore_api.components.schema import obj_with_required_props +from petstore_api.components.schema import obj_with_required_props_base from petstore_api.configurations import schema_configuration class TestObjWithRequiredProps(unittest.TestCase): """ObjWithRequiredProps unit test stubs""" configuration_ = schema_configuration.SchemaConfiguration() - obj = ObjWithRequiredProps(a='a', b='b') - assert isinstance(obj, ObjWithRequiredProps) and isinstance(obj, ObjWithRequiredPropsBase) + obj = obj_with_required_props.ObjWithRequiredProps(a='a', b='b') + assert isinstance(obj, obj_with_required_props.ObjWithRequiredProps) and isinstance(obj, obj_with_required_props_base.ObjWithRequiredPropsBase) a = obj.a - orgin_cls = typing_extensions.get_origin(ObjWithRequiredProps.Schema_.Properties.A) + orgin_cls = typing_extensions.get_origin(obj_with_required_props.A) assert orgin_cls is not None assert isinstance(a, orgin_cls) b = obj.b - orgin_cls = typing_extensions.get_origin(ObjWithRequiredPropsBase.Schema_.Properties.B) + orgin_cls = typing_extensions.get_origin(obj_with_required_props_base.B) assert orgin_cls is not None assert isinstance(a, orgin_cls) diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_arg_and_args_properties.py b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_arg_and_args_properties.py index 988c4c45013d..d904ab633c6a 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_arg_and_args_properties.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_arg_and_args_properties.py @@ -14,7 +14,7 @@ import typing_extensions from petstore_api import schemas, exceptions -from petstore_api.components.schema.object_model_with_arg_and_args_properties import ObjectModelWithArgAndArgsProperties +from petstore_api.components.schema import object_model_with_arg_and_args_properties class TestObjectModelWithArgAndArgsProperties(unittest.TestCase): @@ -22,8 +22,9 @@ class TestObjectModelWithArgAndArgsProperties(unittest.TestCase): def test_ObjectModelWithArgAndArgsProperties(self): """Test ObjectModelWithArgAndArgsProperties""" - model = ObjectModelWithArgAndArgsProperties(arg='a', args='as') - origin_cls = typing_extensions.get_origin(ObjectModelWithArgAndArgsProperties.Schema_.Properties.Arg) + model = object_model_with_arg_and_args_properties.ObjectModelWithArgAndArgsProperties( + arg='a', args='as') + origin_cls = typing_extensions.get_origin(object_model_with_arg_and_args_properties.Arg) assert origin_cls is not None self.assertTrue( isinstance( @@ -31,7 +32,7 @@ def test_ObjectModelWithArgAndArgsProperties(self): origin_cls ) ) - origin_cls = typing_extensions.get_origin(ObjectModelWithArgAndArgsProperties.Schema_.Properties.Args) + origin_cls = typing_extensions.get_origin(object_model_with_arg_and_args_properties.Args) assert origin_cls is not None self.assertTrue( isinstance( diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py index 0c2139fac3b9..70aec76cce46 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py @@ -15,7 +15,7 @@ import typing_extensions from petstore_api.schemas import BoolClass -from petstore_api.components.schema.object_model_with_ref_props import ObjectModelWithRefProps +from petstore_api.components.schema import object_model_with_ref_props from petstore_api.components.schema.number_with_validations import NumberWithValidations @@ -30,18 +30,18 @@ def tearDown(self): def testObjectModelWithRefProps(self): """Test ObjectModelWithRefProps""" - inst = ObjectModelWithRefProps(myNumber=15.0, myString="a", myBoolean=True) - assert isinstance(inst, ObjectModelWithRefProps) + inst = object_model_with_ref_props.ObjectModelWithRefProps(myNumber=15.0, myString="a", myBoolean=True) + assert isinstance(inst, object_model_with_ref_props.ObjectModelWithRefProps) assert isinstance(inst, frozendict.frozendict) assert set(inst.keys()) == {"myNumber", "myString", "myBoolean"} assert inst["myNumber"] == 15.0 assert isinstance(inst["myNumber"], NumberWithValidations) assert inst["myString"] == 'a' - origin_cls = typing_extensions.get_origin(ObjectModelWithRefProps.Schema_.Properties.my_string()) + origin_cls = typing_extensions.get_origin(object_model_with_ref_props.string.String) assert origin_cls is not None assert isinstance(inst["myString"], origin_cls) assert bool(inst["myBoolean"]) is True - origin_cls = typing_extensions.get_origin(ObjectModelWithRefProps.Schema_.Properties.my_boolean()) + origin_cls = typing_extensions.get_origin(object_model_with_ref_props.boolean.Boolean) assert origin_cls is not None assert isinstance(inst["myBoolean"], origin_cls) assert isinstance(inst["myBoolean"], BoolClass) diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_object_with_inline_composition_property.py b/samples/openapi3/client/petstore/python/tests_manual/test_object_with_inline_composition_property.py index dfafdf42f190..f33add17d913 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_object_with_inline_composition_property.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_object_with_inline_composition_property.py @@ -12,7 +12,7 @@ import unittest from petstore_api import schemas, exceptions -from petstore_api.components.schema.object_with_inline_composition_property import ObjectWithInlineCompositionProperty +from petstore_api.components.schema import object_with_inline_composition_property class TestObjectWithInlineCompositionProperty(unittest.TestCase): @@ -20,18 +20,18 @@ class TestObjectWithInlineCompositionProperty(unittest.TestCase): def test_ObjectWithInlineCompositionProperty(self): """Test ObjectWithInlineCompositionProperty""" - model = ObjectWithInlineCompositionProperty(someProp='a') + model = object_with_inline_composition_property.ObjectWithInlineCompositionProperty(someProp='a') self.assertTrue( isinstance( model["someProp"], - ObjectWithInlineCompositionProperty.Schema_.Properties.SomeProp + object_with_inline_composition_property.SomeProp ) ) self.assertTrue(isinstance(model["someProp"], schemas.StrSchema)) # error thrown on length < 1 with self.assertRaises(exceptions.ApiValueError): - ObjectWithInlineCompositionProperty(someProp='') + object_with_inline_composition_property.ObjectWithInlineCompositionProperty(someProp='') if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_validate.py b/samples/openapi3/client/petstore/python/tests_manual/test_validate.py index 263752aa38b7..a48933860984 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_validate.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_validate.py @@ -6,22 +6,21 @@ import frozendict -from petstore_api.components.schema.string_with_validation import StringWithValidation -from petstore_api.components.schema.string_enum import StringEnum -from petstore_api.components.schema.number_with_validations import NumberWithValidations -from petstore_api.components.schema.array_holding_any_type import ArrayHoldingAnyType -from petstore_api.components.schema.array_with_validations_in_items import ( - ArrayWithValidationsInItems, -) +from petstore_api.components.schema import string_with_validation +from petstore_api.components.schema import string_enum +from petstore_api.components.schema import number_with_validations +from petstore_api.components.schema import array_holding_any_type +from petstore_api.components.schema import array_with_validations_in_items + from petstore_api.components.schema.foo import Foo from petstore_api.components.schema.bar import Bar -from petstore_api.components.schema.animal import Animal -from petstore_api.components.schema.dog import Dog +from petstore_api.components.schema import animal +from petstore_api.components.schema import dog from petstore_api.components.schema.boolean_enum import BooleanEnum from petstore_api.components.schema.pig import Pig -from petstore_api.components.schema.danish_pig import DanishPig +from petstore_api.components.schema import danish_pig from petstore_api.components.schema.gm_fruit import GmFruit -from petstore_api.components.schema.apple import Apple +from petstore_api.components.schema import apple from petstore_api.components.schema.banana import Banana from petstore_api import schemas from petstore_api.configurations import schema_configuration @@ -40,40 +39,40 @@ class TestValidateResults(unittest.TestCase): def test_str_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = StringWithValidation._validate( + path_to_schemas = string_with_validation.StringWithValidation._validate( "abcdefg", validation_metadata=vm ) - assert path_to_schemas == {("args[0]",): {StringWithValidation, str}} + assert path_to_schemas == {("args[0]",): {string_with_validation.StringWithValidation, str}} def test_number_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = NumberWithValidations._validate( + path_to_schemas = number_with_validations.NumberWithValidations._validate( Decimal(11), validation_metadata=vm ) - assert path_to_schemas == {("args[0]",): {NumberWithValidations, Decimal}} + assert path_to_schemas == {("args[0]",): {number_with_validations.NumberWithValidations, Decimal}} def test_str_enum_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = StringEnum._validate("placed", validation_metadata=vm) - assert path_to_schemas == {("args[0]",): {str, StringEnum}} + path_to_schemas = string_enum.StringEnum._validate("placed", validation_metadata=vm) + assert path_to_schemas == {("args[0]",): {str, string_enum.StringEnum}} def test_nullable_enum_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = StringEnum._validate(NoneClass.NONE, validation_metadata=vm) - assert path_to_schemas == {("args[0]",): {NoneClass, StringEnum}} + path_to_schemas = string_enum.StringEnum._validate(NoneClass.NONE, validation_metadata=vm) + assert path_to_schemas == {("args[0]",): {NoneClass, string_enum.StringEnum}} def test_empty_list_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = ArrayHoldingAnyType._validate((), validation_metadata=vm) - assert path_to_schemas == {("args[0]",): {ArrayHoldingAnyType, tuple}} + path_to_schemas = array_holding_any_type.ArrayHoldingAnyType._validate((), validation_metadata=vm) + assert path_to_schemas == {("args[0]",): {array_holding_any_type.ArrayHoldingAnyType, tuple}} def test_list_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = ArrayHoldingAnyType._validate( + path_to_schemas = array_holding_any_type.ArrayHoldingAnyType._validate( (Decimal(1), "a"), validation_metadata=vm ) assert path_to_schemas == { - ("args[0]",): {ArrayHoldingAnyType, tuple}, + ("args[0]",): {array_holding_any_type.ArrayHoldingAnyType, tuple}, ("args[0]", 0): {AnyTypeSchema, Decimal}, ("args[0]", 1): {AnyTypeSchema, str}, } @@ -96,15 +95,15 @@ def test_dict_validate(self): def test_discriminated_dict_validate(self): vm = ValidationMetadata(path_to_item=("args[0]",), configuration=schema_configuration.SchemaConfiguration()) - path_to_schemas = Animal._validate( + path_to_schemas = animal.Animal._validate( frozendict.frozendict(className="Dog", color="black"), validation_metadata=vm ) for schema_classes in path_to_schemas.values(): - Animal._process_schema_classes(schema_classes) + animal.Animal._process_schema_classes(schema_classes) assert path_to_schemas == { - ("args[0]",): {Animal, Dog, Dog.Schema_.AllOf.classes[1], frozendict.frozendict}, + ("args[0]",): {animal.Animal, dog.Dog, dog._1, frozendict.frozendict}, ("args[0]", "className"): {StrSchema, str}, - ("args[0]", "color"): {Animal.Schema_.Properties.Color, str}, + ("args[0]", "color"): {animal.Color, str}, } def test_bool_enum_validate(self): @@ -120,8 +119,8 @@ def test_oneof_composition_pig_validate(self): for schema_classes in path_to_schemas.values(): Pig._process_schema_classes(schema_classes) assert path_to_schemas == { - ("args[0]",): {Pig, DanishPig, frozendict.frozendict}, - ("args[0]", "className"): {DanishPig.Schema_.Properties.ClassName, str}, + ("args[0]",): {Pig, danish_pig.DanishPig, frozendict.frozendict}, + ("args[0]", "className"): {danish_pig.ClassName, str}, } def test_anyof_composition_gm_fruit_validate(self): @@ -133,25 +132,25 @@ def test_anyof_composition_gm_fruit_validate(self): for schema_classes in path_to_schemas.values(): GmFruit._process_schema_classes(schema_classes) assert path_to_schemas == { - ("args[0]",): {GmFruit, Apple, Banana, frozendict.frozendict}, - ("args[0]", "cultivar"): {Apple.Schema_.Properties.Cultivar, str}, + ("args[0]",): {GmFruit, apple.Apple, Banana, frozendict.frozendict}, + ("args[0]", "cultivar"): {apple.Cultivar, str}, ("args[0]", "lengthCm"): {NumberSchema, Decimal}, } class TestValidateCalls(unittest.TestCase): def test_empty_list_validate(self): - return_value = {("args[0]",): {ArrayHoldingAnyType, tuple}} + return_value = {("args[0]",): {array_holding_any_type.ArrayHoldingAnyType, tuple}} with patch.object( Schema, "_validate", return_value=return_value ) as mock_validate: - ArrayHoldingAnyType([]) + array_holding_any_type.ArrayHoldingAnyType([]) assert mock_validate.call_count == 1 with patch.object( Schema, "_validate", return_value=return_value ) as mock_validate: - ArrayHoldingAnyType.from_openapi_data_([]) + array_holding_any_type.ArrayHoldingAnyType.from_openapi_data_([]) assert mock_validate.call_count == 1 def test_empty_dict_validate(self): @@ -170,17 +169,17 @@ def test_empty_dict_validate(self): def test_list_validate_direct_instantiation(self): with patch.object( - ArrayWithValidationsInItems, + array_with_validations_in_items.ArrayWithValidationsInItems, "_validate", - side_effect=ArrayWithValidationsInItems._validate, + side_effect=array_with_validations_in_items.ArrayWithValidationsInItems._validate, ) as mock_outer_validate: with patch.object( - ArrayWithValidationsInItems.Schema_.Items, + array_with_validations_in_items.Items, "_validate", - side_effect=ArrayWithValidationsInItems.Schema_.Items._validate, + side_effect=array_with_validations_in_items.Items._validate, ) as mock_inner_validate: used_configuration = schema_configuration.SchemaConfiguration() - ArrayWithValidationsInItems([7], configuration_=used_configuration) + array_with_validations_in_items.ArrayWithValidationsInItems([7], configuration_=used_configuration) mock_outer_validate.assert_called_once_with( (Decimal("7"),), validation_metadata=ValidationMetadata(path_to_item=("args[0]",), configuration=used_configuration) @@ -192,42 +191,42 @@ def test_list_validate_direct_instantiation(self): def test_list_validate_direct_instantiation_cast_item(self): # item validation is skipped if items are of the correct type - item = ArrayWithValidationsInItems.Schema_.Items(7) + item = array_with_validations_in_items.Items(7) with patch.object( - ArrayWithValidationsInItems, + array_with_validations_in_items.ArrayWithValidationsInItems, "_validate", - side_effect=ArrayWithValidationsInItems._validate, + side_effect=array_with_validations_in_items.ArrayWithValidationsInItems._validate, ) as mock_outer_validate: with patch.object( - ArrayWithValidationsInItems.Schema_.Items, + array_with_validations_in_items.Items, "_validate", - side_effect=ArrayWithValidationsInItems.Schema_.Items._validate, + side_effect=array_with_validations_in_items.Items._validate, ) as mock_inner_validate: used_configuration = schema_configuration.SchemaConfiguration() - ArrayWithValidationsInItems([item], configuration_=used_configuration) + array_with_validations_in_items.ArrayWithValidationsInItems([item], configuration_=used_configuration) mock_outer_validate.assert_called_once_with( tuple([Decimal('7')]), validation_metadata=ValidationMetadata( path_to_item=("args[0]",), configuration=used_configuration, - validated_path_to_schemas={('args[0]', 0): {ArrayWithValidationsInItems.Schema_.Items, Decimal}} + validated_path_to_schemas={('args[0]', 0): {array_with_validations_in_items.Items, Decimal}} ) ) mock_inner_validate.assert_not_called def test_list_validate_from_openai_data_instantiation(self): with patch.object( - ArrayWithValidationsInItems, + array_with_validations_in_items.ArrayWithValidationsInItems, "_validate", - side_effect=ArrayWithValidationsInItems._validate, + side_effect=array_with_validations_in_items.ArrayWithValidationsInItems._validate, ) as mock_outer_validate: with patch.object( - ArrayWithValidationsInItems.Schema_.Items, + array_with_validations_in_items.Items, "_validate", - side_effect=ArrayWithValidationsInItems.Schema_.Items._validate, + side_effect=array_with_validations_in_items.Items._validate, ) as mock_inner_validate: used_configuration = schema_configuration.SchemaConfiguration() - ArrayWithValidationsInItems.from_openapi_data_([7], configuration_=used_configuration) + array_with_validations_in_items.ArrayWithValidationsInItems.from_openapi_data_([7], configuration_=used_configuration) mock_outer_validate.assert_called_once_with( (Decimal("7"),), validation_metadata=ValidationMetadata(path_to_item=("args[0]",), configuration=used_configuration)