Skip to content

Commit a4ba1c5

Browse files
[typescript-fetch] Check against the typed JSON in oneOf serialization
1 parent 1d07128 commit a4ba1c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
4747
return json;
4848
}
4949
{{/-first}}
50-
if (instanceOf{{{.}}}(json)) {
50+
if (instanceOf{{{.}}}({{{.}}}FromJSONTyped(json, true))) {
5151
return {{{.}}}FromJSONTyped(json, true);
5252
}
5353
{{/oneOfModels}}
@@ -56,7 +56,7 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
5656
if (Array.isArray(json)) {
5757
if (json.every(item => typeof item === 'object')) {
5858
{{/-first}}
59-
if (json.every(item => instanceOf{{{.}}}(item))) {
59+
if (json.every(item => instanceOf{{{.}}}({{{.}}}FromJSONTyped(item, true)))) {
6060
return json.map(value => {{{.}}}FromJSONTyped(value, true));
6161
}
6262
{{#-last}}

0 commit comments

Comments
 (0)