mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
[typescript-fetch] Guard array mapping against undefined on optional array model properties (#2324)
* [typescript-fetch] Guard array mapping against undefined on optional array model properties (#2323) * [typescript-fetch] Update samples
This commit is contained in:
parent
c6a5017a13
commit
a797dd668b
@ -74,7 +74,7 @@ export function {{classname}}ToJSON(value?: {{classname}}): any {
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isContainer}}
|
||||
'{{baseName}}': (value.{{name}} as Array<any>).map({{#items}}{{datatype}}{{/items}}ToJSON),
|
||||
'{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}(value.{{name}} as Array<any>).map({{#items}}{{datatype}}{{/items}}ToJSON),
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
'{{baseName}}': {{datatype}}ToJSON(value.{{name}}),
|
||||
|
@ -85,7 +85,7 @@ export function PetToJSON(value?: Pet): any {
|
||||
'category': CategoryToJSON(value.category),
|
||||
'name': value.name,
|
||||
'photoUrls': value.photoUrls,
|
||||
'tags': (value.tags as Array<any>).map(TagToJSON),
|
||||
'tags': value.tags === undefined ? undefined : (value.tags as Array<any>).map(TagToJSON),
|
||||
'status': value.status,
|
||||
};
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ export function PetToJSON(value?: Pet): any {
|
||||
'category': CategoryToJSON(value.category),
|
||||
'name': value.name,
|
||||
'photoUrls': value.photoUrls,
|
||||
'tags': (value.tags as Array<any>).map(TagToJSON),
|
||||
'tags': value.tags === undefined ? undefined : (value.tags as Array<any>).map(TagToJSON),
|
||||
'status': value.status,
|
||||
};
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ export function PetToJSON(value?: Pet): any {
|
||||
'category': CategoryToJSON(value.category),
|
||||
'name': value.name,
|
||||
'photoUrls': value.photoUrls,
|
||||
'tags': (value.tags as Array<any>).map(TagToJSON),
|
||||
'tags': value.tags === undefined ? undefined : (value.tags as Array<any>).map(TagToJSON),
|
||||
'status': value.status,
|
||||
};
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ export function PetToJSON(value?: Pet): any {
|
||||
'category': CategoryToJSON(value.category),
|
||||
'name': value.name,
|
||||
'photoUrls': value.photoUrls,
|
||||
'tags': (value.tags as Array<any>).map(TagToJSON),
|
||||
'tags': value.tags === undefined ? undefined : (value.tags as Array<any>).map(TagToJSON),
|
||||
'status': value.status,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user