mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
[typescript-fetch] Fixed issue where unique arrays (sets) of primitive values aren't initialized properly (#19521)
* Fix for https://github.com/OpenAPITools/openapi-generator/issues/19520 * Removed redundant Array<any> cast * Fixed modelGeneric.mustache * Updated samples
This commit is contained in:
parent
2f54a2fb11
commit
2bc0e5f745
@ -55,6 +55,15 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
|
|||||||
{{/additionalPropertiesType}}
|
{{/additionalPropertiesType}}
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
|
{{#isArray}}
|
||||||
|
{{#uniqueItems}}
|
||||||
|
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}{{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Set(json['{{baseName}}']),
|
||||||
|
{{/uniqueItems}}
|
||||||
|
{{^uniqueItems}}
|
||||||
|
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}{{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}json['{{baseName}}'],
|
||||||
|
{{/uniqueItems}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{^isArray}}
|
||||||
{{#isDateType}}
|
{{#isDateType}}
|
||||||
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])),
|
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])),
|
||||||
{{/isDateType}}
|
{{/isDateType}}
|
||||||
@ -66,6 +75,7 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
|
|||||||
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}json['{{baseName}}'],
|
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}json['{{baseName}}'],
|
||||||
{{/isDateTimeType}}
|
{{/isDateTimeType}}
|
||||||
{{/isDateType}}
|
{{/isDateType}}
|
||||||
|
{{/isArray}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}
|
{{^isPrimitiveType}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
|
@ -106,7 +106,7 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet {
|
|||||||
'id': json['id'] == null ? undefined : json['id'],
|
'id': json['id'] == null ? undefined : json['id'],
|
||||||
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
||||||
'name': json['name'],
|
'name': json['name'],
|
||||||
'photoUrls': json['photoUrls'],
|
'photoUrls': new Set(json['photoUrls']),
|
||||||
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
||||||
'status': json['status'] == null ? undefined : json['status'],
|
'status': json['status'] == null ? undefined : json['status'],
|
||||||
};
|
};
|
||||||
|
@ -106,7 +106,7 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet {
|
|||||||
'id': json['id'] == null ? undefined : json['id'],
|
'id': json['id'] == null ? undefined : json['id'],
|
||||||
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
||||||
'name': json['name'],
|
'name': json['name'],
|
||||||
'photoUrls': json['photoUrls'],
|
'photoUrls': new Set(json['photoUrls']),
|
||||||
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
||||||
'status': json['status'] == null ? undefined : json['status'],
|
'status': json['status'] == null ? undefined : json['status'],
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,7 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet {
|
|||||||
'id': json['id'] == null ? undefined : json['id'],
|
'id': json['id'] == null ? undefined : json['id'],
|
||||||
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
'category': json['category'] == null ? undefined : CategoryFromJSON(json['category']),
|
||||||
'name': json['name'],
|
'name': json['name'],
|
||||||
'photoUrls': json['photoUrls'],
|
'photoUrls': new Set(json['photoUrls']),
|
||||||
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
'tags': json['tags'] == null ? undefined : ((json['tags'] as Array<any>).map(TagFromJSON)),
|
||||||
'status': json['status'] == null ? undefined : json['status'],
|
'status': json['status'] == null ? undefined : json['status'],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user