diff --git a/modules/openapi-generator/src/main/resources/python-experimental/README.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/README.handlebars index 3ad16ce73ab..8560bcc5103 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/README.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/README.handlebars @@ -50,6 +50,14 @@ object schema properties as classes keyword in one schema, and include a format constraint in another schema - So if you need to access a string format based type, use as_date/as_datetime/as_decimal/as_uuid/ - So if you need to access a number format based type, use as_int/as_float +7. If object(dict) properties are accessed and they do not exist, then two things could happen + - When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload, + then two possible results can be returned. If someProp is defined in any of the validated schemas + where it will have to be optional, then the value schemas.unset will be returned. + If someProp was not defined as an explicit property in any of those schemas, then a KeyError will be raised. + - This was done so type hints for optional properties could show that schemas.Unset is a valid value. + - So you will need to update code to handle thrown KeyErrors or schema.unset values + ### Object property spec case This was done because when payloads are ingested, they can be validated against N number of schemas. diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_with_addprops.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_with_addprops.handlebars index 38d094d5613..73578ee3b9f 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_with_addprops.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_with_addprops.handlebars @@ -25,18 +25,28 @@ def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.proper @typing.overload {{#if complexType}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> '{{complexType}}': ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> typing.Union['{{complexType}}', schemas.Unset]: ... {{else}} {{#if nameInSnakeCase}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{name}}: ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> typing.Union[MetaOapg.properties.{{name}}, schemas.Unset]: ... {{else}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{baseName}}: ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> typing.Union[MetaOapg.properties.{{baseName}}, schemas.Unset]: ... {{/if}} {{/if}} {{/unless}} {{/each}} {{/if}} +{{#or vars getRequiredVarsMap}} -def __getitem__(self, name: str) -> {{#with additionalProperties}}{{#if complexType}}'{{complexType}}'{{else}}MetaOapg.{{baseName}}{{/if}}{{/with}}: +@typing.overload +def __getitem__(self, name: str) -> {{#with additionalProperties}}{{#if complexType}}'{{complexType}}'{{else}}MetaOapg.{{baseName}}{{/if}}{{/with}}: ... +{{/or}} + +def __getitem__(self, name: typing.Union[str, {{#each getRequiredVarsMap}}{{#with this}}typing.Literal["{{{baseName}}}"], {{/with}}{{/each}}{{#each vars}}{{#unless required}}typing.Literal["{{{baseName}}}"], {{/unless}}{{/each}}]){{#not vars}}{{#not getRequiredVarsMap}} -> {{#with additionalProperties}}{{#if complexType}}'{{complexType}}'{{else}}MetaOapg.{{baseName}}{{/if}}{{/with}}{{/not}}{{/not}}: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_without_addprops.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_without_addprops.handlebars index b135b9d1fb9..14169003593 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_without_addprops.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_getitems_without_addprops.handlebars @@ -1,30 +1,25 @@ {{#if vars}} {{#each vars}} -{{#unless @last}} @typing.overload {{#if complexType}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> '{{complexType}}': ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> {{#unless required}}typing.Union[{{/unless}}'{{complexType}}'{{#unless required}}, schemas.Unset]{{/unless}}: ... {{else}} {{#if nameInSnakeCase}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{name}}: ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> {{#unless required}}typing.Union[{{/unless}}MetaOapg.properties.{{name}}{{#unless required}}, schemas.Unset]{{/unless}}: ... {{else}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{baseName}}: ... +def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> {{#unless required}}typing.Union[{{/unless}}MetaOapg.properties.{{baseName}}{{#unless required}}, schemas.Unset]{{/unless}}: ... {{/if}} {{/if}} -{{else}} -{{#if complexType}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> '{{complexType}}': -{{else}} -{{#if nameInSnakeCase}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{name}}: -{{else}} -def __getitem__(self, name: typing.Literal["{{{baseName}}}"]) -> MetaOapg.properties.{{baseName}}: -{{/if}} -{{/if}} - # dict_instance[name] accessor - return super().__getitem__(name) -{{/unless}} {{/each}} +def __getitem__(self, name: typing.Literal[{{#each vars}}"{{{baseName}}}", {{/each}}]): + # dict_instance[name] accessor + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset + {{/if}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_type_hints.handlebars b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_type_hints.handlebars index d55c5c36912..888f7a8e16c 100644 --- a/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_type_hints.handlebars +++ b/modules/openapi-generator/src/main/resources/python-experimental/model_templates/property_type_hints.handlebars @@ -23,9 +23,9 @@ {{#unless required}} {{#unless nameInSnakeCase}} {{#if complexType}} -{{baseName}}: '{{complexType}}' +{{baseName}}: typing.Union['{{complexType}}', schemas.Unset] {{else}} -{{baseName}}: MetaOapg.properties.{{baseName}} +{{baseName}}: typing.Union[MetaOapg.properties.{{baseName}}, schemas.Unset] {{/if}} {{/unless}} {{/unless}} diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md index ffb5fbbea5c..9f33290df4b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md @@ -42,6 +42,14 @@ object schema properties as classes keyword in one schema, and include a format constraint in another schema - So if you need to access a string format based type, use as_date/as_datetime/as_decimal/as_uuid/ - So if you need to access a number format based type, use as_int/as_float +7. If object(dict) properties are accessed and they do not exist, then two things could happen + - When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload, + then two possible results can be returned. If someProp is defined in any of the validated schemas + where it will have to be optional, then the value schemas.unset will be returned. + If someProp was not defined as an explicit property in any of those schemas, then a KeyError will be raised. + - This was done so type hints for optional properties could show that schemas.Unset is a valid value. + - So you will need to update code to handle thrown KeyErrors or schema.unset values + ### Object property spec case This was done because when payloads are ingested, they can be validated against N number of schemas. diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py index bad897a1dd4..6500cb6a5d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.py @@ -42,18 +42,26 @@ class AdditionalpropertiesAllowsASchemaWhichShouldValidate( } additional_properties = schemas.BoolSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi index bad897a1dd4..6500cb6a5d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_allows_a_schema_which_should_validate.pyi @@ -42,18 +42,26 @@ class AdditionalpropertiesAllowsASchemaWhichShouldValidate( } additional_properties = schemas.BoolSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py index 759ece05528..ed104d2ede9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.py @@ -43,18 +43,26 @@ class AdditionalpropertiesAreAllowedByDefault( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi index 759ece05528..ed104d2ede9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_are_allowed_by_default.pyi @@ -43,18 +43,26 @@ class AdditionalpropertiesAreAllowedByDefault( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.py index 827b0963d8a..0650c1ea6d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.py @@ -35,9 +35,14 @@ class AdditionalpropertiesCanExistByItself( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.pyi index 827b0963d8a..0650c1ea6d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_can_exist_by_itself.pyi @@ -35,9 +35,14 @@ class AdditionalpropertiesCanExistByItself( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py index 902a8be268a..ebbf6125da9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.py @@ -50,14 +50,22 @@ class AdditionalpropertiesShouldNotLookInApplicators( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class AdditionalpropertiesShouldNotLookInApplicators( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi index 902a8be268a..ebbf6125da9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/additionalproperties_should_not_look_in_applicators.pyi @@ -50,14 +50,22 @@ class AdditionalpropertiesShouldNotLookInApplicators( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class AdditionalpropertiesShouldNotLookInApplicators( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py index d2898588597..e6b5383248d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.py @@ -58,9 +58,17 @@ class Allof( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class Allof( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class Allof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi index d2898588597..e6b5383248d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof.pyi @@ -58,9 +58,17 @@ class Allof( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class Allof( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class Allof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.py index f489c63653c..d77448ad1b6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.py @@ -46,9 +46,14 @@ class AllofCombinedWithAnyofOneof( multiple_of = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +79,14 @@ class AllofCombinedWithAnyofOneof( multiple_of = 5 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -102,9 +112,14 @@ class AllofCombinedWithAnyofOneof( multiple_of = 3 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -165,9 +180,14 @@ class AllofCombinedWithAnyofOneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.pyi index bdb688aaaa2..dfc8df807ba 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_combined_with_anyof_oneof.pyi @@ -45,9 +45,14 @@ class AllofCombinedWithAnyofOneof( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -72,9 +77,14 @@ class AllofCombinedWithAnyofOneof( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -99,9 +109,14 @@ class AllofCombinedWithAnyofOneof( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -162,9 +177,14 @@ class AllofCombinedWithAnyofOneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.py index 8c71189d34a..900d2432fbe 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.py @@ -46,9 +46,14 @@ class AllofSimpleTypes( inclusive_maximum = 30 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +79,14 @@ class AllofSimpleTypes( inclusive_minimum = 20 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -108,9 +118,14 @@ class AllofSimpleTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.pyi index 080696b60ae..e4272ec0067 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_simple_types.pyi @@ -45,9 +45,14 @@ class AllofSimpleTypes( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -72,9 +77,14 @@ class AllofSimpleTypes( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -106,9 +116,14 @@ class AllofSimpleTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py index 9493127bf94..d3679fb088d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.py @@ -66,9 +66,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -108,9 +116,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.properties.baz: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -149,9 +165,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi index 9493127bf94..d3679fb088d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_base_schema.pyi @@ -66,9 +66,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -108,9 +116,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.properties.baz: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -149,9 +165,17 @@ class AllofWithBaseSchema( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.py index 085c80dd4f4..fc0b359a8c2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.py @@ -52,9 +52,14 @@ class AllofWithOneEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.pyi index 085c80dd4f4..fc0b359a8c2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_one_empty_schema.pyi @@ -52,9 +52,14 @@ class AllofWithOneEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.py index 2945f1b48e2..1af0e43d7a6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.py @@ -54,9 +54,14 @@ class AllofWithTheFirstEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.pyi index 2945f1b48e2..1af0e43d7a6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_first_empty_schema.pyi @@ -54,9 +54,14 @@ class AllofWithTheFirstEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.py index e3a514849ff..c85fd65c7ba 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.py @@ -54,9 +54,14 @@ class AllofWithTheLastEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.pyi index e3a514849ff..c85fd65c7ba 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_the_last_empty_schema.pyi @@ -54,9 +54,14 @@ class AllofWithTheLastEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.py index a722042eef1..2076664da8e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.py @@ -54,9 +54,14 @@ class AllofWithTwoEmptySchemas( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.pyi index a722042eef1..2076664da8e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/allof_with_two_empty_schemas.pyi @@ -54,9 +54,14 @@ class AllofWithTwoEmptySchemas( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py index 886640f429c..db88c252c11 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py @@ -47,9 +47,14 @@ class Anyof( inclusive_minimum = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -81,9 +86,14 @@ class Anyof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.pyi index da054da8e89..04bd1bbf4bb 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.pyi @@ -46,9 +46,14 @@ class Anyof( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -80,9 +85,14 @@ class Anyof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py index 76b2ddfd04a..546e9a1258a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py @@ -58,9 +58,17 @@ class AnyofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class AnyofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class AnyofComplexTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi index 76b2ddfd04a..546e9a1258a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.pyi @@ -58,9 +58,17 @@ class AnyofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class AnyofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class AnyofComplexTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py index 0972a1afa20..e880b253284 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py @@ -46,9 +46,14 @@ class AnyofWithBaseSchema( max_length = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +79,14 @@ class AnyofWithBaseSchema( min_length = 4 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.pyi index f3b3f551667..085d3531c25 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.pyi @@ -45,9 +45,14 @@ class AnyofWithBaseSchema( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -72,9 +77,14 @@ class AnyofWithBaseSchema( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py index b9a9d502f89..3b1add2fe9d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py @@ -54,9 +54,14 @@ class AnyofWithOneEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.pyi index b9a9d502f89..3b1add2fe9d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.pyi @@ -54,9 +54,14 @@ class AnyofWithOneEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.py index 2545327dc96..fe56c3d652b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.py @@ -37,9 +37,14 @@ class ByInt( multiple_of = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.pyi index 445c3f4bc7b..d0243298f12 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_int.pyi @@ -36,9 +36,14 @@ class ByInt( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.py index 06bbbf60158..ea5a5a935d3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.py @@ -37,9 +37,14 @@ class ByNumber( multiple_of = 1.5 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.pyi index a9015a54502..36f78b0f843 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_number.pyi @@ -36,9 +36,14 @@ class ByNumber( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.py index d855662f199..00ff6c50ae9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.py @@ -37,9 +37,14 @@ class BySmallNumber( multiple_of = 0.00010 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.pyi index 95e4a7313aa..bf49547205a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/by_small_number.pyi @@ -36,9 +36,14 @@ class BySmallNumber( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py index 1a9ca47f276..8974bef83b2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.py @@ -74,17 +74,25 @@ class EnumsInProperties( additional_properties = schemas.AnyTypeSchema bar: MetaOapg.properties.bar - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi index 1a9ca47f276..8974bef83b2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/enums_in_properties.pyi @@ -74,17 +74,25 @@ class EnumsInProperties( additional_properties = schemas.AnyTypeSchema bar: MetaOapg.properties.bar - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py index ca13c3eb13e..5a48883522a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.py @@ -46,9 +46,14 @@ class ForbiddenProperty( not_schema = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -68,14 +73,22 @@ class ForbiddenProperty( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi index ca13c3eb13e..5a48883522a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/forbidden_property.pyi @@ -46,9 +46,14 @@ class ForbiddenProperty( not_schema = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -68,14 +73,22 @@ class ForbiddenProperty( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py index 91955175f29..44e73fadc1e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.py @@ -49,14 +49,22 @@ class InvalidStringValueForDefault( additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi index 7711a84cd98..c2da5b31836 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/invalid_string_value_for_default.pyi @@ -46,14 +46,22 @@ class InvalidStringValueForDefault( additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.py index 07d7bbd9d35..d3b9108be24 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.py @@ -37,9 +37,14 @@ class MaximumValidation( inclusive_maximum = 3.0 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.pyi index 4a06145d44a..7624e8598ef 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation.pyi @@ -36,9 +36,14 @@ class MaximumValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.py index 8f29c362ba8..83efec74dc4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.py @@ -37,9 +37,14 @@ class MaximumValidationWithUnsignedInteger( inclusive_maximum = 300 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.pyi index 0cf252536f9..a7dda20bcc3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maximum_validation_with_unsigned_integer.pyi @@ -36,9 +36,14 @@ class MaximumValidationWithUnsignedInteger( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.py index 388f059d50f..807244d5a7a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.py @@ -37,9 +37,14 @@ class MaxitemsValidation( max_items = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.pyi index 7641cc67061..3c5ccb21426 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxitems_validation.pyi @@ -36,9 +36,14 @@ class MaxitemsValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.py index 244427aca8f..564b54137be 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.py @@ -37,9 +37,14 @@ class MaxlengthValidation( max_length = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.pyi index 5faf2b929e3..7ab6629e2f3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxlength_validation.pyi @@ -36,9 +36,14 @@ class MaxlengthValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.py index c4a1c51f461..003b3b76e41 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.py @@ -37,9 +37,14 @@ class Maxproperties0MeansTheObjectIsEmpty( max_properties = 0 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.pyi index be884ca7d3c..81d9a35f0e4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties0_means_the_object_is_empty.pyi @@ -36,9 +36,14 @@ class Maxproperties0MeansTheObjectIsEmpty( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.py index 57225ea0ef3..d4e4e6b512f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.py @@ -37,9 +37,14 @@ class MaxpropertiesValidation( max_properties = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.pyi index cc2fa119762..4580f507964 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/maxproperties_validation.pyi @@ -36,9 +36,14 @@ class MaxpropertiesValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.py index 1e968b95ba6..f4db56c89a4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.py @@ -37,9 +37,14 @@ class MinimumValidation( inclusive_minimum = 1.1 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.pyi index f8407fd31f4..08903e3901d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation.pyi @@ -36,9 +36,14 @@ class MinimumValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.py index 7c79bcbbeae..7c1a97a6f25 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.py @@ -37,9 +37,14 @@ class MinimumValidationWithSignedInteger( inclusive_minimum = -2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.pyi index 02ada1250af..6460112ce24 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minimum_validation_with_signed_integer.pyi @@ -36,9 +36,14 @@ class MinimumValidationWithSignedInteger( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.py index fbbaed0fd5e..80fb2aa35cc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.py @@ -37,9 +37,14 @@ class MinitemsValidation( min_items = 1 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.pyi index eb34ff560fe..b560cbf212e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minitems_validation.pyi @@ -36,9 +36,14 @@ class MinitemsValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.py index 2c309798556..f4c696de899 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.py @@ -37,9 +37,14 @@ class MinlengthValidation( min_length = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.pyi index 5fa5b1ab158..dc52f919c14 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minlength_validation.pyi @@ -36,9 +36,14 @@ class MinlengthValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.py index 0f94bec0e92..0fb11a17bdb 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.py @@ -37,9 +37,14 @@ class MinpropertiesValidation( min_properties = 1 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.pyi index 198e3f7ddab..c5126beff67 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/minproperties_validation.pyi @@ -36,9 +36,14 @@ class MinpropertiesValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.py index 648245100b5..59dc3804d12 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.py @@ -37,9 +37,14 @@ class ModelNot( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.pyi index 648245100b5..59dc3804d12 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/model_not.pyi @@ -37,9 +37,14 @@ class ModelNot( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.py index 4a9e6eee01e..33278714163 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.py @@ -61,9 +61,14 @@ class NestedAllofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedAllofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.pyi index 4a9e6eee01e..33278714163 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_allof_to_check_validation_semantics.pyi @@ -61,9 +61,14 @@ class NestedAllofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedAllofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py index 95e87df250c..d2d2e46f712 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py @@ -61,9 +61,14 @@ class NestedAnyofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedAnyofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.pyi index 95e87df250c..d2d2e46f712 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.pyi @@ -61,9 +61,14 @@ class NestedAnyofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedAnyofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py index dbc4b3b9894..6f4edd1ca2a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py @@ -61,9 +61,14 @@ class NestedOneofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedOneofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.pyi index dbc4b3b9894..6f4edd1ca2a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.pyi @@ -61,9 +61,14 @@ class NestedOneofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -94,9 +99,14 @@ class NestedOneofToCheckValidationSemantics( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py index 461039da718..2934de9b11b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.py @@ -49,14 +49,22 @@ class NotMoreComplexSchema( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +82,14 @@ class NotMoreComplexSchema( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi index 461039da718..2934de9b11b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/not_more_complex_schema.pyi @@ -49,14 +49,22 @@ class NotMoreComplexSchema( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +82,14 @@ class NotMoreComplexSchema( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py index 3b2b4e54314..88845d01ac3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.py @@ -43,18 +43,26 @@ class ObjectPropertiesValidation( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi index 3b2b4e54314..88845d01ac3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/object_properties_validation.pyi @@ -43,18 +43,26 @@ class ObjectPropertiesValidation( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py index c4f82acff1a..997cea19e28 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py @@ -47,9 +47,14 @@ class Oneof( inclusive_minimum = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -81,9 +86,14 @@ class Oneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.pyi index 60652d7f171..263d107d67f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.pyi @@ -46,9 +46,14 @@ class Oneof( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -80,9 +85,14 @@ class Oneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py index fd6dfcacecc..39b115b0636 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py @@ -58,9 +58,17 @@ class OneofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class OneofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class OneofComplexTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi index fd6dfcacecc..39b115b0636 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.pyi @@ -58,9 +58,17 @@ class OneofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -100,9 +108,17 @@ class OneofComplexTypes( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -136,9 +152,14 @@ class OneofComplexTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py index c9ad6999bda..f420d29ec20 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py @@ -46,9 +46,14 @@ class OneofWithBaseSchema( min_length = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +79,14 @@ class OneofWithBaseSchema( max_length = 4 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.pyi index 6d882521c90..a710a217a8f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.pyi @@ -45,9 +45,14 @@ class OneofWithBaseSchema( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -72,9 +77,14 @@ class OneofWithBaseSchema( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py index bd777f2a444..0344275a9da 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py @@ -54,9 +54,14 @@ class OneofWithEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.pyi index bd777f2a444..0344275a9da 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.pyi @@ -54,9 +54,14 @@ class OneofWithEmptySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.py index bc1f1d9a6fd..f62ebf6e54a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.py @@ -59,9 +59,17 @@ class OneofWithRequired( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -99,9 +107,17 @@ class OneofWithRequired( @typing.overload def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -133,9 +149,14 @@ class OneofWithRequired( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.pyi index bc1f1d9a6fd..f62ebf6e54a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_required.pyi @@ -59,9 +59,17 @@ class OneofWithRequired( @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -99,9 +107,17 @@ class OneofWithRequired( @typing.overload def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -133,9 +149,14 @@ class OneofWithRequired( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.py index 3fda53eb614..7c56289ff01 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.py @@ -39,9 +39,14 @@ class PatternIsNotAnchored( }] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.pyi index 3da4fc48317..dacb7a5624c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_is_not_anchored.pyi @@ -36,9 +36,14 @@ class PatternIsNotAnchored( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.py index 5845f53bd38..1c4c6a2761d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.py @@ -39,9 +39,14 @@ class PatternValidation( }] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.pyi index 31dc0395c7e..b379184511f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/pattern_validation.pyi @@ -36,9 +36,14 @@ class PatternValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py index 413809f98b3..e1e252c7cfc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.py @@ -53,26 +53,34 @@ class PropertiesWithEscapedCharacters( @typing.overload - def __getitem__(self, name: typing.Literal["foo\nbar"]) -> MetaOapg.properties.foo_nbar: ... + def __getitem__(self, name: typing.Literal["foo\nbar"]) -> typing.Union[MetaOapg.properties.foo_nbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\"bar"]) -> MetaOapg.properties.foo_bar: ... + def __getitem__(self, name: typing.Literal["foo\"bar"]) -> typing.Union[MetaOapg.properties.foo_bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\\bar"]) -> MetaOapg.properties.foo__bar: ... + def __getitem__(self, name: typing.Literal["foo\\bar"]) -> typing.Union[MetaOapg.properties.foo__bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\rbar"]) -> MetaOapg.properties.foo_rbar: ... + def __getitem__(self, name: typing.Literal["foo\rbar"]) -> typing.Union[MetaOapg.properties.foo_rbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\tbar"]) -> MetaOapg.properties.foo_tbar: ... + def __getitem__(self, name: typing.Literal["foo\tbar"]) -> typing.Union[MetaOapg.properties.foo_tbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\fbar"]) -> MetaOapg.properties.foo_fbar: ... + def __getitem__(self, name: typing.Literal["foo\fbar"]) -> typing.Union[MetaOapg.properties.foo_fbar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\nbar"], typing.Literal["foo\"bar"], typing.Literal["foo\\bar"], typing.Literal["foo\rbar"], typing.Literal["foo\tbar"], typing.Literal["foo\fbar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi index 413809f98b3..e1e252c7cfc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/properties_with_escaped_characters.pyi @@ -53,26 +53,34 @@ class PropertiesWithEscapedCharacters( @typing.overload - def __getitem__(self, name: typing.Literal["foo\nbar"]) -> MetaOapg.properties.foo_nbar: ... + def __getitem__(self, name: typing.Literal["foo\nbar"]) -> typing.Union[MetaOapg.properties.foo_nbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\"bar"]) -> MetaOapg.properties.foo_bar: ... + def __getitem__(self, name: typing.Literal["foo\"bar"]) -> typing.Union[MetaOapg.properties.foo_bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\\bar"]) -> MetaOapg.properties.foo__bar: ... + def __getitem__(self, name: typing.Literal["foo\\bar"]) -> typing.Union[MetaOapg.properties.foo__bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\rbar"]) -> MetaOapg.properties.foo_rbar: ... + def __getitem__(self, name: typing.Literal["foo\rbar"]) -> typing.Union[MetaOapg.properties.foo_rbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\tbar"]) -> MetaOapg.properties.foo_tbar: ... + def __getitem__(self, name: typing.Literal["foo\tbar"]) -> typing.Union[MetaOapg.properties.foo_tbar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo\fbar"]) -> MetaOapg.properties.foo_fbar: ... + def __getitem__(self, name: typing.Literal["foo\fbar"]) -> typing.Union[MetaOapg.properties.foo_fbar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\nbar"], typing.Literal["foo\"bar"], typing.Literal["foo\\bar"], typing.Literal["foo\rbar"], typing.Literal["foo\tbar"], typing.Literal["foo\fbar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py index ce78f101833..a0efc5414c8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.py @@ -43,11 +43,19 @@ class PropertyNamedRefThatIsNotAReference( @typing.overload - def __getitem__(self, name: typing.Literal["$ref"]) -> MetaOapg.properties.ref: ... + def __getitem__(self, name: typing.Literal["$ref"]) -> typing.Union[MetaOapg.properties.ref, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["$ref"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi index ce78f101833..a0efc5414c8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/property_named_ref_that_is_not_a_reference.pyi @@ -43,11 +43,19 @@ class PropertyNamedRefThatIsNotAReference( @typing.overload - def __getitem__(self, name: typing.Literal["$ref"]) -> MetaOapg.properties.ref: ... + def __getitem__(self, name: typing.Literal["$ref"]) -> typing.Union[MetaOapg.properties.ref, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["$ref"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.py index 7af32fe4370..faa43b2736e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.py @@ -39,9 +39,14 @@ class RefInAdditionalproperties( def additional_properties(cls) -> typing.Type['PropertyNamedRefThatIsNotAReference']: return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> 'PropertyNamedRefThatIsNotAReference': + def __getitem__(self, name: typing.Union[str, ]) -> 'PropertyNamedRefThatIsNotAReference': # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.pyi index 7af32fe4370..faa43b2736e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_additionalproperties.pyi @@ -39,9 +39,14 @@ class RefInAdditionalproperties( def additional_properties(cls) -> typing.Type['PropertyNamedRefThatIsNotAReference']: return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> 'PropertyNamedRefThatIsNotAReference': + def __getitem__(self, name: typing.Union[str, ]) -> 'PropertyNamedRefThatIsNotAReference': # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.py index 4677f4717e5..84ef80dd95c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.py @@ -51,9 +51,14 @@ class RefInAllof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.pyi index 4677f4717e5..84ef80dd95c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_allof.pyi @@ -51,9 +51,14 @@ class RefInAllof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.py index 0410d56ace9..6af1d52828f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.py @@ -51,9 +51,14 @@ class RefInAnyof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.pyi index 0410d56ace9..6af1d52828f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_anyof.pyi @@ -51,9 +51,14 @@ class RefInAnyof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.py index 1b444394c51..be0106e7abc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.py @@ -41,9 +41,14 @@ class RefInNot( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.pyi index 1b444394c51..be0106e7abc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_not.pyi @@ -41,9 +41,14 @@ class RefInNot( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.py index 08b14af270f..1b505d72e59 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.py @@ -51,9 +51,14 @@ class RefInOneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.pyi index 08b14af270f..1b505d72e59 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_oneof.pyi @@ -51,9 +51,14 @@ class RefInOneof( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py index 824ff25cd65..4460ea43895 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.py @@ -45,14 +45,22 @@ class RefInProperty( additional_properties = schemas.AnyTypeSchema - a: 'PropertyNamedRefThatIsNotAReference' + a: typing.Union['PropertyNamedRefThatIsNotAReference', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["a"]) -> 'PropertyNamedRefThatIsNotAReference': ... + def __getitem__(self, name: typing.Literal["a"]) -> typing.Union['PropertyNamedRefThatIsNotAReference', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["a"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi index 824ff25cd65..4460ea43895 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/ref_in_property.pyi @@ -45,14 +45,22 @@ class RefInProperty( additional_properties = schemas.AnyTypeSchema - a: 'PropertyNamedRefThatIsNotAReference' + a: typing.Union['PropertyNamedRefThatIsNotAReference', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["a"]) -> 'PropertyNamedRefThatIsNotAReference': ... + def __getitem__(self, name: typing.Literal["a"]) -> typing.Union['PropertyNamedRefThatIsNotAReference', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["a"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py index 0e4534568a8..19c7059c787 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.py @@ -41,14 +41,22 @@ class RequiredDefaultValidation( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi index 0e4534568a8..19c7059c787 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_default_validation.pyi @@ -41,14 +41,22 @@ class RequiredDefaultValidation( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py index a57eeec5452..f92ab40956f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.py @@ -47,17 +47,25 @@ class RequiredValidation( foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi index a57eeec5452..f92ab40956f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_validation.pyi @@ -47,17 +47,25 @@ class RequiredValidation( foo: MetaOapg.properties.foo - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py index f6313dd1aab..5837b696c3c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.py @@ -41,14 +41,22 @@ class RequiredWithEmptyArray( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi index f6313dd1aab..5837b696c3c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_empty_array.pyi @@ -41,14 +41,22 @@ class RequiredWithEmptyArray( additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.py index 13375bda4b5..44d5a57cb52 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.py @@ -63,9 +63,17 @@ class RequiredWithEscapedCharacters( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.pyi index 13375bda4b5..44d5a57cb52 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/required_with_escaped_characters.pyi @@ -63,9 +63,17 @@ class RequiredWithEscapedCharacters( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py index 4ce74c7148a..3b1fff2b2da 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.py @@ -48,14 +48,22 @@ class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing( } additional_properties = schemas.AnyTypeSchema - alpha: MetaOapg.properties.alpha + alpha: typing.Union[MetaOapg.properties.alpha, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["alpha"]) -> MetaOapg.properties.alpha: ... + def __getitem__(self, name: typing.Literal["alpha"]) -> typing.Union[MetaOapg.properties.alpha, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["alpha"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi index d675b520165..c69a079a1ce 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/the_default_keyword_does_not_do_anything_if_the_property_is_missing.pyi @@ -45,14 +45,22 @@ class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing( } additional_properties = schemas.AnyTypeSchema - alpha: MetaOapg.properties.alpha + alpha: typing.Union[MetaOapg.properties.alpha, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["alpha"]) -> MetaOapg.properties.alpha: ... + def __getitem__(self, name: typing.Literal["alpha"]) -> typing.Union[MetaOapg.properties.alpha, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["alpha"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.py index 46b2ab73de6..e64a777c3dc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.py @@ -37,9 +37,14 @@ class UniqueitemsFalseValidation( unique_items = False - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.pyi index 1eaa1160de6..365a057f989 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_false_validation.pyi @@ -36,9 +36,14 @@ class UniqueitemsFalseValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.py index 50a41962f0f..274eedb0dcf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.py @@ -37,9 +37,14 @@ class UniqueitemsValidation( unique_items = True - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.pyi index 738ac726ada..08df1255381 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/uniqueitems_validation.pyi @@ -36,9 +36,14 @@ class UniqueitemsValidation( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py index b65bdb9c86b..81337e0d909 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py @@ -50,14 +50,22 @@ class SchemaForRequestBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -75,9 +83,14 @@ class SchemaForRequestBodyApplicationJson( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi index 05005f632ba..19113ee59e3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi @@ -48,14 +48,22 @@ class SchemaForRequestBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -73,9 +81,14 @@ class SchemaForRequestBodyApplicationJson( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.py index 0170027fc9a..f84f147e3de 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.py @@ -38,9 +38,14 @@ class SchemaForRequestBodyApplicationJson( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.pyi index 6a12f1f091e..623abe48e56 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_not_request_body/post.pyi @@ -36,9 +36,14 @@ class SchemaForRequestBodyApplicationJson( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py index 08153b7a3c6..9d83ecc9428 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py @@ -44,9 +44,14 @@ class SchemaForRequestBodyApplicationJson( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi index 20bc5835756..9c8589c6bad 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi @@ -42,9 +42,14 @@ class SchemaForRequestBodyApplicationJson( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py index d758957e97a..e8354e980d3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py @@ -64,9 +64,17 @@ class SchemaForRequestBodyApplicationJson( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi index c178c4241c5..1d9cc51117b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi @@ -62,9 +62,17 @@ class SchemaForRequestBodyApplicationJson( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py index f365edb0271..4646b38ac7c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py @@ -49,14 +49,22 @@ class SchemaFor200ResponseBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -74,9 +82,14 @@ class SchemaFor200ResponseBodyApplicationJson( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi index 908730b162f..d30c51c7702 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi @@ -47,14 +47,22 @@ class SchemaFor200ResponseBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - foo: MetaOapg.properties.foo + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -72,9 +80,14 @@ class SchemaFor200ResponseBodyApplicationJson( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.py index 155cf705d9c..872d8306c81 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.py @@ -37,9 +37,14 @@ class SchemaFor200ResponseBodyApplicationJson( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi index 8d38820866c..d905d0a1d5d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi @@ -35,9 +35,14 @@ class SchemaFor200ResponseBodyApplicationJson( not_schema = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.py index 429eea37ee3..623c8e83a2f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.py @@ -43,9 +43,14 @@ class SchemaFor200ResponseBodyApplicationJson( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.pyi index c70ceaabdfa..547fc18b1bf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post.pyi @@ -41,9 +41,14 @@ class SchemaFor200ResponseBodyApplicationJson( return PropertyNamedRefThatIsNotAReference - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.py index e0485457b5c..6a0627d60ce 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.py @@ -63,9 +63,17 @@ class SchemaFor200ResponseBodyApplicationJson( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi index 5f4c477a24b..f2fb0c1b6a2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi @@ -61,9 +61,17 @@ class SchemaFor200ResponseBodyApplicationJson( @typing.overload def __getitem__(self, name: typing.Literal["foo\\\\bar"]) -> MetaOapg.additional_properties: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["foo\\\"bar"], typing.Literal["foo\\nbar"], typing.Literal["foo\\fbar"], typing.Literal["foo\\tbar"], typing.Literal["foo\\rbar"], typing.Literal["foo\\\\bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index c2f0240a0ad..d3e542d2837 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -42,6 +42,14 @@ object schema properties as classes keyword in one schema, and include a format constraint in another schema - So if you need to access a string format based type, use as_date/as_datetime/as_decimal/as_uuid/ - So if you need to access a number format based type, use as_int/as_float +7. If object(dict) properties are accessed and they do not exist, then two things could happen + - When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload, + then two possible results can be returned. If someProp is defined in any of the validated schemas + where it will have to be optional, then the value schemas.unset will be returned. + If someProp was not defined as an explicit property in any of those schemas, then a KeyError will be raised. + - This was done so type hints for optional properties could show that schemas.Unset is a valid value. + - So you will need to update code to handle thrown KeyErrors or schema.unset values + ### Object property spec case This was done because when payloads are ingested, they can be validated against N number of schemas. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py index d031b32078c..7e82d85c150 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py @@ -44,9 +44,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -78,9 +83,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -95,9 +105,14 @@ class AdditionalPropertiesClass( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -145,9 +160,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -173,42 +193,50 @@ class AdditionalPropertiesClass( } additional_properties = schemas.AnyTypeSchema - map_property: MetaOapg.properties.map_property - map_of_map_property: MetaOapg.properties.map_of_map_property - anytype_1: MetaOapg.properties.anytype_1 - map_with_undeclared_properties_anytype_1: MetaOapg.properties.map_with_undeclared_properties_anytype_1 - map_with_undeclared_properties_anytype_2: MetaOapg.properties.map_with_undeclared_properties_anytype_2 - map_with_undeclared_properties_anytype_3: MetaOapg.properties.map_with_undeclared_properties_anytype_3 - empty_map: MetaOapg.properties.empty_map - map_with_undeclared_properties_string: MetaOapg.properties.map_with_undeclared_properties_string + map_property: typing.Union[MetaOapg.properties.map_property, schemas.Unset] + map_of_map_property: typing.Union[MetaOapg.properties.map_of_map_property, schemas.Unset] + anytype_1: typing.Union[MetaOapg.properties.anytype_1, schemas.Unset] + map_with_undeclared_properties_anytype_1: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_1, schemas.Unset] + map_with_undeclared_properties_anytype_2: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_2, schemas.Unset] + map_with_undeclared_properties_anytype_3: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_3, schemas.Unset] + empty_map: typing.Union[MetaOapg.properties.empty_map, schemas.Unset] + map_with_undeclared_properties_string: typing.Union[MetaOapg.properties.map_with_undeclared_properties_string, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["map_property"]) -> MetaOapg.properties.map_property: ... + def __getitem__(self, name: typing.Literal["map_property"]) -> typing.Union[MetaOapg.properties.map_property, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_of_map_property"]) -> MetaOapg.properties.map_of_map_property: ... + def __getitem__(self, name: typing.Literal["map_of_map_property"]) -> typing.Union[MetaOapg.properties.map_of_map_property, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anytype_1"]) -> MetaOapg.properties.anytype_1: ... + def __getitem__(self, name: typing.Literal["anytype_1"]) -> typing.Union[MetaOapg.properties.anytype_1, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_1"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_1: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_1"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_1, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_2"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_2: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_2"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_2, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_3"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_3: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_3"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_3, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["empty_map"]) -> MetaOapg.properties.empty_map: ... + def __getitem__(self, name: typing.Literal["empty_map"]) -> typing.Union[MetaOapg.properties.empty_map, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_string"]) -> MetaOapg.properties.map_with_undeclared_properties_string: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_string"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_string, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["map_property"], typing.Literal["map_of_map_property"], typing.Literal["anytype_1"], typing.Literal["map_with_undeclared_properties_anytype_1"], typing.Literal["map_with_undeclared_properties_anytype_2"], typing.Literal["map_with_undeclared_properties_anytype_3"], typing.Literal["empty_map"], typing.Literal["map_with_undeclared_properties_string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi index d031b32078c..7e82d85c150 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.pyi @@ -44,9 +44,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -78,9 +83,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -95,9 +105,14 @@ class AdditionalPropertiesClass( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -145,9 +160,14 @@ class AdditionalPropertiesClass( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -173,42 +193,50 @@ class AdditionalPropertiesClass( } additional_properties = schemas.AnyTypeSchema - map_property: MetaOapg.properties.map_property - map_of_map_property: MetaOapg.properties.map_of_map_property - anytype_1: MetaOapg.properties.anytype_1 - map_with_undeclared_properties_anytype_1: MetaOapg.properties.map_with_undeclared_properties_anytype_1 - map_with_undeclared_properties_anytype_2: MetaOapg.properties.map_with_undeclared_properties_anytype_2 - map_with_undeclared_properties_anytype_3: MetaOapg.properties.map_with_undeclared_properties_anytype_3 - empty_map: MetaOapg.properties.empty_map - map_with_undeclared_properties_string: MetaOapg.properties.map_with_undeclared_properties_string + map_property: typing.Union[MetaOapg.properties.map_property, schemas.Unset] + map_of_map_property: typing.Union[MetaOapg.properties.map_of_map_property, schemas.Unset] + anytype_1: typing.Union[MetaOapg.properties.anytype_1, schemas.Unset] + map_with_undeclared_properties_anytype_1: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_1, schemas.Unset] + map_with_undeclared_properties_anytype_2: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_2, schemas.Unset] + map_with_undeclared_properties_anytype_3: typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_3, schemas.Unset] + empty_map: typing.Union[MetaOapg.properties.empty_map, schemas.Unset] + map_with_undeclared_properties_string: typing.Union[MetaOapg.properties.map_with_undeclared_properties_string, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["map_property"]) -> MetaOapg.properties.map_property: ... + def __getitem__(self, name: typing.Literal["map_property"]) -> typing.Union[MetaOapg.properties.map_property, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_of_map_property"]) -> MetaOapg.properties.map_of_map_property: ... + def __getitem__(self, name: typing.Literal["map_of_map_property"]) -> typing.Union[MetaOapg.properties.map_of_map_property, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anytype_1"]) -> MetaOapg.properties.anytype_1: ... + def __getitem__(self, name: typing.Literal["anytype_1"]) -> typing.Union[MetaOapg.properties.anytype_1, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_1"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_1: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_1"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_1, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_2"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_2: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_2"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_2, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_3"]) -> MetaOapg.properties.map_with_undeclared_properties_anytype_3: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_anytype_3"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_anytype_3, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["empty_map"]) -> MetaOapg.properties.empty_map: ... + def __getitem__(self, name: typing.Literal["empty_map"]) -> typing.Union[MetaOapg.properties.empty_map, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_string"]) -> MetaOapg.properties.map_with_undeclared_properties_string: ... + def __getitem__(self, name: typing.Literal["map_with_undeclared_properties_string"]) -> typing.Union[MetaOapg.properties.map_with_undeclared_properties_string, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["map_property"], typing.Literal["map_of_map_property"], typing.Literal["anytype_1"], typing.Literal["map_with_undeclared_properties_anytype_1"], typing.Literal["map_with_undeclared_properties_anytype_2"], typing.Literal["map_with_undeclared_properties_anytype_3"], typing.Literal["empty_map"], typing.Literal["map_with_undeclared_properties_string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py index 0fcfbe2bab4..78120c8eac5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.py @@ -61,9 +61,14 @@ class AdditionalPropertiesWithArrayOfEnums( def __getitem__(self, i: int) -> 'EnumClass': return super().__getitem__(i) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi index 0fcfbe2bab4..78120c8eac5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_with_array_of_enums.pyi @@ -61,9 +61,14 @@ class AdditionalPropertiesWithArrayOfEnums( def __getitem__(self, i: int) -> 'EnumClass': return super().__getitem__(i) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py index 567fe27c808..533c6854b1f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py @@ -35,9 +35,14 @@ class Address( class MetaOapg: additional_properties = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.pyi index 567fe27c808..533c6854b1f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.pyi @@ -35,9 +35,14 @@ class Address( class MetaOapg: additional_properties = schemas.IntSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py index 7b37f3af892..517df714972 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py @@ -56,17 +56,25 @@ class Animal( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi index 7b37f3af892..517df714972 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.pyi @@ -56,17 +56,25 @@ class Animal( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.py index 5ec1425ae8c..f1f73c99f35 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.py @@ -37,9 +37,14 @@ class AnyTypeNotString( not_schema = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.pyi index 5ec1425ae8c..f1f73c99f35 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/any_type_not_string.pyi @@ -37,9 +37,14 @@ class AnyTypeNotString( not_schema = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py index 9ecef0613b6..5bab43b5ebe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py @@ -44,22 +44,30 @@ class ApiResponse( } additional_properties = schemas.AnyTypeSchema - code: MetaOapg.properties.code - type: MetaOapg.properties.type - message: MetaOapg.properties.message + code: typing.Union[MetaOapg.properties.code, schemas.Unset] + type: typing.Union[MetaOapg.properties.type, schemas.Unset] + message: typing.Union[MetaOapg.properties.message, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["code"]) -> MetaOapg.properties.code: ... + def __getitem__(self, name: typing.Literal["code"]) -> typing.Union[MetaOapg.properties.code, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["type"]) -> MetaOapg.properties.type: ... + def __getitem__(self, name: typing.Literal["type"]) -> typing.Union[MetaOapg.properties.type, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["message"]) -> MetaOapg.properties.message: ... + def __getitem__(self, name: typing.Literal["message"]) -> typing.Union[MetaOapg.properties.message, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["code"], typing.Literal["type"], typing.Literal["message"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi index 9ecef0613b6..5bab43b5ebe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.pyi @@ -44,22 +44,30 @@ class ApiResponse( } additional_properties = schemas.AnyTypeSchema - code: MetaOapg.properties.code - type: MetaOapg.properties.type - message: MetaOapg.properties.message + code: typing.Union[MetaOapg.properties.code, schemas.Unset] + type: typing.Union[MetaOapg.properties.type, schemas.Unset] + message: typing.Union[MetaOapg.properties.message, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["code"]) -> MetaOapg.properties.code: ... + def __getitem__(self, name: typing.Literal["code"]) -> typing.Union[MetaOapg.properties.code, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["type"]) -> MetaOapg.properties.type: ... + def __getitem__(self, name: typing.Literal["type"]) -> typing.Union[MetaOapg.properties.type, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["message"]) -> MetaOapg.properties.message: ... + def __getitem__(self, name: typing.Literal["message"]) -> typing.Union[MetaOapg.properties.message, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["code"], typing.Literal["type"], typing.Literal["message"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py index d1647a5b0e6..92a98a940c7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py @@ -73,17 +73,25 @@ class Apple( cultivar: MetaOapg.properties.cultivar - origin: MetaOapg.properties.origin + origin: typing.Union[MetaOapg.properties.origin, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["cultivar"]) -> MetaOapg.properties.cultivar: ... @typing.overload - def __getitem__(self, name: typing.Literal["origin"]) -> MetaOapg.properties.origin: ... + def __getitem__(self, name: typing.Literal["origin"]) -> typing.Union[MetaOapg.properties.origin, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["cultivar"], typing.Literal["origin"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi index 37f5df154fb..f2c6cd19bc5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.pyi @@ -60,17 +60,25 @@ class Apple( cultivar: MetaOapg.properties.cultivar - origin: MetaOapg.properties.origin + origin: typing.Union[MetaOapg.properties.origin, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["cultivar"]) -> MetaOapg.properties.cultivar: ... @typing.overload - def __getitem__(self, name: typing.Literal["origin"]) -> MetaOapg.properties.origin: ... + def __getitem__(self, name: typing.Literal["origin"]) -> typing.Union[MetaOapg.properties.origin, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["cultivar"], typing.Literal["origin"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py index d5284aac246..6e1a6598acc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py @@ -46,14 +46,22 @@ class AppleReq( additional_properties = None cultivar: MetaOapg.properties.cultivar - mealy: MetaOapg.properties.mealy + mealy: typing.Union[MetaOapg.properties.mealy, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["cultivar"]) -> MetaOapg.properties.cultivar: ... - def __getitem__(self, name: typing.Literal["mealy"]) -> MetaOapg.properties.mealy: + @typing.overload + def __getitem__(self, name: typing.Literal["mealy"]) -> typing.Union[MetaOapg.properties.mealy, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["cultivar", "mealy", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi index d5284aac246..6e1a6598acc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.pyi @@ -46,14 +46,22 @@ class AppleReq( additional_properties = None cultivar: MetaOapg.properties.cultivar - mealy: MetaOapg.properties.mealy + mealy: typing.Union[MetaOapg.properties.mealy, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["cultivar"]) -> MetaOapg.properties.cultivar: ... - def __getitem__(self, name: typing.Literal["mealy"]) -> MetaOapg.properties.mealy: + @typing.overload + def __getitem__(self, name: typing.Literal["mealy"]) -> typing.Union[MetaOapg.properties.mealy, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["cultivar", "mealy", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py index ebdd7a990f8..ec569acae1d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py @@ -84,14 +84,22 @@ class ArrayOfArrayOfNumberOnly( } additional_properties = schemas.AnyTypeSchema - ArrayArrayNumber: MetaOapg.properties.ArrayArrayNumber + ArrayArrayNumber: typing.Union[MetaOapg.properties.ArrayArrayNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["ArrayArrayNumber"]) -> MetaOapg.properties.ArrayArrayNumber: ... + def __getitem__(self, name: typing.Literal["ArrayArrayNumber"]) -> typing.Union[MetaOapg.properties.ArrayArrayNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["ArrayArrayNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi index ebdd7a990f8..ec569acae1d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.pyi @@ -84,14 +84,22 @@ class ArrayOfArrayOfNumberOnly( } additional_properties = schemas.AnyTypeSchema - ArrayArrayNumber: MetaOapg.properties.ArrayArrayNumber + ArrayArrayNumber: typing.Union[MetaOapg.properties.ArrayArrayNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["ArrayArrayNumber"]) -> MetaOapg.properties.ArrayArrayNumber: ... + def __getitem__(self, name: typing.Literal["ArrayArrayNumber"]) -> typing.Union[MetaOapg.properties.ArrayArrayNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["ArrayArrayNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py index ff0f7224a38..7dadf618b55 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py @@ -62,14 +62,22 @@ class ArrayOfNumberOnly( } additional_properties = schemas.AnyTypeSchema - ArrayNumber: MetaOapg.properties.ArrayNumber + ArrayNumber: typing.Union[MetaOapg.properties.ArrayNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["ArrayNumber"]) -> MetaOapg.properties.ArrayNumber: ... + def __getitem__(self, name: typing.Literal["ArrayNumber"]) -> typing.Union[MetaOapg.properties.ArrayNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["ArrayNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi index ff0f7224a38..7dadf618b55 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.pyi @@ -62,14 +62,22 @@ class ArrayOfNumberOnly( } additional_properties = schemas.AnyTypeSchema - ArrayNumber: MetaOapg.properties.ArrayNumber + ArrayNumber: typing.Union[MetaOapg.properties.ArrayNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["ArrayNumber"]) -> MetaOapg.properties.ArrayNumber: ... + def __getitem__(self, name: typing.Literal["ArrayNumber"]) -> typing.Union[MetaOapg.properties.ArrayNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["ArrayNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py index 72a10964b44..c1228a04993 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -158,22 +158,30 @@ class ArrayTest( } additional_properties = schemas.AnyTypeSchema - array_of_string: MetaOapg.properties.array_of_string - array_array_of_integer: MetaOapg.properties.array_array_of_integer - array_array_of_model: MetaOapg.properties.array_array_of_model + array_of_string: typing.Union[MetaOapg.properties.array_of_string, schemas.Unset] + array_array_of_integer: typing.Union[MetaOapg.properties.array_array_of_integer, schemas.Unset] + array_array_of_model: typing.Union[MetaOapg.properties.array_array_of_model, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["array_of_string"]) -> MetaOapg.properties.array_of_string: ... + def __getitem__(self, name: typing.Literal["array_of_string"]) -> typing.Union[MetaOapg.properties.array_of_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_array_of_integer"]) -> MetaOapg.properties.array_array_of_integer: ... + def __getitem__(self, name: typing.Literal["array_array_of_integer"]) -> typing.Union[MetaOapg.properties.array_array_of_integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_array_of_model"]) -> MetaOapg.properties.array_array_of_model: ... + def __getitem__(self, name: typing.Literal["array_array_of_model"]) -> typing.Union[MetaOapg.properties.array_array_of_model, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["array_of_string"], typing.Literal["array_array_of_integer"], typing.Literal["array_array_of_model"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi index 72a10964b44..c1228a04993 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.pyi @@ -158,22 +158,30 @@ class ArrayTest( } additional_properties = schemas.AnyTypeSchema - array_of_string: MetaOapg.properties.array_of_string - array_array_of_integer: MetaOapg.properties.array_array_of_integer - array_array_of_model: MetaOapg.properties.array_array_of_model + array_of_string: typing.Union[MetaOapg.properties.array_of_string, schemas.Unset] + array_array_of_integer: typing.Union[MetaOapg.properties.array_array_of_integer, schemas.Unset] + array_array_of_model: typing.Union[MetaOapg.properties.array_array_of_model, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["array_of_string"]) -> MetaOapg.properties.array_of_string: ... + def __getitem__(self, name: typing.Literal["array_of_string"]) -> typing.Union[MetaOapg.properties.array_of_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_array_of_integer"]) -> MetaOapg.properties.array_array_of_integer: ... + def __getitem__(self, name: typing.Literal["array_array_of_integer"]) -> typing.Union[MetaOapg.properties.array_array_of_integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_array_of_model"]) -> MetaOapg.properties.array_array_of_model: ... + def __getitem__(self, name: typing.Literal["array_array_of_model"]) -> typing.Union[MetaOapg.properties.array_array_of_model, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["array_of_string"], typing.Literal["array_array_of_integer"], typing.Literal["array_array_of_model"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py index 2b234860649..0a42cb0cb83 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py @@ -48,9 +48,17 @@ class Banana( @typing.overload def __getitem__(self, name: typing.Literal["lengthCm"]) -> MetaOapg.properties.lengthCm: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["lengthCm"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi index 2b234860649..0a42cb0cb83 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.pyi @@ -48,9 +48,17 @@ class Banana( @typing.overload def __getitem__(self, name: typing.Literal["lengthCm"]) -> MetaOapg.properties.lengthCm: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["lengthCm"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py index 809e3392360..5f94c4a9a0f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py @@ -46,14 +46,22 @@ class BananaReq( additional_properties = None lengthCm: MetaOapg.properties.lengthCm - sweet: MetaOapg.properties.sweet + sweet: typing.Union[MetaOapg.properties.sweet, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["lengthCm"]) -> MetaOapg.properties.lengthCm: ... - def __getitem__(self, name: typing.Literal["sweet"]) -> MetaOapg.properties.sweet: + @typing.overload + def __getitem__(self, name: typing.Literal["sweet"]) -> typing.Union[MetaOapg.properties.sweet, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["lengthCm", "sweet", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi index 809e3392360..5f94c4a9a0f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.pyi @@ -46,14 +46,22 @@ class BananaReq( additional_properties = None lengthCm: MetaOapg.properties.lengthCm - sweet: MetaOapg.properties.sweet + sweet: typing.Union[MetaOapg.properties.sweet, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["lengthCm"]) -> MetaOapg.properties.lengthCm: ... - def __getitem__(self, name: typing.Literal["sweet"]) -> MetaOapg.properties.sweet: + @typing.overload + def __getitem__(self, name: typing.Literal["sweet"]) -> typing.Union[MetaOapg.properties.sweet, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["lengthCm", "sweet", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py index ebb77174d75..0eb48cb842a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py @@ -62,9 +62,17 @@ class BasquePig( @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi index ebb77174d75..0eb48cb842a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.pyi @@ -62,9 +62,17 @@ class BasquePig( @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py index dc41a315878..6438772d5b0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py @@ -50,34 +50,42 @@ class Capitalization( } additional_properties = schemas.AnyTypeSchema - smallCamel: MetaOapg.properties.smallCamel - CapitalCamel: MetaOapg.properties.CapitalCamel - small_Snake: MetaOapg.properties.small_Snake - Capital_Snake: MetaOapg.properties.Capital_Snake - SCA_ETH_Flow_Points: MetaOapg.properties.SCA_ETH_Flow_Points - ATT_NAME: MetaOapg.properties.ATT_NAME + smallCamel: typing.Union[MetaOapg.properties.smallCamel, schemas.Unset] + CapitalCamel: typing.Union[MetaOapg.properties.CapitalCamel, schemas.Unset] + small_Snake: typing.Union[MetaOapg.properties.small_Snake, schemas.Unset] + Capital_Snake: typing.Union[MetaOapg.properties.Capital_Snake, schemas.Unset] + SCA_ETH_Flow_Points: typing.Union[MetaOapg.properties.SCA_ETH_Flow_Points, schemas.Unset] + ATT_NAME: typing.Union[MetaOapg.properties.ATT_NAME, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["smallCamel"]) -> MetaOapg.properties.smallCamel: ... + def __getitem__(self, name: typing.Literal["smallCamel"]) -> typing.Union[MetaOapg.properties.smallCamel, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["CapitalCamel"]) -> MetaOapg.properties.CapitalCamel: ... + def __getitem__(self, name: typing.Literal["CapitalCamel"]) -> typing.Union[MetaOapg.properties.CapitalCamel, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["small_Snake"]) -> MetaOapg.properties.small_Snake: ... + def __getitem__(self, name: typing.Literal["small_Snake"]) -> typing.Union[MetaOapg.properties.small_Snake, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["Capital_Snake"]) -> MetaOapg.properties.Capital_Snake: ... + def __getitem__(self, name: typing.Literal["Capital_Snake"]) -> typing.Union[MetaOapg.properties.Capital_Snake, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["SCA_ETH_Flow_Points"]) -> MetaOapg.properties.SCA_ETH_Flow_Points: ... + def __getitem__(self, name: typing.Literal["SCA_ETH_Flow_Points"]) -> typing.Union[MetaOapg.properties.SCA_ETH_Flow_Points, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["ATT_NAME"]) -> MetaOapg.properties.ATT_NAME: ... + def __getitem__(self, name: typing.Literal["ATT_NAME"]) -> typing.Union[MetaOapg.properties.ATT_NAME, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["smallCamel"], typing.Literal["CapitalCamel"], typing.Literal["small_Snake"], typing.Literal["Capital_Snake"], typing.Literal["SCA_ETH_Flow_Points"], typing.Literal["ATT_NAME"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi index dc41a315878..6438772d5b0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.pyi @@ -50,34 +50,42 @@ class Capitalization( } additional_properties = schemas.AnyTypeSchema - smallCamel: MetaOapg.properties.smallCamel - CapitalCamel: MetaOapg.properties.CapitalCamel - small_Snake: MetaOapg.properties.small_Snake - Capital_Snake: MetaOapg.properties.Capital_Snake - SCA_ETH_Flow_Points: MetaOapg.properties.SCA_ETH_Flow_Points - ATT_NAME: MetaOapg.properties.ATT_NAME + smallCamel: typing.Union[MetaOapg.properties.smallCamel, schemas.Unset] + CapitalCamel: typing.Union[MetaOapg.properties.CapitalCamel, schemas.Unset] + small_Snake: typing.Union[MetaOapg.properties.small_Snake, schemas.Unset] + Capital_Snake: typing.Union[MetaOapg.properties.Capital_Snake, schemas.Unset] + SCA_ETH_Flow_Points: typing.Union[MetaOapg.properties.SCA_ETH_Flow_Points, schemas.Unset] + ATT_NAME: typing.Union[MetaOapg.properties.ATT_NAME, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["smallCamel"]) -> MetaOapg.properties.smallCamel: ... + def __getitem__(self, name: typing.Literal["smallCamel"]) -> typing.Union[MetaOapg.properties.smallCamel, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["CapitalCamel"]) -> MetaOapg.properties.CapitalCamel: ... + def __getitem__(self, name: typing.Literal["CapitalCamel"]) -> typing.Union[MetaOapg.properties.CapitalCamel, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["small_Snake"]) -> MetaOapg.properties.small_Snake: ... + def __getitem__(self, name: typing.Literal["small_Snake"]) -> typing.Union[MetaOapg.properties.small_Snake, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["Capital_Snake"]) -> MetaOapg.properties.Capital_Snake: ... + def __getitem__(self, name: typing.Literal["Capital_Snake"]) -> typing.Union[MetaOapg.properties.Capital_Snake, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["SCA_ETH_Flow_Points"]) -> MetaOapg.properties.SCA_ETH_Flow_Points: ... + def __getitem__(self, name: typing.Literal["SCA_ETH_Flow_Points"]) -> typing.Union[MetaOapg.properties.SCA_ETH_Flow_Points, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["ATT_NAME"]) -> MetaOapg.properties.ATT_NAME: ... + def __getitem__(self, name: typing.Literal["ATT_NAME"]) -> typing.Union[MetaOapg.properties.ATT_NAME, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["smallCamel"], typing.Literal["CapitalCamel"], typing.Literal["small_Snake"], typing.Literal["Capital_Snake"], typing.Literal["SCA_ETH_Flow_Points"], typing.Literal["ATT_NAME"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py index 671a518e549..8648a0be4ce 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py @@ -49,14 +49,22 @@ class Cat( } additional_properties = schemas.AnyTypeSchema - declawed: MetaOapg.properties.declawed + declawed: typing.Union[MetaOapg.properties.declawed, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["declawed"]) -> MetaOapg.properties.declawed: ... + def __getitem__(self, name: typing.Literal["declawed"]) -> typing.Union[MetaOapg.properties.declawed, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["declawed"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class Cat( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi index 671a518e549..8648a0be4ce 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.pyi @@ -49,14 +49,22 @@ class Cat( } additional_properties = schemas.AnyTypeSchema - declawed: MetaOapg.properties.declawed + declawed: typing.Union[MetaOapg.properties.declawed, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["declawed"]) -> MetaOapg.properties.declawed: ... + def __getitem__(self, name: typing.Literal["declawed"]) -> typing.Union[MetaOapg.properties.declawed, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["declawed"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class Cat( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py index c5d7bebc09a..190bc580584 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py @@ -46,17 +46,25 @@ class Category( additional_properties = schemas.AnyTypeSchema name: MetaOapg.properties.name - id: MetaOapg.properties.id + id: typing.Union[MetaOapg.properties.id, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["id"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi index c5d7bebc09a..190bc580584 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.pyi @@ -46,17 +46,25 @@ class Category( additional_properties = schemas.AnyTypeSchema name: MetaOapg.properties.name - id: MetaOapg.properties.id + id: typing.Union[MetaOapg.properties.id, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["id"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py index 8d4e029e08a..8265523b6b2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -49,14 +49,22 @@ class ChildCat( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class ChildCat( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi index 8d4e029e08a..8265523b6b2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.pyi @@ -49,14 +49,22 @@ class ChildCat( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class ChildCat( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py index 53bfdeb1fe9..4185f94ea2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py @@ -43,14 +43,22 @@ class ClassModel( additional_properties = schemas.AnyTypeSchema - _class: MetaOapg.properties._class + _class: typing.Union[MetaOapg.properties._class, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["_class"]) -> MetaOapg.properties._class: ... + def __getitem__(self, name: typing.Literal["_class"]) -> typing.Union[MetaOapg.properties._class, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["_class"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi index 53bfdeb1fe9..4185f94ea2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.pyi @@ -43,14 +43,22 @@ class ClassModel( additional_properties = schemas.AnyTypeSchema - _class: MetaOapg.properties._class + _class: typing.Union[MetaOapg.properties._class, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["_class"]) -> MetaOapg.properties._class: ... + def __getitem__(self, name: typing.Literal["_class"]) -> typing.Union[MetaOapg.properties._class, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["_class"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py index 38e5db28e9c..d16f6aac81c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py @@ -40,14 +40,22 @@ class Client( } additional_properties = schemas.AnyTypeSchema - client: MetaOapg.properties.client + client: typing.Union[MetaOapg.properties.client, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["client"]) -> MetaOapg.properties.client: ... + def __getitem__(self, name: typing.Literal["client"]) -> typing.Union[MetaOapg.properties.client, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["client"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi index 38e5db28e9c..d16f6aac81c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.pyi @@ -40,14 +40,22 @@ class Client( } additional_properties = schemas.AnyTypeSchema - client: MetaOapg.properties.client + client: typing.Union[MetaOapg.properties.client, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["client"]) -> MetaOapg.properties.client: ... + def __getitem__(self, name: typing.Literal["client"]) -> typing.Union[MetaOapg.properties.client, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["client"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py index 3c26147727d..3d25cd8a94c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py @@ -63,14 +63,22 @@ class ComplexQuadrilateral( } additional_properties = schemas.AnyTypeSchema - quadrilateralType: MetaOapg.properties.quadrilateralType + quadrilateralType: typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... + def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class ComplexQuadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi index 3c26147727d..3d25cd8a94c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.pyi @@ -63,14 +63,22 @@ class ComplexQuadrilateral( } additional_properties = schemas.AnyTypeSchema - quadrilateralType: MetaOapg.properties.quadrilateralType + quadrilateralType: typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... + def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class ComplexQuadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.py index fb7d1e5ae02..b6a52997e07 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.py @@ -104,9 +104,14 @@ class ComposedAnyOfDifferentTypesNoValidations( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.pyi index fb7d1e5ae02..b6a52997e07 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_any_of_different_types_no_validations.pyi @@ -104,9 +104,14 @@ class ComposedAnyOfDifferentTypesNoValidations( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.py index c5c3dc6eb73..4a40a2354e4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.py @@ -53,9 +53,14 @@ class ComposedObject( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.pyi index c5c3dc6eb73..4a40a2354e4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_object.pyi @@ -53,9 +53,14 @@ class ComposedObject( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py index 9aed9e0f413..25988ac47b1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.py @@ -50,9 +50,14 @@ class ComposedOneOfDifferentTypes( max_properties = 4 min_properties = 4 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -125,9 +130,14 @@ class ComposedOneOfDifferentTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi index e2f0656306a..64d024d01d9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/composed_one_of_different_types.pyi @@ -48,9 +48,14 @@ class ComposedOneOfDifferentTypes( class MetaOapg: additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -116,9 +121,14 @@ class ComposedOneOfDifferentTypes( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py index d638204f973..0cbd72488fe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py @@ -62,9 +62,17 @@ class DanishPig( @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi index d638204f973..0cbd72488fe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.pyi @@ -62,9 +62,17 @@ class DanishPig( @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py index feb74f9e8ab..4d654ca38af 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py @@ -49,14 +49,22 @@ class Dog( } additional_properties = schemas.AnyTypeSchema - breed: MetaOapg.properties.breed + breed: typing.Union[MetaOapg.properties.breed, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["breed"]) -> MetaOapg.properties.breed: ... + def __getitem__(self, name: typing.Literal["breed"]) -> typing.Union[MetaOapg.properties.breed, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["breed"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class Dog( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi index feb74f9e8ab..4d654ca38af 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.pyi @@ -49,14 +49,22 @@ class Dog( } additional_properties = schemas.AnyTypeSchema - breed: MetaOapg.properties.breed + breed: typing.Union[MetaOapg.properties.breed, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["breed"]) -> MetaOapg.properties.breed: ... + def __getitem__(self, name: typing.Literal["breed"]) -> typing.Union[MetaOapg.properties.breed, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["breed"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,9 +98,14 @@ class Dog( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py index ce35e7e6d25..4bcb43a549e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py @@ -88,26 +88,34 @@ class Drawing( def additional_properties(cls) -> typing.Type['Fruit']: return Fruit - mainShape: 'Shape' - shapeOrNull: 'ShapeOrNull' - nullableShape: 'NullableShape' - shapes: MetaOapg.properties.shapes + mainShape: typing.Union['Shape', schemas.Unset] + shapeOrNull: typing.Union['ShapeOrNull', schemas.Unset] + nullableShape: typing.Union['NullableShape', schemas.Unset] + shapes: typing.Union[MetaOapg.properties.shapes, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["mainShape"]) -> 'Shape': ... + def __getitem__(self, name: typing.Literal["mainShape"]) -> typing.Union['Shape', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shapeOrNull"]) -> 'ShapeOrNull': ... + def __getitem__(self, name: typing.Literal["shapeOrNull"]) -> typing.Union['ShapeOrNull', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["nullableShape"]) -> 'NullableShape': ... + def __getitem__(self, name: typing.Literal["nullableShape"]) -> typing.Union['NullableShape', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shapes"]) -> MetaOapg.properties.shapes: ... + def __getitem__(self, name: typing.Literal["shapes"]) -> typing.Union[MetaOapg.properties.shapes, schemas.Unset]: ... - def __getitem__(self, name: str) -> 'Fruit': + @typing.overload + def __getitem__(self, name: str) -> 'Fruit': ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["mainShape"], typing.Literal["shapeOrNull"], typing.Literal["nullableShape"], typing.Literal["shapes"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi index ce35e7e6d25..4bcb43a549e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.pyi @@ -88,26 +88,34 @@ class Drawing( def additional_properties(cls) -> typing.Type['Fruit']: return Fruit - mainShape: 'Shape' - shapeOrNull: 'ShapeOrNull' - nullableShape: 'NullableShape' - shapes: MetaOapg.properties.shapes + mainShape: typing.Union['Shape', schemas.Unset] + shapeOrNull: typing.Union['ShapeOrNull', schemas.Unset] + nullableShape: typing.Union['NullableShape', schemas.Unset] + shapes: typing.Union[MetaOapg.properties.shapes, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["mainShape"]) -> 'Shape': ... + def __getitem__(self, name: typing.Literal["mainShape"]) -> typing.Union['Shape', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shapeOrNull"]) -> 'ShapeOrNull': ... + def __getitem__(self, name: typing.Literal["shapeOrNull"]) -> typing.Union['ShapeOrNull', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["nullableShape"]) -> 'NullableShape': ... + def __getitem__(self, name: typing.Literal["nullableShape"]) -> typing.Union['NullableShape', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shapes"]) -> MetaOapg.properties.shapes: ... + def __getitem__(self, name: typing.Literal["shapes"]) -> typing.Union[MetaOapg.properties.shapes, schemas.Unset]: ... - def __getitem__(self, name: str) -> 'Fruit': + @typing.overload + def __getitem__(self, name: str) -> 'Fruit': ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["mainShape"], typing.Literal["shapeOrNull"], typing.Literal["nullableShape"], typing.Literal["shapes"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py index c55554a4dc0..b0245d74fd5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py @@ -104,18 +104,26 @@ class EnumArrays( } additional_properties = schemas.AnyTypeSchema - just_symbol: MetaOapg.properties.just_symbol - array_enum: MetaOapg.properties.array_enum + just_symbol: typing.Union[MetaOapg.properties.just_symbol, schemas.Unset] + array_enum: typing.Union[MetaOapg.properties.array_enum, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["just_symbol"]) -> MetaOapg.properties.just_symbol: ... + def __getitem__(self, name: typing.Literal["just_symbol"]) -> typing.Union[MetaOapg.properties.just_symbol, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_enum"]) -> MetaOapg.properties.array_enum: ... + def __getitem__(self, name: typing.Literal["array_enum"]) -> typing.Union[MetaOapg.properties.array_enum, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["just_symbol"], typing.Literal["array_enum"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi index c55554a4dc0..b0245d74fd5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.pyi @@ -104,18 +104,26 @@ class EnumArrays( } additional_properties = schemas.AnyTypeSchema - just_symbol: MetaOapg.properties.just_symbol - array_enum: MetaOapg.properties.array_enum + just_symbol: typing.Union[MetaOapg.properties.just_symbol, schemas.Unset] + array_enum: typing.Union[MetaOapg.properties.array_enum, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["just_symbol"]) -> MetaOapg.properties.just_symbol: ... + def __getitem__(self, name: typing.Literal["just_symbol"]) -> typing.Union[MetaOapg.properties.just_symbol, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_enum"]) -> MetaOapg.properties.array_enum: ... + def __getitem__(self, name: typing.Literal["array_enum"]) -> typing.Union[MetaOapg.properties.array_enum, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["just_symbol"], typing.Literal["array_enum"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py index 23a5b6c4596..ed6f7c47629 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -172,45 +172,53 @@ class EnumTest( additional_properties = schemas.AnyTypeSchema enum_string_required: MetaOapg.properties.enum_string_required - enum_string: MetaOapg.properties.enum_string - enum_integer: MetaOapg.properties.enum_integer - enum_number: MetaOapg.properties.enum_number - stringEnum: 'StringEnum' - IntegerEnum: 'IntegerEnum' - StringEnumWithDefaultValue: 'StringEnumWithDefaultValue' - IntegerEnumWithDefaultValue: 'IntegerEnumWithDefaultValue' - IntegerEnumOneValue: 'IntegerEnumOneValue' + enum_string: typing.Union[MetaOapg.properties.enum_string, schemas.Unset] + enum_integer: typing.Union[MetaOapg.properties.enum_integer, schemas.Unset] + enum_number: typing.Union[MetaOapg.properties.enum_number, schemas.Unset] + stringEnum: typing.Union['StringEnum', schemas.Unset] + IntegerEnum: typing.Union['IntegerEnum', schemas.Unset] + StringEnumWithDefaultValue: typing.Union['StringEnumWithDefaultValue', schemas.Unset] + IntegerEnumWithDefaultValue: typing.Union['IntegerEnumWithDefaultValue', schemas.Unset] + IntegerEnumOneValue: typing.Union['IntegerEnumOneValue', schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["enum_string_required"]) -> MetaOapg.properties.enum_string_required: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_string"]) -> MetaOapg.properties.enum_string: ... + def __getitem__(self, name: typing.Literal["enum_string"]) -> typing.Union[MetaOapg.properties.enum_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_integer"]) -> MetaOapg.properties.enum_integer: ... + def __getitem__(self, name: typing.Literal["enum_integer"]) -> typing.Union[MetaOapg.properties.enum_integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_number"]) -> MetaOapg.properties.enum_number: ... + def __getitem__(self, name: typing.Literal["enum_number"]) -> typing.Union[MetaOapg.properties.enum_number, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["stringEnum"]) -> 'StringEnum': ... + def __getitem__(self, name: typing.Literal["stringEnum"]) -> typing.Union['StringEnum', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnum"]) -> 'IntegerEnum': ... + def __getitem__(self, name: typing.Literal["IntegerEnum"]) -> typing.Union['IntegerEnum', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["StringEnumWithDefaultValue"]) -> 'StringEnumWithDefaultValue': ... + def __getitem__(self, name: typing.Literal["StringEnumWithDefaultValue"]) -> typing.Union['StringEnumWithDefaultValue', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnumWithDefaultValue"]) -> 'IntegerEnumWithDefaultValue': ... + def __getitem__(self, name: typing.Literal["IntegerEnumWithDefaultValue"]) -> typing.Union['IntegerEnumWithDefaultValue', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnumOneValue"]) -> 'IntegerEnumOneValue': ... + def __getitem__(self, name: typing.Literal["IntegerEnumOneValue"]) -> typing.Union['IntegerEnumOneValue', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["enum_string_required"], typing.Literal["enum_string"], typing.Literal["enum_integer"], typing.Literal["enum_number"], typing.Literal["stringEnum"], typing.Literal["IntegerEnum"], typing.Literal["StringEnumWithDefaultValue"], typing.Literal["IntegerEnumWithDefaultValue"], typing.Literal["IntegerEnumOneValue"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi index 23a5b6c4596..ed6f7c47629 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.pyi @@ -172,45 +172,53 @@ class EnumTest( additional_properties = schemas.AnyTypeSchema enum_string_required: MetaOapg.properties.enum_string_required - enum_string: MetaOapg.properties.enum_string - enum_integer: MetaOapg.properties.enum_integer - enum_number: MetaOapg.properties.enum_number - stringEnum: 'StringEnum' - IntegerEnum: 'IntegerEnum' - StringEnumWithDefaultValue: 'StringEnumWithDefaultValue' - IntegerEnumWithDefaultValue: 'IntegerEnumWithDefaultValue' - IntegerEnumOneValue: 'IntegerEnumOneValue' + enum_string: typing.Union[MetaOapg.properties.enum_string, schemas.Unset] + enum_integer: typing.Union[MetaOapg.properties.enum_integer, schemas.Unset] + enum_number: typing.Union[MetaOapg.properties.enum_number, schemas.Unset] + stringEnum: typing.Union['StringEnum', schemas.Unset] + IntegerEnum: typing.Union['IntegerEnum', schemas.Unset] + StringEnumWithDefaultValue: typing.Union['StringEnumWithDefaultValue', schemas.Unset] + IntegerEnumWithDefaultValue: typing.Union['IntegerEnumWithDefaultValue', schemas.Unset] + IntegerEnumOneValue: typing.Union['IntegerEnumOneValue', schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["enum_string_required"]) -> MetaOapg.properties.enum_string_required: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_string"]) -> MetaOapg.properties.enum_string: ... + def __getitem__(self, name: typing.Literal["enum_string"]) -> typing.Union[MetaOapg.properties.enum_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_integer"]) -> MetaOapg.properties.enum_integer: ... + def __getitem__(self, name: typing.Literal["enum_integer"]) -> typing.Union[MetaOapg.properties.enum_integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_number"]) -> MetaOapg.properties.enum_number: ... + def __getitem__(self, name: typing.Literal["enum_number"]) -> typing.Union[MetaOapg.properties.enum_number, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["stringEnum"]) -> 'StringEnum': ... + def __getitem__(self, name: typing.Literal["stringEnum"]) -> typing.Union['StringEnum', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnum"]) -> 'IntegerEnum': ... + def __getitem__(self, name: typing.Literal["IntegerEnum"]) -> typing.Union['IntegerEnum', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["StringEnumWithDefaultValue"]) -> 'StringEnumWithDefaultValue': ... + def __getitem__(self, name: typing.Literal["StringEnumWithDefaultValue"]) -> typing.Union['StringEnumWithDefaultValue', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnumWithDefaultValue"]) -> 'IntegerEnumWithDefaultValue': ... + def __getitem__(self, name: typing.Literal["IntegerEnumWithDefaultValue"]) -> typing.Union['IntegerEnumWithDefaultValue', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["IntegerEnumOneValue"]) -> 'IntegerEnumOneValue': ... + def __getitem__(self, name: typing.Literal["IntegerEnumOneValue"]) -> typing.Union['IntegerEnumOneValue', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["enum_string_required"], typing.Literal["enum_string"], typing.Literal["enum_integer"], typing.Literal["enum_number"], typing.Literal["stringEnum"], typing.Literal["IntegerEnum"], typing.Literal["StringEnumWithDefaultValue"], typing.Literal["IntegerEnumWithDefaultValue"], typing.Literal["IntegerEnumOneValue"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py index c5d59066a9a..39800bf5139 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py @@ -63,14 +63,22 @@ class EquilateralTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class EquilateralTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi index c5d59066a9a..39800bf5139 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.pyi @@ -63,14 +63,22 @@ class EquilateralTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class EquilateralTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py index d9963887e13..7fdfaf2a996 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py @@ -42,14 +42,22 @@ class File( } additional_properties = schemas.AnyTypeSchema - sourceURI: MetaOapg.properties.sourceURI + sourceURI: typing.Union[MetaOapg.properties.sourceURI, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["sourceURI"]) -> MetaOapg.properties.sourceURI: ... + def __getitem__(self, name: typing.Literal["sourceURI"]) -> typing.Union[MetaOapg.properties.sourceURI, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["sourceURI"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi index d9963887e13..7fdfaf2a996 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.pyi @@ -42,14 +42,22 @@ class File( } additional_properties = schemas.AnyTypeSchema - sourceURI: MetaOapg.properties.sourceURI + sourceURI: typing.Union[MetaOapg.properties.sourceURI, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["sourceURI"]) -> MetaOapg.properties.sourceURI: ... + def __getitem__(self, name: typing.Literal["sourceURI"]) -> typing.Union[MetaOapg.properties.sourceURI, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["sourceURI"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 87220b13bd6..ccb889f0273 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -72,18 +72,26 @@ class FileSchemaTestClass( } additional_properties = schemas.AnyTypeSchema - file: 'File' - files: MetaOapg.properties.files + file: typing.Union['File', schemas.Unset] + files: typing.Union[MetaOapg.properties.files, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["file"]) -> 'File': ... + def __getitem__(self, name: typing.Literal["file"]) -> typing.Union['File', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["files"]) -> MetaOapg.properties.files: ... + def __getitem__(self, name: typing.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["file"], typing.Literal["files"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi index 87220b13bd6..ccb889f0273 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.pyi @@ -72,18 +72,26 @@ class FileSchemaTestClass( } additional_properties = schemas.AnyTypeSchema - file: 'File' - files: MetaOapg.properties.files + file: typing.Union['File', schemas.Unset] + files: typing.Union[MetaOapg.properties.files, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["file"]) -> 'File': ... + def __getitem__(self, name: typing.Literal["file"]) -> typing.Union['File', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["files"]) -> MetaOapg.properties.files: ... + def __getitem__(self, name: typing.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["file"], typing.Literal["files"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py index 094265067b1..2f17954a9a2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py @@ -40,14 +40,22 @@ class Foo( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi index 094265067b1..2f17954a9a2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.pyi @@ -40,14 +40,22 @@ class Foo( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py index a79bc8711d6..7d05539b2f0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py @@ -205,22 +205,22 @@ class FormatTest( number: MetaOapg.properties.number password: MetaOapg.properties.password byte: MetaOapg.properties.byte - integer: MetaOapg.properties.integer - int32: MetaOapg.properties.int32 - int32withValidations: MetaOapg.properties.int32withValidations - int64: MetaOapg.properties.int64 - float32: MetaOapg.properties.float32 - double: MetaOapg.properties.double - float64: MetaOapg.properties.float64 - arrayWithUniqueItems: MetaOapg.properties.arrayWithUniqueItems - string: MetaOapg.properties.string - binary: MetaOapg.properties.binary - dateTime: MetaOapg.properties.dateTime - uuid: MetaOapg.properties.uuid - uuidNoExample: MetaOapg.properties.uuidNoExample - pattern_with_digits: MetaOapg.properties.pattern_with_digits - pattern_with_digits_and_delimiter: MetaOapg.properties.pattern_with_digits_and_delimiter - noneProp: MetaOapg.properties.noneProp + integer: typing.Union[MetaOapg.properties.integer, schemas.Unset] + int32: typing.Union[MetaOapg.properties.int32, schemas.Unset] + int32withValidations: typing.Union[MetaOapg.properties.int32withValidations, schemas.Unset] + int64: typing.Union[MetaOapg.properties.int64, schemas.Unset] + float32: typing.Union[MetaOapg.properties.float32, schemas.Unset] + double: typing.Union[MetaOapg.properties.double, schemas.Unset] + float64: typing.Union[MetaOapg.properties.float64, schemas.Unset] + arrayWithUniqueItems: typing.Union[MetaOapg.properties.arrayWithUniqueItems, schemas.Unset] + string: typing.Union[MetaOapg.properties.string, schemas.Unset] + binary: typing.Union[MetaOapg.properties.binary, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + uuid: typing.Union[MetaOapg.properties.uuid, schemas.Unset] + uuidNoExample: typing.Union[MetaOapg.properties.uuidNoExample, schemas.Unset] + pattern_with_digits: typing.Union[MetaOapg.properties.pattern_with_digits, schemas.Unset] + pattern_with_digits_and_delimiter: typing.Union[MetaOapg.properties.pattern_with_digits_and_delimiter, schemas.Unset] + noneProp: typing.Union[MetaOapg.properties.noneProp, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["date"]) -> MetaOapg.properties.date: ... @@ -235,59 +235,67 @@ class FormatTest( def __getitem__(self, name: typing.Literal["byte"]) -> MetaOapg.properties.byte: ... @typing.overload - def __getitem__(self, name: typing.Literal["integer"]) -> MetaOapg.properties.integer: ... + def __getitem__(self, name: typing.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32"]) -> MetaOapg.properties.int32: ... + def __getitem__(self, name: typing.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32withValidations"]) -> MetaOapg.properties.int32withValidations: ... + def __getitem__(self, name: typing.Literal["int32withValidations"]) -> typing.Union[MetaOapg.properties.int32withValidations, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int64"]) -> MetaOapg.properties.int64: ... + def __getitem__(self, name: typing.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float"]) -> MetaOapg.properties._float: ... + def __getitem__(self, name: typing.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float32"]) -> MetaOapg.properties.float32: ... + def __getitem__(self, name: typing.Literal["float32"]) -> typing.Union[MetaOapg.properties.float32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["double"]) -> MetaOapg.properties.double: ... + def __getitem__(self, name: typing.Literal["double"]) -> typing.Union[MetaOapg.properties.double, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float64"]) -> MetaOapg.properties.float64: ... + def __getitem__(self, name: typing.Literal["float64"]) -> typing.Union[MetaOapg.properties.float64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["arrayWithUniqueItems"]) -> MetaOapg.properties.arrayWithUniqueItems: ... + def __getitem__(self, name: typing.Literal["arrayWithUniqueItems"]) -> typing.Union[MetaOapg.properties.arrayWithUniqueItems, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> MetaOapg.properties.string: ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["binary"]) -> MetaOapg.properties.binary: ... + def __getitem__(self, name: typing.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["uuid"]) -> MetaOapg.properties.uuid: ... + def __getitem__(self, name: typing.Literal["uuid"]) -> typing.Union[MetaOapg.properties.uuid, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["uuidNoExample"]) -> MetaOapg.properties.uuidNoExample: ... + def __getitem__(self, name: typing.Literal["uuidNoExample"]) -> typing.Union[MetaOapg.properties.uuidNoExample, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["pattern_with_digits"]) -> MetaOapg.properties.pattern_with_digits: ... + def __getitem__(self, name: typing.Literal["pattern_with_digits"]) -> typing.Union[MetaOapg.properties.pattern_with_digits, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["pattern_with_digits_and_delimiter"]) -> MetaOapg.properties.pattern_with_digits_and_delimiter: ... + def __getitem__(self, name: typing.Literal["pattern_with_digits_and_delimiter"]) -> typing.Union[MetaOapg.properties.pattern_with_digits_and_delimiter, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["noneProp"]) -> MetaOapg.properties.noneProp: ... + def __getitem__(self, name: typing.Literal["noneProp"]) -> typing.Union[MetaOapg.properties.noneProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["date"], typing.Literal["number"], typing.Literal["password"], typing.Literal["byte"], typing.Literal["integer"], typing.Literal["int32"], typing.Literal["int32withValidations"], typing.Literal["int64"], typing.Literal["float"], typing.Literal["float32"], typing.Literal["double"], typing.Literal["float64"], typing.Literal["arrayWithUniqueItems"], typing.Literal["string"], typing.Literal["binary"], typing.Literal["dateTime"], typing.Literal["uuid"], typing.Literal["uuidNoExample"], typing.Literal["pattern_with_digits"], typing.Literal["pattern_with_digits_and_delimiter"], typing.Literal["noneProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi index 197a3be9c47..f3436513011 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.pyi @@ -157,22 +157,22 @@ class FormatTest( number: MetaOapg.properties.number password: MetaOapg.properties.password byte: MetaOapg.properties.byte - integer: MetaOapg.properties.integer - int32: MetaOapg.properties.int32 - int32withValidations: MetaOapg.properties.int32withValidations - int64: MetaOapg.properties.int64 - float32: MetaOapg.properties.float32 - double: MetaOapg.properties.double - float64: MetaOapg.properties.float64 - arrayWithUniqueItems: MetaOapg.properties.arrayWithUniqueItems - string: MetaOapg.properties.string - binary: MetaOapg.properties.binary - dateTime: MetaOapg.properties.dateTime - uuid: MetaOapg.properties.uuid - uuidNoExample: MetaOapg.properties.uuidNoExample - pattern_with_digits: MetaOapg.properties.pattern_with_digits - pattern_with_digits_and_delimiter: MetaOapg.properties.pattern_with_digits_and_delimiter - noneProp: MetaOapg.properties.noneProp + integer: typing.Union[MetaOapg.properties.integer, schemas.Unset] + int32: typing.Union[MetaOapg.properties.int32, schemas.Unset] + int32withValidations: typing.Union[MetaOapg.properties.int32withValidations, schemas.Unset] + int64: typing.Union[MetaOapg.properties.int64, schemas.Unset] + float32: typing.Union[MetaOapg.properties.float32, schemas.Unset] + double: typing.Union[MetaOapg.properties.double, schemas.Unset] + float64: typing.Union[MetaOapg.properties.float64, schemas.Unset] + arrayWithUniqueItems: typing.Union[MetaOapg.properties.arrayWithUniqueItems, schemas.Unset] + string: typing.Union[MetaOapg.properties.string, schemas.Unset] + binary: typing.Union[MetaOapg.properties.binary, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + uuid: typing.Union[MetaOapg.properties.uuid, schemas.Unset] + uuidNoExample: typing.Union[MetaOapg.properties.uuidNoExample, schemas.Unset] + pattern_with_digits: typing.Union[MetaOapg.properties.pattern_with_digits, schemas.Unset] + pattern_with_digits_and_delimiter: typing.Union[MetaOapg.properties.pattern_with_digits_and_delimiter, schemas.Unset] + noneProp: typing.Union[MetaOapg.properties.noneProp, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["date"]) -> MetaOapg.properties.date: ... @@ -187,59 +187,67 @@ class FormatTest( def __getitem__(self, name: typing.Literal["byte"]) -> MetaOapg.properties.byte: ... @typing.overload - def __getitem__(self, name: typing.Literal["integer"]) -> MetaOapg.properties.integer: ... + def __getitem__(self, name: typing.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32"]) -> MetaOapg.properties.int32: ... + def __getitem__(self, name: typing.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32withValidations"]) -> MetaOapg.properties.int32withValidations: ... + def __getitem__(self, name: typing.Literal["int32withValidations"]) -> typing.Union[MetaOapg.properties.int32withValidations, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int64"]) -> MetaOapg.properties.int64: ... + def __getitem__(self, name: typing.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float"]) -> MetaOapg.properties._float: ... + def __getitem__(self, name: typing.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float32"]) -> MetaOapg.properties.float32: ... + def __getitem__(self, name: typing.Literal["float32"]) -> typing.Union[MetaOapg.properties.float32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["double"]) -> MetaOapg.properties.double: ... + def __getitem__(self, name: typing.Literal["double"]) -> typing.Union[MetaOapg.properties.double, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float64"]) -> MetaOapg.properties.float64: ... + def __getitem__(self, name: typing.Literal["float64"]) -> typing.Union[MetaOapg.properties.float64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["arrayWithUniqueItems"]) -> MetaOapg.properties.arrayWithUniqueItems: ... + def __getitem__(self, name: typing.Literal["arrayWithUniqueItems"]) -> typing.Union[MetaOapg.properties.arrayWithUniqueItems, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> MetaOapg.properties.string: ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["binary"]) -> MetaOapg.properties.binary: ... + def __getitem__(self, name: typing.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["uuid"]) -> MetaOapg.properties.uuid: ... + def __getitem__(self, name: typing.Literal["uuid"]) -> typing.Union[MetaOapg.properties.uuid, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["uuidNoExample"]) -> MetaOapg.properties.uuidNoExample: ... + def __getitem__(self, name: typing.Literal["uuidNoExample"]) -> typing.Union[MetaOapg.properties.uuidNoExample, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["pattern_with_digits"]) -> MetaOapg.properties.pattern_with_digits: ... + def __getitem__(self, name: typing.Literal["pattern_with_digits"]) -> typing.Union[MetaOapg.properties.pattern_with_digits, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["pattern_with_digits_and_delimiter"]) -> MetaOapg.properties.pattern_with_digits_and_delimiter: ... + def __getitem__(self, name: typing.Literal["pattern_with_digits_and_delimiter"]) -> typing.Union[MetaOapg.properties.pattern_with_digits_and_delimiter, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["noneProp"]) -> MetaOapg.properties.noneProp: ... + def __getitem__(self, name: typing.Literal["noneProp"]) -> typing.Union[MetaOapg.properties.noneProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["date"], typing.Literal["number"], typing.Literal["password"], typing.Literal["byte"], typing.Literal["integer"], typing.Literal["int32"], typing.Literal["int32withValidations"], typing.Literal["int64"], typing.Literal["float"], typing.Literal["float32"], typing.Literal["double"], typing.Literal["float64"], typing.Literal["arrayWithUniqueItems"], typing.Literal["string"], typing.Literal["binary"], typing.Literal["dateTime"], typing.Literal["uuid"], typing.Literal["uuidNoExample"], typing.Literal["pattern_with_digits"], typing.Literal["pattern_with_digits_and_delimiter"], typing.Literal["noneProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py index 6c320e9ed79..3051e79d67b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py @@ -57,14 +57,22 @@ class Fruit( ] - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi index 6c320e9ed79..3051e79d67b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.pyi @@ -57,14 +57,22 @@ class Fruit( ] - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py index 6688933656c..ea35a354df7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py @@ -54,9 +54,14 @@ class FruitReq( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.pyi index 6688933656c..ea35a354df7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.pyi @@ -54,9 +54,14 @@ class FruitReq( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py index d945d2b5530..ae974b9a622 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py @@ -57,14 +57,22 @@ class GmFruit( ] - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi index d945d2b5530..ae974b9a622 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.pyi @@ -57,14 +57,22 @@ class GmFruit( ] - color: MetaOapg.properties.color + color: typing.Union[MetaOapg.properties.color, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["color"]) -> MetaOapg.properties.color: ... + def __getitem__(self, name: typing.Literal["color"]) -> typing.Union[MetaOapg.properties.color, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["color"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index 793bcc537d8..8e9703fb794 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -58,9 +58,17 @@ class GrandparentAnimal( @typing.overload def __getitem__(self, name: typing.Literal["pet_type"]) -> MetaOapg.properties.pet_type: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["pet_type"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi index 793bcc537d8..8e9703fb794 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.pyi @@ -58,9 +58,17 @@ class GrandparentAnimal( @typing.overload def __getitem__(self, name: typing.Literal["pet_type"]) -> MetaOapg.properties.pet_type: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["pet_type"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py index ddc6ac0e270..cd7996affea 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py @@ -42,18 +42,26 @@ class HasOnlyReadOnly( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar - foo: MetaOapg.properties.foo + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi index ddc6ac0e270..cd7996affea 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.pyi @@ -42,18 +42,26 @@ class HasOnlyReadOnly( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar - foo: MetaOapg.properties.foo + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] + foo: typing.Union[MetaOapg.properties.foo, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["foo"]) -> MetaOapg.properties.foo: ... + def __getitem__(self, name: typing.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["foo"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py index a642f08fee1..fce365ed526 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py @@ -61,14 +61,22 @@ class HealthCheckResult( } additional_properties = schemas.AnyTypeSchema - NullableMessage: MetaOapg.properties.NullableMessage + NullableMessage: typing.Union[MetaOapg.properties.NullableMessage, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["NullableMessage"]) -> MetaOapg.properties.NullableMessage: ... + def __getitem__(self, name: typing.Literal["NullableMessage"]) -> typing.Union[MetaOapg.properties.NullableMessage, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["NullableMessage"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi index a642f08fee1..fce365ed526 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.pyi @@ -61,14 +61,22 @@ class HealthCheckResult( } additional_properties = schemas.AnyTypeSchema - NullableMessage: MetaOapg.properties.NullableMessage + NullableMessage: typing.Union[MetaOapg.properties.NullableMessage, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["NullableMessage"]) -> MetaOapg.properties.NullableMessage: ... + def __getitem__(self, name: typing.Literal["NullableMessage"]) -> typing.Union[MetaOapg.properties.NullableMessage, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["NullableMessage"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py index 7539343a3b2..c7804f8873b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py @@ -63,14 +63,22 @@ class IsoscelesTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class IsoscelesTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi index 7539343a3b2..c7804f8873b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.pyi @@ -63,14 +63,22 @@ class IsoscelesTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class IsoscelesTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py index d82ed0f336a..7eac2aedb61 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py @@ -64,9 +64,14 @@ class Mammal( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.pyi index d82ed0f336a..7eac2aedb61 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.pyi @@ -64,9 +64,14 @@ class Mammal( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py index c15274fe1a7..762f20830f3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -52,9 +52,14 @@ class MapTest( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -69,9 +74,14 @@ class MapTest( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -115,9 +125,14 @@ class MapTest( def LOWER(cls): return cls("lower") - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -141,9 +156,14 @@ class MapTest( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -170,26 +190,34 @@ class MapTest( } additional_properties = schemas.AnyTypeSchema - map_map_of_string: MetaOapg.properties.map_map_of_string - map_of_enum_string: MetaOapg.properties.map_of_enum_string - direct_map: MetaOapg.properties.direct_map - indirect_map: 'StringBooleanMap' + map_map_of_string: typing.Union[MetaOapg.properties.map_map_of_string, schemas.Unset] + map_of_enum_string: typing.Union[MetaOapg.properties.map_of_enum_string, schemas.Unset] + direct_map: typing.Union[MetaOapg.properties.direct_map, schemas.Unset] + indirect_map: typing.Union['StringBooleanMap', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["map_map_of_string"]) -> MetaOapg.properties.map_map_of_string: ... + def __getitem__(self, name: typing.Literal["map_map_of_string"]) -> typing.Union[MetaOapg.properties.map_map_of_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_of_enum_string"]) -> MetaOapg.properties.map_of_enum_string: ... + def __getitem__(self, name: typing.Literal["map_of_enum_string"]) -> typing.Union[MetaOapg.properties.map_of_enum_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["direct_map"]) -> MetaOapg.properties.direct_map: ... + def __getitem__(self, name: typing.Literal["direct_map"]) -> typing.Union[MetaOapg.properties.direct_map, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["indirect_map"]) -> 'StringBooleanMap': ... + def __getitem__(self, name: typing.Literal["indirect_map"]) -> typing.Union['StringBooleanMap', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["map_map_of_string"], typing.Literal["map_of_enum_string"], typing.Literal["direct_map"], typing.Literal["indirect_map"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi index c15274fe1a7..762f20830f3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.pyi @@ -52,9 +52,14 @@ class MapTest( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -69,9 +74,14 @@ class MapTest( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -115,9 +125,14 @@ class MapTest( def LOWER(cls): return cls("lower") - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -141,9 +156,14 @@ class MapTest( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -170,26 +190,34 @@ class MapTest( } additional_properties = schemas.AnyTypeSchema - map_map_of_string: MetaOapg.properties.map_map_of_string - map_of_enum_string: MetaOapg.properties.map_of_enum_string - direct_map: MetaOapg.properties.direct_map - indirect_map: 'StringBooleanMap' + map_map_of_string: typing.Union[MetaOapg.properties.map_map_of_string, schemas.Unset] + map_of_enum_string: typing.Union[MetaOapg.properties.map_of_enum_string, schemas.Unset] + direct_map: typing.Union[MetaOapg.properties.direct_map, schemas.Unset] + indirect_map: typing.Union['StringBooleanMap', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["map_map_of_string"]) -> MetaOapg.properties.map_map_of_string: ... + def __getitem__(self, name: typing.Literal["map_map_of_string"]) -> typing.Union[MetaOapg.properties.map_map_of_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map_of_enum_string"]) -> MetaOapg.properties.map_of_enum_string: ... + def __getitem__(self, name: typing.Literal["map_of_enum_string"]) -> typing.Union[MetaOapg.properties.map_of_enum_string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["direct_map"]) -> MetaOapg.properties.direct_map: ... + def __getitem__(self, name: typing.Literal["direct_map"]) -> typing.Union[MetaOapg.properties.direct_map, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["indirect_map"]) -> 'StringBooleanMap': ... + def __getitem__(self, name: typing.Literal["indirect_map"]) -> typing.Union['StringBooleanMap', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["map_map_of_string"], typing.Literal["map_of_enum_string"], typing.Literal["direct_map"], typing.Literal["indirect_map"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index b07186ea010..a86119f3f4d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -50,9 +50,14 @@ class MixedPropertiesAndAdditionalPropertiesClass( def additional_properties(cls) -> typing.Type['Animal']: return Animal - def __getitem__(self, name: str) -> 'Animal': + def __getitem__(self, name: typing.Union[str, ]) -> 'Animal': # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -73,22 +78,30 @@ class MixedPropertiesAndAdditionalPropertiesClass( } additional_properties = schemas.AnyTypeSchema - uuid: MetaOapg.properties.uuid - dateTime: MetaOapg.properties.dateTime - map: MetaOapg.properties.map + uuid: typing.Union[MetaOapg.properties.uuid, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + map: typing.Union[MetaOapg.properties.map, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["uuid"]) -> MetaOapg.properties.uuid: ... + def __getitem__(self, name: typing.Literal["uuid"]) -> typing.Union[MetaOapg.properties.uuid, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map"]) -> MetaOapg.properties.map: ... + def __getitem__(self, name: typing.Literal["map"]) -> typing.Union[MetaOapg.properties.map, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["uuid"], typing.Literal["dateTime"], typing.Literal["map"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi index b07186ea010..a86119f3f4d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.pyi @@ -50,9 +50,14 @@ class MixedPropertiesAndAdditionalPropertiesClass( def additional_properties(cls) -> typing.Type['Animal']: return Animal - def __getitem__(self, name: str) -> 'Animal': + def __getitem__(self, name: typing.Union[str, ]) -> 'Animal': # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -73,22 +78,30 @@ class MixedPropertiesAndAdditionalPropertiesClass( } additional_properties = schemas.AnyTypeSchema - uuid: MetaOapg.properties.uuid - dateTime: MetaOapg.properties.dateTime - map: MetaOapg.properties.map + uuid: typing.Union[MetaOapg.properties.uuid, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + map: typing.Union[MetaOapg.properties.map, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["uuid"]) -> MetaOapg.properties.uuid: ... + def __getitem__(self, name: typing.Literal["uuid"]) -> typing.Union[MetaOapg.properties.uuid, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["map"]) -> MetaOapg.properties.map: ... + def __getitem__(self, name: typing.Literal["map"]) -> typing.Union[MetaOapg.properties.map, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["uuid"], typing.Literal["dateTime"], typing.Literal["map"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py index 23f92295ea2..98a76ed28ad 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py @@ -45,17 +45,25 @@ class Model200Response( additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["class"]) -> MetaOapg.properties._class: ... + def __getitem__(self, name: typing.Literal["class"]) -> typing.Union[MetaOapg.properties._class, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["class"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi index 23f92295ea2..98a76ed28ad 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.pyi @@ -45,17 +45,25 @@ class Model200Response( additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["class"]) -> MetaOapg.properties._class: ... + def __getitem__(self, name: typing.Literal["class"]) -> typing.Union[MetaOapg.properties._class, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["class"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py index 1c7c20083b3..39615a986f0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py @@ -45,11 +45,19 @@ class ModelReturn( @typing.overload - def __getitem__(self, name: typing.Literal["return"]) -> MetaOapg.properties._return: ... + def __getitem__(self, name: typing.Literal["return"]) -> typing.Union[MetaOapg.properties._return, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["return"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi index 1c7c20083b3..39615a986f0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.pyi @@ -45,11 +45,19 @@ class ModelReturn( @typing.overload - def __getitem__(self, name: typing.Literal["return"]) -> MetaOapg.properties._return: ... + def __getitem__(self, name: typing.Literal["return"]) -> typing.Union[MetaOapg.properties._return, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["return"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py index 698c10e26bd..9342d2d228b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.py @@ -59,9 +59,17 @@ class Money( @typing.overload def __getitem__(self, name: typing.Literal["currency"]) -> 'Currency': ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["amount"], typing.Literal["currency"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi index 698c10e26bd..9342d2d228b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/money.pyi @@ -59,9 +59,17 @@ class Money( @typing.overload def __getitem__(self, name: typing.Literal["currency"]) -> 'Currency': ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["amount"], typing.Literal["currency"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py index 174b17ace82..0019eb5c6bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py @@ -51,20 +51,28 @@ class Name( name: MetaOapg.properties.name - snake_case: MetaOapg.properties.snake_case + snake_case: typing.Union[MetaOapg.properties.snake_case, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["snake_case"]) -> MetaOapg.properties.snake_case: ... + def __getitem__(self, name: typing.Literal["snake_case"]) -> typing.Union[MetaOapg.properties.snake_case, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["property"]) -> MetaOapg.properties._property: ... + def __getitem__(self, name: typing.Literal["property"]) -> typing.Union[MetaOapg.properties._property, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["snake_case"], typing.Literal["property"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi index 174b17ace82..0019eb5c6bc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.pyi @@ -51,20 +51,28 @@ class Name( name: MetaOapg.properties.name - snake_case: MetaOapg.properties.snake_case + snake_case: typing.Union[MetaOapg.properties.snake_case, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["snake_case"]) -> MetaOapg.properties.snake_case: ... + def __getitem__(self, name: typing.Literal["snake_case"]) -> typing.Union[MetaOapg.properties.snake_case, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["property"]) -> MetaOapg.properties._property: ... + def __getitem__(self, name: typing.Literal["property"]) -> typing.Union[MetaOapg.properties._property, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["snake_case"], typing.Literal["property"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py index 5bf3c5d41a1..3c6ddcc5c12 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.py @@ -46,14 +46,22 @@ class NoAdditionalProperties( additional_properties = None id: MetaOapg.properties.id - petId: MetaOapg.properties.petId + petId: typing.Union[MetaOapg.properties.petId, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... - def __getitem__(self, name: typing.Literal["petId"]) -> MetaOapg.properties.petId: + @typing.overload + def __getitem__(self, name: typing.Literal["petId"]) -> typing.Union[MetaOapg.properties.petId, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["id", "petId", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi index 5bf3c5d41a1..3c6ddcc5c12 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/no_additional_properties.pyi @@ -46,14 +46,22 @@ class NoAdditionalProperties( additional_properties = None id: MetaOapg.properties.id - petId: MetaOapg.properties.petId + petId: typing.Union[MetaOapg.properties.petId, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... - def __getitem__(self, name: typing.Literal["petId"]) -> MetaOapg.properties.petId: + @typing.overload + def __getitem__(self, name: typing.Literal["petId"]) -> typing.Union[MetaOapg.properties.petId, schemas.Unset]: ... + + def __getitem__(self, name: typing.Literal["id", "petId", ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py index 5d62571966d..e68f292ad1d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py @@ -203,9 +203,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -253,9 +258,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -297,9 +307,14 @@ class NullableClass( additional_properties = schemas.DictSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -338,9 +353,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -356,9 +376,14 @@ class NullableClass( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -394,9 +419,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -411,9 +441,14 @@ class NullableClass( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -455,9 +490,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -472,58 +512,66 @@ class NullableClass( **kwargs, ) - integer_prop: MetaOapg.properties.integer_prop - number_prop: MetaOapg.properties.number_prop - boolean_prop: MetaOapg.properties.boolean_prop - string_prop: MetaOapg.properties.string_prop - date_prop: MetaOapg.properties.date_prop - datetime_prop: MetaOapg.properties.datetime_prop - array_nullable_prop: MetaOapg.properties.array_nullable_prop - array_and_items_nullable_prop: MetaOapg.properties.array_and_items_nullable_prop - array_items_nullable: MetaOapg.properties.array_items_nullable - object_nullable_prop: MetaOapg.properties.object_nullable_prop - object_and_items_nullable_prop: MetaOapg.properties.object_and_items_nullable_prop - object_items_nullable: MetaOapg.properties.object_items_nullable + integer_prop: typing.Union[MetaOapg.properties.integer_prop, schemas.Unset] + number_prop: typing.Union[MetaOapg.properties.number_prop, schemas.Unset] + boolean_prop: typing.Union[MetaOapg.properties.boolean_prop, schemas.Unset] + string_prop: typing.Union[MetaOapg.properties.string_prop, schemas.Unset] + date_prop: typing.Union[MetaOapg.properties.date_prop, schemas.Unset] + datetime_prop: typing.Union[MetaOapg.properties.datetime_prop, schemas.Unset] + array_nullable_prop: typing.Union[MetaOapg.properties.array_nullable_prop, schemas.Unset] + array_and_items_nullable_prop: typing.Union[MetaOapg.properties.array_and_items_nullable_prop, schemas.Unset] + array_items_nullable: typing.Union[MetaOapg.properties.array_items_nullable, schemas.Unset] + object_nullable_prop: typing.Union[MetaOapg.properties.object_nullable_prop, schemas.Unset] + object_and_items_nullable_prop: typing.Union[MetaOapg.properties.object_and_items_nullable_prop, schemas.Unset] + object_items_nullable: typing.Union[MetaOapg.properties.object_items_nullable, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["integer_prop"]) -> MetaOapg.properties.integer_prop: ... + def __getitem__(self, name: typing.Literal["integer_prop"]) -> typing.Union[MetaOapg.properties.integer_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["number_prop"]) -> MetaOapg.properties.number_prop: ... + def __getitem__(self, name: typing.Literal["number_prop"]) -> typing.Union[MetaOapg.properties.number_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["boolean_prop"]) -> MetaOapg.properties.boolean_prop: ... + def __getitem__(self, name: typing.Literal["boolean_prop"]) -> typing.Union[MetaOapg.properties.boolean_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string_prop"]) -> MetaOapg.properties.string_prop: ... + def __getitem__(self, name: typing.Literal["string_prop"]) -> typing.Union[MetaOapg.properties.string_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["date_prop"]) -> MetaOapg.properties.date_prop: ... + def __getitem__(self, name: typing.Literal["date_prop"]) -> typing.Union[MetaOapg.properties.date_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["datetime_prop"]) -> MetaOapg.properties.datetime_prop: ... + def __getitem__(self, name: typing.Literal["datetime_prop"]) -> typing.Union[MetaOapg.properties.datetime_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_nullable_prop"]) -> MetaOapg.properties.array_nullable_prop: ... + def __getitem__(self, name: typing.Literal["array_nullable_prop"]) -> typing.Union[MetaOapg.properties.array_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_and_items_nullable_prop"]) -> MetaOapg.properties.array_and_items_nullable_prop: ... + def __getitem__(self, name: typing.Literal["array_and_items_nullable_prop"]) -> typing.Union[MetaOapg.properties.array_and_items_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_items_nullable"]) -> MetaOapg.properties.array_items_nullable: ... + def __getitem__(self, name: typing.Literal["array_items_nullable"]) -> typing.Union[MetaOapg.properties.array_items_nullable, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_nullable_prop"]) -> MetaOapg.properties.object_nullable_prop: ... + def __getitem__(self, name: typing.Literal["object_nullable_prop"]) -> typing.Union[MetaOapg.properties.object_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_and_items_nullable_prop"]) -> MetaOapg.properties.object_and_items_nullable_prop: ... + def __getitem__(self, name: typing.Literal["object_and_items_nullable_prop"]) -> typing.Union[MetaOapg.properties.object_and_items_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_items_nullable"]) -> MetaOapg.properties.object_items_nullable: ... + def __getitem__(self, name: typing.Literal["object_items_nullable"]) -> typing.Union[MetaOapg.properties.object_items_nullable, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["integer_prop"], typing.Literal["number_prop"], typing.Literal["boolean_prop"], typing.Literal["string_prop"], typing.Literal["date_prop"], typing.Literal["datetime_prop"], typing.Literal["array_nullable_prop"], typing.Literal["array_and_items_nullable_prop"], typing.Literal["array_items_nullable"], typing.Literal["object_nullable_prop"], typing.Literal["object_and_items_nullable_prop"], typing.Literal["object_items_nullable"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi index 5d62571966d..e68f292ad1d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.pyi @@ -203,9 +203,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -253,9 +258,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -297,9 +307,14 @@ class NullableClass( additional_properties = schemas.DictSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -338,9 +353,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -356,9 +376,14 @@ class NullableClass( ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -394,9 +419,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -411,9 +441,14 @@ class NullableClass( **kwargs, ) - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -455,9 +490,14 @@ class NullableClass( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -472,58 +512,66 @@ class NullableClass( **kwargs, ) - integer_prop: MetaOapg.properties.integer_prop - number_prop: MetaOapg.properties.number_prop - boolean_prop: MetaOapg.properties.boolean_prop - string_prop: MetaOapg.properties.string_prop - date_prop: MetaOapg.properties.date_prop - datetime_prop: MetaOapg.properties.datetime_prop - array_nullable_prop: MetaOapg.properties.array_nullable_prop - array_and_items_nullable_prop: MetaOapg.properties.array_and_items_nullable_prop - array_items_nullable: MetaOapg.properties.array_items_nullable - object_nullable_prop: MetaOapg.properties.object_nullable_prop - object_and_items_nullable_prop: MetaOapg.properties.object_and_items_nullable_prop - object_items_nullable: MetaOapg.properties.object_items_nullable + integer_prop: typing.Union[MetaOapg.properties.integer_prop, schemas.Unset] + number_prop: typing.Union[MetaOapg.properties.number_prop, schemas.Unset] + boolean_prop: typing.Union[MetaOapg.properties.boolean_prop, schemas.Unset] + string_prop: typing.Union[MetaOapg.properties.string_prop, schemas.Unset] + date_prop: typing.Union[MetaOapg.properties.date_prop, schemas.Unset] + datetime_prop: typing.Union[MetaOapg.properties.datetime_prop, schemas.Unset] + array_nullable_prop: typing.Union[MetaOapg.properties.array_nullable_prop, schemas.Unset] + array_and_items_nullable_prop: typing.Union[MetaOapg.properties.array_and_items_nullable_prop, schemas.Unset] + array_items_nullable: typing.Union[MetaOapg.properties.array_items_nullable, schemas.Unset] + object_nullable_prop: typing.Union[MetaOapg.properties.object_nullable_prop, schemas.Unset] + object_and_items_nullable_prop: typing.Union[MetaOapg.properties.object_and_items_nullable_prop, schemas.Unset] + object_items_nullable: typing.Union[MetaOapg.properties.object_items_nullable, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["integer_prop"]) -> MetaOapg.properties.integer_prop: ... + def __getitem__(self, name: typing.Literal["integer_prop"]) -> typing.Union[MetaOapg.properties.integer_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["number_prop"]) -> MetaOapg.properties.number_prop: ... + def __getitem__(self, name: typing.Literal["number_prop"]) -> typing.Union[MetaOapg.properties.number_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["boolean_prop"]) -> MetaOapg.properties.boolean_prop: ... + def __getitem__(self, name: typing.Literal["boolean_prop"]) -> typing.Union[MetaOapg.properties.boolean_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string_prop"]) -> MetaOapg.properties.string_prop: ... + def __getitem__(self, name: typing.Literal["string_prop"]) -> typing.Union[MetaOapg.properties.string_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["date_prop"]) -> MetaOapg.properties.date_prop: ... + def __getitem__(self, name: typing.Literal["date_prop"]) -> typing.Union[MetaOapg.properties.date_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["datetime_prop"]) -> MetaOapg.properties.datetime_prop: ... + def __getitem__(self, name: typing.Literal["datetime_prop"]) -> typing.Union[MetaOapg.properties.datetime_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_nullable_prop"]) -> MetaOapg.properties.array_nullable_prop: ... + def __getitem__(self, name: typing.Literal["array_nullable_prop"]) -> typing.Union[MetaOapg.properties.array_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_and_items_nullable_prop"]) -> MetaOapg.properties.array_and_items_nullable_prop: ... + def __getitem__(self, name: typing.Literal["array_and_items_nullable_prop"]) -> typing.Union[MetaOapg.properties.array_and_items_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["array_items_nullable"]) -> MetaOapg.properties.array_items_nullable: ... + def __getitem__(self, name: typing.Literal["array_items_nullable"]) -> typing.Union[MetaOapg.properties.array_items_nullable, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_nullable_prop"]) -> MetaOapg.properties.object_nullable_prop: ... + def __getitem__(self, name: typing.Literal["object_nullable_prop"]) -> typing.Union[MetaOapg.properties.object_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_and_items_nullable_prop"]) -> MetaOapg.properties.object_and_items_nullable_prop: ... + def __getitem__(self, name: typing.Literal["object_and_items_nullable_prop"]) -> typing.Union[MetaOapg.properties.object_and_items_nullable_prop, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["object_items_nullable"]) -> MetaOapg.properties.object_items_nullable: ... + def __getitem__(self, name: typing.Literal["object_items_nullable"]) -> typing.Union[MetaOapg.properties.object_items_nullable, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["integer_prop"], typing.Literal["number_prop"], typing.Literal["boolean_prop"], typing.Literal["string_prop"], typing.Literal["date_prop"], typing.Literal["datetime_prop"], typing.Literal["array_nullable_prop"], typing.Literal["array_and_items_nullable_prop"], typing.Literal["array_items_nullable"], typing.Literal["object_nullable_prop"], typing.Literal["object_and_items_nullable_prop"], typing.Literal["object_items_nullable"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py index e0bf0726e21..bd086bab768 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py @@ -56,9 +56,14 @@ class NullableShape( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.pyi index e0bf0726e21..bd086bab768 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.pyi @@ -56,9 +56,14 @@ class NullableShape( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py index 484e816275b..1778356d1c2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py @@ -40,14 +40,22 @@ class NumberOnly( } additional_properties = schemas.AnyTypeSchema - JustNumber: MetaOapg.properties.JustNumber + JustNumber: typing.Union[MetaOapg.properties.JustNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["JustNumber"]) -> MetaOapg.properties.JustNumber: ... + def __getitem__(self, name: typing.Literal["JustNumber"]) -> typing.Union[MetaOapg.properties.JustNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["JustNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi index 484e816275b..1778356d1c2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.pyi @@ -40,14 +40,22 @@ class NumberOnly( } additional_properties = schemas.AnyTypeSchema - JustNumber: MetaOapg.properties.JustNumber + JustNumber: typing.Union[MetaOapg.properties.JustNumber, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["JustNumber"]) -> MetaOapg.properties.JustNumber: ... + def __getitem__(self, name: typing.Literal["JustNumber"]) -> typing.Union[MetaOapg.properties.JustNumber, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["JustNumber"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py index 3fcfa144677..5768b35e1f8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.py @@ -50,22 +50,30 @@ class ObjectModelWithRefProps( } additional_properties = schemas.AnyTypeSchema - myNumber: 'NumberWithValidations' - myString: MetaOapg.properties.myString - myBoolean: MetaOapg.properties.myBoolean + myNumber: typing.Union['NumberWithValidations', schemas.Unset] + myString: typing.Union[MetaOapg.properties.myString, schemas.Unset] + myBoolean: typing.Union[MetaOapg.properties.myBoolean, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["myNumber"]) -> 'NumberWithValidations': ... + def __getitem__(self, name: typing.Literal["myNumber"]) -> typing.Union['NumberWithValidations', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["myString"]) -> MetaOapg.properties.myString: ... + def __getitem__(self, name: typing.Literal["myString"]) -> typing.Union[MetaOapg.properties.myString, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["myBoolean"]) -> MetaOapg.properties.myBoolean: ... + def __getitem__(self, name: typing.Literal["myBoolean"]) -> typing.Union[MetaOapg.properties.myBoolean, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["myNumber"], typing.Literal["myString"], typing.Literal["myBoolean"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi index 3fcfa144677..5768b35e1f8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_model_with_ref_props.pyi @@ -50,22 +50,30 @@ class ObjectModelWithRefProps( } additional_properties = schemas.AnyTypeSchema - myNumber: 'NumberWithValidations' - myString: MetaOapg.properties.myString - myBoolean: MetaOapg.properties.myBoolean + myNumber: typing.Union['NumberWithValidations', schemas.Unset] + myString: typing.Union[MetaOapg.properties.myString, schemas.Unset] + myBoolean: typing.Union[MetaOapg.properties.myBoolean, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["myNumber"]) -> 'NumberWithValidations': ... + def __getitem__(self, name: typing.Literal["myNumber"]) -> typing.Union['NumberWithValidations', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["myString"]) -> MetaOapg.properties.myString: ... + def __getitem__(self, name: typing.Literal["myString"]) -> typing.Union[MetaOapg.properties.myString, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["myBoolean"]) -> MetaOapg.properties.myBoolean: ... + def __getitem__(self, name: typing.Literal["myBoolean"]) -> typing.Union[MetaOapg.properties.myBoolean, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["myNumber"], typing.Literal["myString"], typing.Literal["myBoolean"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py index f52294761c0..ec116f74a27 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.py @@ -48,22 +48,30 @@ class ObjectWithDecimalProperties( } additional_properties = schemas.AnyTypeSchema - length: MetaOapg.properties.length - width: MetaOapg.properties.width - cost: 'Money' + length: typing.Union[MetaOapg.properties.length, schemas.Unset] + width: typing.Union[MetaOapg.properties.width, schemas.Unset] + cost: typing.Union['Money', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["length"]) -> MetaOapg.properties.length: ... + def __getitem__(self, name: typing.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["width"]) -> MetaOapg.properties.width: ... + def __getitem__(self, name: typing.Literal["width"]) -> typing.Union[MetaOapg.properties.width, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["cost"]) -> 'Money': ... + def __getitem__(self, name: typing.Literal["cost"]) -> typing.Union['Money', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["length"], typing.Literal["width"], typing.Literal["cost"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi index f52294761c0..ec116f74a27 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_decimal_properties.pyi @@ -48,22 +48,30 @@ class ObjectWithDecimalProperties( } additional_properties = schemas.AnyTypeSchema - length: MetaOapg.properties.length - width: MetaOapg.properties.width - cost: 'Money' + length: typing.Union[MetaOapg.properties.length, schemas.Unset] + width: typing.Union[MetaOapg.properties.width, schemas.Unset] + cost: typing.Union['Money', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["length"]) -> MetaOapg.properties.length: ... + def __getitem__(self, name: typing.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["width"]) -> MetaOapg.properties.width: ... + def __getitem__(self, name: typing.Literal["width"]) -> typing.Union[MetaOapg.properties.width, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["cost"]) -> 'Money': ... + def __getitem__(self, name: typing.Literal["cost"]) -> typing.Union['Money', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["length"], typing.Literal["width"], typing.Literal["cost"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py index d3f329418bb..1091c312c7a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.py @@ -54,14 +54,22 @@ class ObjectWithDifficultlyNamedProps( def __getitem__(self, name: typing.Literal["123-list"]) -> MetaOapg.properties._123_list: ... @typing.overload - def __getitem__(self, name: typing.Literal["$special[property.name]"]) -> MetaOapg.properties.special_property_name: ... + def __getitem__(self, name: typing.Literal["$special[property.name]"]) -> typing.Union[MetaOapg.properties.special_property_name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["123Number"]) -> MetaOapg.properties._123_number: ... + def __getitem__(self, name: typing.Literal["123Number"]) -> typing.Union[MetaOapg.properties._123_number, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["123-list"], typing.Literal["$special[property.name]"], typing.Literal["123Number"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi index d3f329418bb..1091c312c7a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_difficultly_named_props.pyi @@ -54,14 +54,22 @@ class ObjectWithDifficultlyNamedProps( def __getitem__(self, name: typing.Literal["123-list"]) -> MetaOapg.properties._123_list: ... @typing.overload - def __getitem__(self, name: typing.Literal["$special[property.name]"]) -> MetaOapg.properties.special_property_name: ... + def __getitem__(self, name: typing.Literal["$special[property.name]"]) -> typing.Union[MetaOapg.properties.special_property_name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["123Number"]) -> MetaOapg.properties._123_number: ... + def __getitem__(self, name: typing.Literal["123Number"]) -> typing.Union[MetaOapg.properties._123_number, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["123-list"], typing.Literal["$special[property.name]"], typing.Literal["123Number"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py index 7255a14e602..0f4030ff044 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.py @@ -69,9 +69,14 @@ class ObjectWithInlineCompositionProperty( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -90,14 +95,22 @@ class ObjectWithInlineCompositionProperty( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi index 3a9e9286429..eb75c0d6a1d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_inline_composition_property.pyi @@ -66,9 +66,14 @@ class ObjectWithInlineCompositionProperty( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -87,14 +92,22 @@ class ObjectWithInlineCompositionProperty( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.py index c817c91de4d..199456101f2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.py @@ -36,9 +36,14 @@ class ObjectWithValidations( additional_properties = schemas.AnyTypeSchema min_properties = 2 - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi index af0c6615376..4ba663fa260 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/object_with_validations.pyi @@ -35,9 +35,14 @@ class ObjectWithValidations( class MetaOapg: additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py index c68f395ca25..36e6ad10a77 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py @@ -76,34 +76,42 @@ class Order( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - petId: MetaOapg.properties.petId - quantity: MetaOapg.properties.quantity - shipDate: MetaOapg.properties.shipDate - status: MetaOapg.properties.status - complete: MetaOapg.properties.complete + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + petId: typing.Union[MetaOapg.properties.petId, schemas.Unset] + quantity: typing.Union[MetaOapg.properties.quantity, schemas.Unset] + shipDate: typing.Union[MetaOapg.properties.shipDate, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] + complete: typing.Union[MetaOapg.properties.complete, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["petId"]) -> MetaOapg.properties.petId: ... + def __getitem__(self, name: typing.Literal["petId"]) -> typing.Union[MetaOapg.properties.petId, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["quantity"]) -> MetaOapg.properties.quantity: ... + def __getitem__(self, name: typing.Literal["quantity"]) -> typing.Union[MetaOapg.properties.quantity, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shipDate"]) -> MetaOapg.properties.shipDate: ... + def __getitem__(self, name: typing.Literal["shipDate"]) -> typing.Union[MetaOapg.properties.shipDate, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["complete"]) -> MetaOapg.properties.complete: ... + def __getitem__(self, name: typing.Literal["complete"]) -> typing.Union[MetaOapg.properties.complete, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["petId"], typing.Literal["quantity"], typing.Literal["shipDate"], typing.Literal["status"], typing.Literal["complete"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi index c68f395ca25..36e6ad10a77 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.pyi @@ -76,34 +76,42 @@ class Order( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - petId: MetaOapg.properties.petId - quantity: MetaOapg.properties.quantity - shipDate: MetaOapg.properties.shipDate - status: MetaOapg.properties.status - complete: MetaOapg.properties.complete + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + petId: typing.Union[MetaOapg.properties.petId, schemas.Unset] + quantity: typing.Union[MetaOapg.properties.quantity, schemas.Unset] + shipDate: typing.Union[MetaOapg.properties.shipDate, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] + complete: typing.Union[MetaOapg.properties.complete, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["petId"]) -> MetaOapg.properties.petId: ... + def __getitem__(self, name: typing.Literal["petId"]) -> typing.Union[MetaOapg.properties.petId, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["quantity"]) -> MetaOapg.properties.quantity: ... + def __getitem__(self, name: typing.Literal["quantity"]) -> typing.Union[MetaOapg.properties.quantity, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["shipDate"]) -> MetaOapg.properties.shipDate: ... + def __getitem__(self, name: typing.Literal["shipDate"]) -> typing.Union[MetaOapg.properties.shipDate, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["complete"]) -> MetaOapg.properties.complete: ... + def __getitem__(self, name: typing.Literal["complete"]) -> typing.Union[MetaOapg.properties.complete, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["petId"], typing.Literal["quantity"], typing.Literal["shipDate"], typing.Literal["status"], typing.Literal["complete"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py index 1e35ba8ce9a..a5277f4b15d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py @@ -61,9 +61,14 @@ class ParentPet( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.pyi index 1e35ba8ce9a..a5277f4b15d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.pyi @@ -61,9 +61,14 @@ class ParentPet( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py index 94c9a22ddb5..d66c912285c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py @@ -136,10 +136,10 @@ class Pet( photoUrls: MetaOapg.properties.photoUrls name: MetaOapg.properties.name - id: MetaOapg.properties.id - category: 'Category' - tags: MetaOapg.properties.tags - status: MetaOapg.properties.status + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + category: typing.Union['Category', schemas.Unset] + tags: typing.Union[MetaOapg.properties.tags, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["photoUrls"]) -> MetaOapg.properties.photoUrls: ... @@ -148,20 +148,28 @@ class Pet( def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["category"]) -> 'Category': ... + def __getitem__(self, name: typing.Literal["category"]) -> typing.Union['Category', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["tags"]) -> MetaOapg.properties.tags: ... + def __getitem__(self, name: typing.Literal["tags"]) -> typing.Union[MetaOapg.properties.tags, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["photoUrls"], typing.Literal["name"], typing.Literal["id"], typing.Literal["category"], typing.Literal["tags"], typing.Literal["status"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi index 94c9a22ddb5..d66c912285c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.pyi @@ -136,10 +136,10 @@ class Pet( photoUrls: MetaOapg.properties.photoUrls name: MetaOapg.properties.name - id: MetaOapg.properties.id - category: 'Category' - tags: MetaOapg.properties.tags - status: MetaOapg.properties.status + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + category: typing.Union['Category', schemas.Unset] + tags: typing.Union[MetaOapg.properties.tags, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["photoUrls"]) -> MetaOapg.properties.photoUrls: ... @@ -148,20 +148,28 @@ class Pet( def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["category"]) -> 'Category': ... + def __getitem__(self, name: typing.Literal["category"]) -> typing.Union['Category', schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["tags"]) -> MetaOapg.properties.tags: ... + def __getitem__(self, name: typing.Literal["tags"]) -> typing.Union[MetaOapg.properties.tags, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["photoUrls"], typing.Literal["name"], typing.Literal["id"], typing.Literal["category"], typing.Literal["tags"], typing.Literal["status"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py index 1216de8434a..71a1ea5e0a5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py @@ -62,9 +62,14 @@ class Pig( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.pyi index 1216de8434a..71a1ea5e0a5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.pyi @@ -62,9 +62,14 @@ class Pig( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py index 67e6436fa60..2cf3dd3d5a3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.py @@ -48,18 +48,26 @@ class Player( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name - enemyPlayer: 'Player' + name: typing.Union[MetaOapg.properties.name, schemas.Unset] + enemyPlayer: typing.Union['Player', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enemyPlayer"]) -> 'Player': ... + def __getitem__(self, name: typing.Literal["enemyPlayer"]) -> typing.Union['Player', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["enemyPlayer"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi index 67e6436fa60..2cf3dd3d5a3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/player.pyi @@ -48,18 +48,26 @@ class Player( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name - enemyPlayer: 'Player' + name: typing.Union[MetaOapg.properties.name, schemas.Unset] + enemyPlayer: typing.Union['Player', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enemyPlayer"]) -> 'Player': ... + def __getitem__(self, name: typing.Literal["enemyPlayer"]) -> typing.Union['Player', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["enemyPlayer"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py index 036e3bca5dd..f40e3d33ede 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py @@ -62,9 +62,14 @@ class Quadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.pyi index 036e3bca5dd..f40e3d33ede 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.pyi @@ -62,9 +62,14 @@ class Quadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py index de0d8b1d940..095c8a4d9a7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py @@ -70,9 +70,17 @@ class QuadrilateralInterface( @typing.overload def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["shapeType"], typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi index de0d8b1d940..095c8a4d9a7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.pyi @@ -70,9 +70,17 @@ class QuadrilateralInterface( @typing.overload def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["shapeType"], typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py index 73d6a684eee..59a34b21291 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py @@ -42,18 +42,26 @@ class ReadOnlyFirst( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar - baz: MetaOapg.properties.baz + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] + baz: typing.Union[MetaOapg.properties.baz, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.properties.baz: ... + def __getitem__(self, name: typing.Literal["baz"]) -> typing.Union[MetaOapg.properties.baz, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi index 73d6a684eee..59a34b21291 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.pyi @@ -42,18 +42,26 @@ class ReadOnlyFirst( } additional_properties = schemas.AnyTypeSchema - bar: MetaOapg.properties.bar - baz: MetaOapg.properties.baz + bar: typing.Union[MetaOapg.properties.bar, schemas.Unset] + baz: typing.Union[MetaOapg.properties.baz, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["baz"]) -> MetaOapg.properties.baz: ... + def __getitem__(self, name: typing.Literal["baz"]) -> typing.Union[MetaOapg.properties.baz, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["bar"], typing.Literal["baz"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py index 8994382dfa3..2d0e458ef4c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py @@ -63,14 +63,22 @@ class ScaleneTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class ScaleneTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi index 8994382dfa3..2d0e458ef4c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.pyi @@ -63,14 +63,22 @@ class ScaleneTriangle( } additional_properties = schemas.AnyTypeSchema - triangleType: MetaOapg.properties.triangleType + triangleType: typing.Union[MetaOapg.properties.triangleType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... + def __getitem__(self, name: typing.Literal["triangleType"]) -> typing.Union[MetaOapg.properties.triangleType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class ScaleneTriangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py index e6ae4e187e2..c956f89ce1b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py @@ -62,9 +62,14 @@ class Shape( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.pyi index e6ae4e187e2..c956f89ce1b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.pyi @@ -62,9 +62,14 @@ class Shape( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py index 97438cab005..e695d22b141 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py @@ -66,9 +66,14 @@ class ShapeOrNull( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.pyi index 97438cab005..e695d22b141 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.pyi @@ -66,9 +66,14 @@ class ShapeOrNull( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py index fd4a42a47f3..429b019c27c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py @@ -63,14 +63,22 @@ class SimpleQuadrilateral( } additional_properties = schemas.AnyTypeSchema - quadrilateralType: MetaOapg.properties.quadrilateralType + quadrilateralType: typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... + def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class SimpleQuadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi index fd4a42a47f3..429b019c27c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.pyi @@ -63,14 +63,22 @@ class SimpleQuadrilateral( } additional_properties = schemas.AnyTypeSchema - quadrilateralType: MetaOapg.properties.quadrilateralType + quadrilateralType: typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> MetaOapg.properties.quadrilateralType: ... + def __getitem__(self, name: typing.Literal["quadrilateralType"]) -> typing.Union[MetaOapg.properties.quadrilateralType, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["quadrilateralType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -104,9 +112,14 @@ class SimpleQuadrilateral( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.py index 59231c14e47..de5e4c603d8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.py @@ -51,9 +51,14 @@ class SomeObject( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.pyi index 59231c14e47..de5e4c603d8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/some_object.pyi @@ -51,9 +51,14 @@ class SomeObject( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py index d94c5fb5433..b5cdc5ce9a0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py @@ -42,14 +42,22 @@ class SpecialModelName( } additional_properties = schemas.AnyTypeSchema - a: MetaOapg.properties.a + a: typing.Union[MetaOapg.properties.a, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["a"]) -> MetaOapg.properties.a: ... + def __getitem__(self, name: typing.Literal["a"]) -> typing.Union[MetaOapg.properties.a, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["a"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi index d94c5fb5433..b5cdc5ce9a0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.pyi @@ -42,14 +42,22 @@ class SpecialModelName( } additional_properties = schemas.AnyTypeSchema - a: MetaOapg.properties.a + a: typing.Union[MetaOapg.properties.a, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["a"]) -> MetaOapg.properties.a: ... + def __getitem__(self, name: typing.Literal["a"]) -> typing.Union[MetaOapg.properties.a, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["a"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py index 353a8fe86be..796fd603e1e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py @@ -35,9 +35,14 @@ class StringBooleanMap( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.pyi index 353a8fe86be..796fd603e1e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.pyi @@ -35,9 +35,14 @@ class StringBooleanMap( class MetaOapg: additional_properties = schemas.BoolSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py index 399093a2c44..394242fa66a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py @@ -42,18 +42,26 @@ class Tag( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - name: MetaOapg.properties.name + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["name"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi index 399093a2c44..394242fa66a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.pyi @@ -42,18 +42,26 @@ class Tag( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - name: MetaOapg.properties.name + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + name: typing.Union[MetaOapg.properties.name, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["name"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py index a058e632443..091ad19cacc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py @@ -64,9 +64,14 @@ class Triangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.pyi index a058e632443..091ad19cacc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.pyi @@ -64,9 +64,14 @@ class Triangle( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py index 1dc51df588b..b27482dbdcb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py @@ -70,9 +70,17 @@ class TriangleInterface( @typing.overload def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["shapeType"], typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi index 1dc51df588b..b27482dbdcb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.pyi @@ -70,9 +70,17 @@ class TriangleInterface( @typing.overload def __getitem__(self, name: typing.Literal["triangleType"]) -> MetaOapg.properties.triangleType: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["shapeType"], typing.Literal["triangleType"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py index 107de8b5829..dd9d99be429 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py @@ -57,9 +57,14 @@ class User( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -86,9 +91,14 @@ class User( not_schema = schemas.NoneSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -120,62 +130,70 @@ class User( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - username: MetaOapg.properties.username - firstName: MetaOapg.properties.firstName - lastName: MetaOapg.properties.lastName - email: MetaOapg.properties.email - password: MetaOapg.properties.password - phone: MetaOapg.properties.phone - userStatus: MetaOapg.properties.userStatus - objectWithNoDeclaredProps: MetaOapg.properties.objectWithNoDeclaredProps - objectWithNoDeclaredPropsNullable: MetaOapg.properties.objectWithNoDeclaredPropsNullable - anyTypeProp: MetaOapg.properties.anyTypeProp - anyTypeExceptNullProp: MetaOapg.properties.anyTypeExceptNullProp - anyTypePropNullable: MetaOapg.properties.anyTypePropNullable + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + username: typing.Union[MetaOapg.properties.username, schemas.Unset] + firstName: typing.Union[MetaOapg.properties.firstName, schemas.Unset] + lastName: typing.Union[MetaOapg.properties.lastName, schemas.Unset] + email: typing.Union[MetaOapg.properties.email, schemas.Unset] + password: typing.Union[MetaOapg.properties.password, schemas.Unset] + phone: typing.Union[MetaOapg.properties.phone, schemas.Unset] + userStatus: typing.Union[MetaOapg.properties.userStatus, schemas.Unset] + objectWithNoDeclaredProps: typing.Union[MetaOapg.properties.objectWithNoDeclaredProps, schemas.Unset] + objectWithNoDeclaredPropsNullable: typing.Union[MetaOapg.properties.objectWithNoDeclaredPropsNullable, schemas.Unset] + anyTypeProp: typing.Union[MetaOapg.properties.anyTypeProp, schemas.Unset] + anyTypeExceptNullProp: typing.Union[MetaOapg.properties.anyTypeExceptNullProp, schemas.Unset] + anyTypePropNullable: typing.Union[MetaOapg.properties.anyTypePropNullable, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["username"]) -> MetaOapg.properties.username: ... + def __getitem__(self, name: typing.Literal["username"]) -> typing.Union[MetaOapg.properties.username, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["firstName"]) -> MetaOapg.properties.firstName: ... + def __getitem__(self, name: typing.Literal["firstName"]) -> typing.Union[MetaOapg.properties.firstName, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["lastName"]) -> MetaOapg.properties.lastName: ... + def __getitem__(self, name: typing.Literal["lastName"]) -> typing.Union[MetaOapg.properties.lastName, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["email"]) -> MetaOapg.properties.email: ... + def __getitem__(self, name: typing.Literal["email"]) -> typing.Union[MetaOapg.properties.email, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["password"]) -> MetaOapg.properties.password: ... + def __getitem__(self, name: typing.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["phone"]) -> MetaOapg.properties.phone: ... + def __getitem__(self, name: typing.Literal["phone"]) -> typing.Union[MetaOapg.properties.phone, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["userStatus"]) -> MetaOapg.properties.userStatus: ... + def __getitem__(self, name: typing.Literal["userStatus"]) -> typing.Union[MetaOapg.properties.userStatus, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["objectWithNoDeclaredProps"]) -> MetaOapg.properties.objectWithNoDeclaredProps: ... + def __getitem__(self, name: typing.Literal["objectWithNoDeclaredProps"]) -> typing.Union[MetaOapg.properties.objectWithNoDeclaredProps, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["objectWithNoDeclaredPropsNullable"]) -> MetaOapg.properties.objectWithNoDeclaredPropsNullable: ... + def __getitem__(self, name: typing.Literal["objectWithNoDeclaredPropsNullable"]) -> typing.Union[MetaOapg.properties.objectWithNoDeclaredPropsNullable, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypeProp"]) -> MetaOapg.properties.anyTypeProp: ... + def __getitem__(self, name: typing.Literal["anyTypeProp"]) -> typing.Union[MetaOapg.properties.anyTypeProp, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypeExceptNullProp"]) -> MetaOapg.properties.anyTypeExceptNullProp: ... + def __getitem__(self, name: typing.Literal["anyTypeExceptNullProp"]) -> typing.Union[MetaOapg.properties.anyTypeExceptNullProp, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypePropNullable"]) -> MetaOapg.properties.anyTypePropNullable: ... + def __getitem__(self, name: typing.Literal["anyTypePropNullable"]) -> typing.Union[MetaOapg.properties.anyTypePropNullable, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["username"], typing.Literal["firstName"], typing.Literal["lastName"], typing.Literal["email"], typing.Literal["password"], typing.Literal["phone"], typing.Literal["userStatus"], typing.Literal["objectWithNoDeclaredProps"], typing.Literal["objectWithNoDeclaredPropsNullable"], typing.Literal["anyTypeProp"], typing.Literal["anyTypeExceptNullProp"], typing.Literal["anyTypePropNullable"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi index 107de8b5829..dd9d99be429 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.pyi @@ -57,9 +57,14 @@ class User( additional_properties = schemas.AnyTypeSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -86,9 +91,14 @@ class User( not_schema = schemas.NoneSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -120,62 +130,70 @@ class User( } additional_properties = schemas.AnyTypeSchema - id: MetaOapg.properties.id - username: MetaOapg.properties.username - firstName: MetaOapg.properties.firstName - lastName: MetaOapg.properties.lastName - email: MetaOapg.properties.email - password: MetaOapg.properties.password - phone: MetaOapg.properties.phone - userStatus: MetaOapg.properties.userStatus - objectWithNoDeclaredProps: MetaOapg.properties.objectWithNoDeclaredProps - objectWithNoDeclaredPropsNullable: MetaOapg.properties.objectWithNoDeclaredPropsNullable - anyTypeProp: MetaOapg.properties.anyTypeProp - anyTypeExceptNullProp: MetaOapg.properties.anyTypeExceptNullProp - anyTypePropNullable: MetaOapg.properties.anyTypePropNullable + id: typing.Union[MetaOapg.properties.id, schemas.Unset] + username: typing.Union[MetaOapg.properties.username, schemas.Unset] + firstName: typing.Union[MetaOapg.properties.firstName, schemas.Unset] + lastName: typing.Union[MetaOapg.properties.lastName, schemas.Unset] + email: typing.Union[MetaOapg.properties.email, schemas.Unset] + password: typing.Union[MetaOapg.properties.password, schemas.Unset] + phone: typing.Union[MetaOapg.properties.phone, schemas.Unset] + userStatus: typing.Union[MetaOapg.properties.userStatus, schemas.Unset] + objectWithNoDeclaredProps: typing.Union[MetaOapg.properties.objectWithNoDeclaredProps, schemas.Unset] + objectWithNoDeclaredPropsNullable: typing.Union[MetaOapg.properties.objectWithNoDeclaredPropsNullable, schemas.Unset] + anyTypeProp: typing.Union[MetaOapg.properties.anyTypeProp, schemas.Unset] + anyTypeExceptNullProp: typing.Union[MetaOapg.properties.anyTypeExceptNullProp, schemas.Unset] + anyTypePropNullable: typing.Union[MetaOapg.properties.anyTypePropNullable, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["id"]) -> MetaOapg.properties.id: ... + def __getitem__(self, name: typing.Literal["id"]) -> typing.Union[MetaOapg.properties.id, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["username"]) -> MetaOapg.properties.username: ... + def __getitem__(self, name: typing.Literal["username"]) -> typing.Union[MetaOapg.properties.username, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["firstName"]) -> MetaOapg.properties.firstName: ... + def __getitem__(self, name: typing.Literal["firstName"]) -> typing.Union[MetaOapg.properties.firstName, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["lastName"]) -> MetaOapg.properties.lastName: ... + def __getitem__(self, name: typing.Literal["lastName"]) -> typing.Union[MetaOapg.properties.lastName, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["email"]) -> MetaOapg.properties.email: ... + def __getitem__(self, name: typing.Literal["email"]) -> typing.Union[MetaOapg.properties.email, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["password"]) -> MetaOapg.properties.password: ... + def __getitem__(self, name: typing.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["phone"]) -> MetaOapg.properties.phone: ... + def __getitem__(self, name: typing.Literal["phone"]) -> typing.Union[MetaOapg.properties.phone, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["userStatus"]) -> MetaOapg.properties.userStatus: ... + def __getitem__(self, name: typing.Literal["userStatus"]) -> typing.Union[MetaOapg.properties.userStatus, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["objectWithNoDeclaredProps"]) -> MetaOapg.properties.objectWithNoDeclaredProps: ... + def __getitem__(self, name: typing.Literal["objectWithNoDeclaredProps"]) -> typing.Union[MetaOapg.properties.objectWithNoDeclaredProps, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["objectWithNoDeclaredPropsNullable"]) -> MetaOapg.properties.objectWithNoDeclaredPropsNullable: ... + def __getitem__(self, name: typing.Literal["objectWithNoDeclaredPropsNullable"]) -> typing.Union[MetaOapg.properties.objectWithNoDeclaredPropsNullable, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypeProp"]) -> MetaOapg.properties.anyTypeProp: ... + def __getitem__(self, name: typing.Literal["anyTypeProp"]) -> typing.Union[MetaOapg.properties.anyTypeProp, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypeExceptNullProp"]) -> MetaOapg.properties.anyTypeExceptNullProp: ... + def __getitem__(self, name: typing.Literal["anyTypeExceptNullProp"]) -> typing.Union[MetaOapg.properties.anyTypeExceptNullProp, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["anyTypePropNullable"]) -> MetaOapg.properties.anyTypePropNullable: ... + def __getitem__(self, name: typing.Literal["anyTypePropNullable"]) -> typing.Union[MetaOapg.properties.anyTypePropNullable, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["id"], typing.Literal["username"], typing.Literal["firstName"], typing.Literal["lastName"], typing.Literal["email"], typing.Literal["password"], typing.Literal["phone"], typing.Literal["userStatus"], typing.Literal["objectWithNoDeclaredProps"], typing.Literal["objectWithNoDeclaredPropsNullable"], typing.Literal["anyTypeProp"], typing.Literal["anyTypeExceptNullProp"], typing.Literal["anyTypePropNullable"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py index b5f2ef31367..1a82ec7ca73 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py @@ -62,21 +62,29 @@ class Whale( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - hasBaleen: MetaOapg.properties.hasBaleen - hasTeeth: MetaOapg.properties.hasTeeth + hasBaleen: typing.Union[MetaOapg.properties.hasBaleen, schemas.Unset] + hasTeeth: typing.Union[MetaOapg.properties.hasTeeth, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["hasBaleen"]) -> MetaOapg.properties.hasBaleen: ... + def __getitem__(self, name: typing.Literal["hasBaleen"]) -> typing.Union[MetaOapg.properties.hasBaleen, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["hasTeeth"]) -> MetaOapg.properties.hasTeeth: ... + def __getitem__(self, name: typing.Literal["hasTeeth"]) -> typing.Union[MetaOapg.properties.hasTeeth, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["hasBaleen"], typing.Literal["hasTeeth"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi index b5f2ef31367..1a82ec7ca73 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.pyi @@ -62,21 +62,29 @@ class Whale( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - hasBaleen: MetaOapg.properties.hasBaleen - hasTeeth: MetaOapg.properties.hasTeeth + hasBaleen: typing.Union[MetaOapg.properties.hasBaleen, schemas.Unset] + hasTeeth: typing.Union[MetaOapg.properties.hasTeeth, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["hasBaleen"]) -> MetaOapg.properties.hasBaleen: ... + def __getitem__(self, name: typing.Literal["hasBaleen"]) -> typing.Union[MetaOapg.properties.hasBaleen, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["hasTeeth"]) -> MetaOapg.properties.hasTeeth: ... + def __getitem__(self, name: typing.Literal["hasTeeth"]) -> typing.Union[MetaOapg.properties.hasTeeth, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["hasBaleen"], typing.Literal["hasTeeth"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py index 03632b07bee..35f65c5a774 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py @@ -86,17 +86,25 @@ class Zebra( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - type: MetaOapg.properties.type + type: typing.Union[MetaOapg.properties.type, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["type"]) -> MetaOapg.properties.type: ... + def __getitem__(self, name: typing.Literal["type"]) -> typing.Union[MetaOapg.properties.type, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["type"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi index 03632b07bee..35f65c5a774 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.pyi @@ -86,17 +86,25 @@ class Zebra( additional_properties = schemas.AnyTypeSchema className: MetaOapg.properties.className - type: MetaOapg.properties.type + type: typing.Union[MetaOapg.properties.type, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["className"]) -> MetaOapg.properties.className: ... @typing.overload - def __getitem__(self, name: typing.Literal["type"]) -> MetaOapg.properties.type: ... + def __getitem__(self, name: typing.Literal["type"]) -> typing.Union[MetaOapg.properties.type, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["className"], typing.Literal["type"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py index 520f4194ab4..7f250906936 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.py @@ -153,15 +153,15 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter byte: MetaOapg.properties.byte double: MetaOapg.properties.double - integer: MetaOapg.properties.integer - int32: MetaOapg.properties.int32 - int64: MetaOapg.properties.int64 - string: MetaOapg.properties.string - binary: MetaOapg.properties.binary - date: MetaOapg.properties.date - dateTime: MetaOapg.properties.dateTime - password: MetaOapg.properties.password - callback: MetaOapg.properties.callback + integer: typing.Union[MetaOapg.properties.integer, schemas.Unset] + int32: typing.Union[MetaOapg.properties.int32, schemas.Unset] + int64: typing.Union[MetaOapg.properties.int64, schemas.Unset] + string: typing.Union[MetaOapg.properties.string, schemas.Unset] + binary: typing.Union[MetaOapg.properties.binary, schemas.Unset] + date: typing.Union[MetaOapg.properties.date, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + password: typing.Union[MetaOapg.properties.password, schemas.Unset] + callback: typing.Union[MetaOapg.properties.callback, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["number"]) -> MetaOapg.properties.number: ... @@ -176,38 +176,46 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( def __getitem__(self, name: typing.Literal["double"]) -> MetaOapg.properties.double: ... @typing.overload - def __getitem__(self, name: typing.Literal["integer"]) -> MetaOapg.properties.integer: ... + def __getitem__(self, name: typing.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32"]) -> MetaOapg.properties.int32: ... + def __getitem__(self, name: typing.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int64"]) -> MetaOapg.properties.int64: ... + def __getitem__(self, name: typing.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float"]) -> MetaOapg.properties._float: ... + def __getitem__(self, name: typing.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> MetaOapg.properties.string: ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["binary"]) -> MetaOapg.properties.binary: ... + def __getitem__(self, name: typing.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["date"]) -> MetaOapg.properties.date: ... + def __getitem__(self, name: typing.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["password"]) -> MetaOapg.properties.password: ... + def __getitem__(self, name: typing.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["callback"]) -> MetaOapg.properties.callback: ... + def __getitem__(self, name: typing.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["number"], typing.Literal["pattern_without_delimiter"], typing.Literal["byte"], typing.Literal["double"], typing.Literal["integer"], typing.Literal["int32"], typing.Literal["int64"], typing.Literal["float"], typing.Literal["string"], typing.Literal["binary"], typing.Literal["date"], typing.Literal["dateTime"], typing.Literal["password"], typing.Literal["callback"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi index 01856e169d3..cd999ca84fb 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_1/post.pyi @@ -115,15 +115,15 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter byte: MetaOapg.properties.byte double: MetaOapg.properties.double - integer: MetaOapg.properties.integer - int32: MetaOapg.properties.int32 - int64: MetaOapg.properties.int64 - string: MetaOapg.properties.string - binary: MetaOapg.properties.binary - date: MetaOapg.properties.date - dateTime: MetaOapg.properties.dateTime - password: MetaOapg.properties.password - callback: MetaOapg.properties.callback + integer: typing.Union[MetaOapg.properties.integer, schemas.Unset] + int32: typing.Union[MetaOapg.properties.int32, schemas.Unset] + int64: typing.Union[MetaOapg.properties.int64, schemas.Unset] + string: typing.Union[MetaOapg.properties.string, schemas.Unset] + binary: typing.Union[MetaOapg.properties.binary, schemas.Unset] + date: typing.Union[MetaOapg.properties.date, schemas.Unset] + dateTime: typing.Union[MetaOapg.properties.dateTime, schemas.Unset] + password: typing.Union[MetaOapg.properties.password, schemas.Unset] + callback: typing.Union[MetaOapg.properties.callback, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["number"]) -> MetaOapg.properties.number: ... @@ -138,38 +138,46 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( def __getitem__(self, name: typing.Literal["double"]) -> MetaOapg.properties.double: ... @typing.overload - def __getitem__(self, name: typing.Literal["integer"]) -> MetaOapg.properties.integer: ... + def __getitem__(self, name: typing.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int32"]) -> MetaOapg.properties.int32: ... + def __getitem__(self, name: typing.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["int64"]) -> MetaOapg.properties.int64: ... + def __getitem__(self, name: typing.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["float"]) -> MetaOapg.properties._float: ... + def __getitem__(self, name: typing.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> MetaOapg.properties.string: ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["binary"]) -> MetaOapg.properties.binary: ... + def __getitem__(self, name: typing.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["date"]) -> MetaOapg.properties.date: ... + def __getitem__(self, name: typing.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + def __getitem__(self, name: typing.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["password"]) -> MetaOapg.properties.password: ... + def __getitem__(self, name: typing.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["callback"]) -> MetaOapg.properties.callback: ... + def __getitem__(self, name: typing.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["number"], typing.Literal["pattern_without_delimiter"], typing.Literal["byte"], typing.Literal["double"], typing.Literal["integer"], typing.Literal["int32"], typing.Literal["int64"], typing.Literal["float"], typing.Literal["string"], typing.Literal["binary"], typing.Literal["date"], typing.Literal["dateTime"], typing.Literal["password"], typing.Literal["callback"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py index 167f03d9499..e5d22f9ab68 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.py @@ -369,18 +369,26 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( } additional_properties = schemas.AnyTypeSchema - enum_form_string_array: MetaOapg.properties.enum_form_string_array - enum_form_string: MetaOapg.properties.enum_form_string + enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset] + enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... + def __getitem__(self, name: typing.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... + def __getitem__(self, name: typing.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["enum_form_string_array"], typing.Literal["enum_form_string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi index b6bd7ad551a..e0083004ff0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_2/get.pyi @@ -293,18 +293,26 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( } additional_properties = schemas.AnyTypeSchema - enum_form_string_array: MetaOapg.properties.enum_form_string_array - enum_form_string: MetaOapg.properties.enum_form_string + enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset] + enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... + def __getitem__(self, name: typing.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... + def __getitem__(self, name: typing.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["enum_form_string_array"], typing.Literal["enum_form_string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.py index 277cc154e72..6a1025fd132 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.py @@ -36,9 +36,14 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.pyi index 0dfab37fdb2..ad870c9589e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_additional_properties/post.pyi @@ -34,9 +34,14 @@ class SchemaForRequestBodyApplicationJson( class MetaOapg: additional_properties = schemas.StrSchema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py index ab931776da6..403d5e0024a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.py @@ -61,9 +61,14 @@ class CompositionAtRootSchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -121,9 +126,14 @@ class CompositionInPropertySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -142,14 +152,22 @@ class CompositionInPropertySchema( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -232,9 +250,14 @@ class SchemaForRequestBodyApplicationJson( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -292,9 +315,14 @@ class SchemaForRequestBodyMultipartFormData( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -313,14 +341,22 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -381,9 +417,14 @@ class SchemaFor200ResponseBodyApplicationJson( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -441,9 +482,14 @@ class SchemaFor200ResponseBodyMultipartFormData( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -462,14 +508,22 @@ class SchemaFor200ResponseBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi index 7d01ee5536e..a2871eb4a6c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_inline_composition_/post.pyi @@ -56,9 +56,14 @@ class CompositionAtRootSchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -113,9 +118,14 @@ class CompositionInPropertySchema( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -134,14 +144,22 @@ class CompositionInPropertySchema( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -190,9 +208,14 @@ class SchemaForRequestBodyApplicationJson( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -247,9 +270,14 @@ class SchemaForRequestBodyMultipartFormData( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -268,14 +296,22 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -323,9 +359,14 @@ class SchemaFor200ResponseBodyApplicationJson( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -380,9 +421,14 @@ class SchemaFor200ResponseBodyMultipartFormData( ] - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, @@ -401,14 +447,22 @@ class SchemaFor200ResponseBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - someProp: MetaOapg.properties.someProp + someProp: typing.Union[MetaOapg.properties.someProp, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + def __getitem__(self, name: typing.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["someProp"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py index a78729d21aa..c089b055e5f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.py @@ -56,9 +56,17 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( @typing.overload def __getitem__(self, name: typing.Literal["param2"]) -> MetaOapg.properties.param2: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["param"], typing.Literal["param2"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi index 89af3526e21..27f31256642 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_json_form_data/get.pyi @@ -54,9 +54,17 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( @typing.overload def __getitem__(self, name: typing.Literal["param2"]) -> MetaOapg.properties.param2: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["param"], typing.Literal["param2"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py index fed49dbebf0..5af4877cc29 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.py @@ -40,14 +40,22 @@ class MapBeanSchema( } additional_properties = schemas.AnyTypeSchema - keyword: MetaOapg.properties.keyword + keyword: typing.Union[MetaOapg.properties.keyword, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["keyword"]) -> MetaOapg.properties.keyword: ... + def __getitem__(self, name: typing.Literal["keyword"]) -> typing.Union[MetaOapg.properties.keyword, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["keyword"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi index d20934ea566..2cecd9c4245 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_obj_in_query/get.pyi @@ -38,14 +38,22 @@ class MapBeanSchema( } additional_properties = schemas.AnyTypeSchema - keyword: MetaOapg.properties.keyword + keyword: typing.Union[MetaOapg.properties.keyword, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["keyword"]) -> MetaOapg.properties.keyword: ... + def __getitem__(self, name: typing.Literal["keyword"]) -> typing.Union[MetaOapg.properties.keyword, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["keyword"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py index 4921c11fb2d..65294c592a1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py @@ -75,17 +75,25 @@ class SchemaForRequestBodyMultipartFormData( additional_properties = schemas.AnyTypeSchema requiredFile: MetaOapg.properties.requiredFile - additionalMetadata: MetaOapg.properties.additionalMetadata + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["requiredFile"], typing.Literal["additionalMetadata"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi index 0318a223c6a..323f57ea425 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi @@ -49,17 +49,25 @@ class SchemaForRequestBodyMultipartFormData( additional_properties = schemas.AnyTypeSchema requiredFile: MetaOapg.properties.requiredFile - additionalMetadata: MetaOapg.properties.additionalMetadata + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["requiredFile"], typing.Literal["additionalMetadata"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py index a6b695e06ee..d0af4bc4cd2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.py @@ -49,17 +49,25 @@ class SchemaForRequestBodyMultipartFormData( additional_properties = schemas.AnyTypeSchema file: MetaOapg.properties.file - additionalMetadata: MetaOapg.properties.additionalMetadata + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["file"]) -> MetaOapg.properties.file: ... @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["file"], typing.Literal["additionalMetadata"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi index 3c95d8e4fda..da89d3f5c69 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_file/post.pyi @@ -47,17 +47,25 @@ class SchemaForRequestBodyMultipartFormData( additional_properties = schemas.AnyTypeSchema file: MetaOapg.properties.file - additionalMetadata: MetaOapg.properties.additionalMetadata + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] @typing.overload def __getitem__(self, name: typing.Literal["file"]) -> MetaOapg.properties.file: ... @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["file"], typing.Literal["additionalMetadata"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py index 279f2bc6237..0aef11dec7a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.py @@ -65,14 +65,22 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - files: MetaOapg.properties.files + files: typing.Union[MetaOapg.properties.files, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["files"]) -> MetaOapg.properties.files: ... + def __getitem__(self, name: typing.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["files"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi index 4ec62646b39..f2eb96c6938 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/fake_upload_files/post.pyi @@ -63,14 +63,22 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - files: MetaOapg.properties.files + files: typing.Union[MetaOapg.properties.files, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["files"]) -> MetaOapg.properties.files: ... + def __getitem__(self, name: typing.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["files"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py index 2da6dcefb36..2e94dfcea1e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.py @@ -46,14 +46,22 @@ class SchemaFor0ResponseBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - string: 'Foo' + string: typing.Union['Foo', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> 'Foo': ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union['Foo', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi index 279c5d8f3d0..013e9ce0ac4 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/foo/get.pyi @@ -44,14 +44,22 @@ class SchemaFor0ResponseBodyApplicationJson( } additional_properties = schemas.AnyTypeSchema - string: 'Foo' + string: typing.Union['Foo', schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["string"]) -> 'Foo': ... + def __getitem__(self, name: typing.Literal["string"]) -> typing.Union['Foo', schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["string"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py index 794704c704c..000178775af 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.py @@ -69,18 +69,26 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name - status: MetaOapg.properties.status + name: typing.Union[MetaOapg.properties.name, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["status"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi index 5407624ea1e..e064f4ab042 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_3/post.pyi @@ -43,18 +43,26 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded( } additional_properties = schemas.AnyTypeSchema - name: MetaOapg.properties.name - status: MetaOapg.properties.status + name: typing.Union[MetaOapg.properties.name, schemas.Unset] + status: typing.Union[MetaOapg.properties.status, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["name"]) -> MetaOapg.properties.name: ... + def __getitem__(self, name: typing.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["status"]) -> MetaOapg.properties.status: ... + def __getitem__(self, name: typing.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["name"], typing.Literal["status"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py index b595015b96f..25b3076b387 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.py @@ -71,18 +71,26 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - additionalMetadata: MetaOapg.properties.additionalMetadata - file: MetaOapg.properties.file + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] + file: typing.Union[MetaOapg.properties.file, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["file"]) -> MetaOapg.properties.file: ... + def __getitem__(self, name: typing.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["additionalMetadata"], typing.Literal["file"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi index 377a0ffbcc0..93e7eac1e2c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/pet_pet_id_upload_image/post.pyi @@ -45,18 +45,26 @@ class SchemaForRequestBodyMultipartFormData( } additional_properties = schemas.AnyTypeSchema - additionalMetadata: MetaOapg.properties.additionalMetadata - file: MetaOapg.properties.file + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset] + file: typing.Union[MetaOapg.properties.file, schemas.Unset] @typing.overload - def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + def __getitem__(self, name: typing.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... @typing.overload - def __getitem__(self, name: typing.Literal["file"]) -> MetaOapg.properties.file: ... + def __getitem__(self, name: typing.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + @typing.overload + def __getitem__(self, name: str) -> MetaOapg.additional_properties: ... + + def __getitem__(self, name: typing.Union[str, typing.Literal["additionalMetadata"], typing.Literal["file"], ]): # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.py index 490914c5c3e..7692aaaae53 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.py @@ -38,9 +38,14 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: additional_properties = schemas.Int32Schema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.pyi b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.pyi index 391aead3dc0..f68019912fe 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.pyi +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/paths/store_inventory/get.pyi @@ -33,9 +33,14 @@ class SchemaFor200ResponseBodyApplicationJson( class MetaOapg: additional_properties = schemas.Int32Schema - def __getitem__(self, name: str) -> MetaOapg.additional_properties: + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: # dict_instance[name] accessor - return super().__getitem__(name) + if not hasattr(self.MetaOapg, 'properties') or name not in self.MetaOapg.properties.__annotations__: + return super().__getitem__(name) + try: + return super().__getitem__(name) + except KeyError: + return schemas.unset def __new__( cls, diff --git a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_additional_properties_class.py new file mode 100644 index 00000000000..3e0bc9ae713 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_additional_properties_class.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + +import unittest + +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass +from petstore_api import schemas + + +class TestAdditionalPropertiesClass(unittest.TestCase): + """AdditionalPropertiesClass unit test stubs""" + + def test_additional_properties_class(self): + inst = AdditionalPropertiesClass({}) + map_property_by_getitem = inst["map_property"] + assert map_property_by_getitem is schemas.unset + map_property_by_attribute = inst.map_property + assert map_property_by_attribute is schemas.unset + + inst = AdditionalPropertiesClass(map_property={}) + assert inst.map_property == {} + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_gm_fruit.py index 91c35a1cad5..213bb51239c 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_gm_fruit.py @@ -17,6 +17,7 @@ import frozendict from petstore_api.model import apple from petstore_api.model import banana from petstore_api.model.gm_fruit import GmFruit +from petstore_api import schemas class TestGmFruit(unittest.TestCase): """GmFruit unit test stubs""" @@ -36,10 +37,7 @@ class TestGmFruit(unittest.TestCase): color = 'yellow' cultivar = 'banaple' fruit = GmFruit(lengthCm=length_cm, color=color, cultivar=cultivar) - assert isinstance(fruit, banana.Banana) - assert isinstance(fruit, apple.Apple) - assert isinstance(fruit, frozendict.frozendict) - assert isinstance(fruit, GmFruit) + assert isinstance(fruit, (banana.Banana, apple.Apple, GmFruit, frozendict.frozendict)) # check its properties self.assertEqual(fruit.lengthCm, length_cm) self.assertEqual(fruit['lengthCm'], length_cm) @@ -57,8 +55,14 @@ class TestGmFruit(unittest.TestCase): } ) + # known variable from Apple is unset if it is not in the payload + fruit_origin = fruit.origin + assert fruit_origin is schemas.unset + fruit_origin = fruit["origin"] + assert fruit_origin is schemas.unset + with self.assertRaises(KeyError): - invalid_variable = fruit['origin'] + fruit['unknown_variable'] # with getattr self.assertTrue(getattr(fruit, 'origin', 'some value'), 'some value') @@ -81,7 +85,6 @@ class TestGmFruit(unittest.TestCase): # including input parameters for both anyOf instances works color = 'orange' - color_stored = b'orange' fruit = GmFruit( color=color, cultivar=cultivar, diff --git a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_no_additional_properties.py b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_no_additional_properties.py index 7aff4811327..446dcee97c7 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests_manual/test_no_additional_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/tests_manual/test_no_additional_properties.py @@ -9,13 +9,11 @@ Generated by: https://openapi-generator.tech """ - -import sys +import decimal import unittest -import petstore_api from petstore_api.model.no_additional_properties import NoAdditionalProperties - +from petstore_api import schemas class TestNoAdditionalProperties(unittest.TestCase): """NoAdditionalProperties unit test stubs""" @@ -31,6 +29,14 @@ class TestNoAdditionalProperties(unittest.TestCase): # works with only required inst = NoAdditionalProperties(id=1) + id_by_items = inst["id"] + assert id_by_items == 1 + assert isinstance(id_by_items, (schemas.Int64Schema, decimal.Decimal)) + id_by_property = inst.id + assert id_by_property == 1 + assert isinstance(id_by_property, (schemas.Int64Schema, decimal.Decimal)) + assert inst.petId is schemas.unset + assert inst["petId"] is schemas.unset # works with required + optional inst = NoAdditionalProperties(id=1, petId=2)