mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 11:27:08 +00:00
[python] Fixes endpoint overload type hint + required property not in properties (#13790)
* Adds endpoint overload type hint fix to template * Samples regenerated * Adds fix for required property not in properties * Regenerates samples
This commit is contained in:
@@ -73,6 +73,12 @@
|
||||
{{/eq}}
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#if isOverload}}
|
||||
{{#eq skipDeserialization "True"}}
|
||||
skip_deserialization: typing_extensions.Literal[True],
|
||||
{{/eq}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if queryParams}}
|
||||
query_params: RequestQueryParams = frozendict.frozendict(),
|
||||
|
||||
@@ -17,7 +17,15 @@ def __new__(
|
||||
{{#if complexType}}
|
||||
{{baseName}}: '{{complexType}}',
|
||||
{{else}}
|
||||
{{#if getSchemaIsFromAdditionalProperties}}
|
||||
{{#if addPropsUnset}}
|
||||
{{baseName}}: typing.Union[schemas.AnyTypeSchema, {{> model_templates/schema_python_types }}],
|
||||
{{else}}
|
||||
{{baseName}}: typing.Union[MetaOapg.additional_properties, {{> model_templates/schema_python_types }}],
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{baseName}}: typing.Union[MetaOapg.properties.{{baseName}}, {{> model_templates/schema_python_types }}],
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{/with}}
|
||||
|
||||
@@ -32,4 +32,8 @@ class {{> model_templates/classname }}(
|
||||
{{/if}}
|
||||
{{> model_templates/property_type_hints }}
|
||||
|
||||
{{#if additionalProperties}}
|
||||
{{> model_templates/new }}
|
||||
{{else}}
|
||||
{{> model_templates/new addPropsUnset=true }}
|
||||
{{/if}}
|
||||
|
||||
@@ -2978,4 +2978,17 @@ components:
|
||||
$ref: "#/components/schemas/ArrayWithValidationsInItems"
|
||||
required:
|
||||
- from
|
||||
- "!reference"
|
||||
- "!reference"
|
||||
ObjectWithOptionalTestProp:
|
||||
type: object
|
||||
properties:
|
||||
test:
|
||||
type: string
|
||||
ObjectWithAllOfWithReqTestPropFromUnsetAddProp:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ObjectWithOptionalTestProp'
|
||||
- type: object
|
||||
required: [ test ]
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
Reference in New Issue
Block a user