Skip to content

Commit 8675874

Browse files
authored
Fix #20044 (#20045)
1 parent 98cd9bd commit 8675874

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any {
4949
switch (value['{{discriminator.propertyName}}']) {
5050
{{#discriminator.mappedModels}}
5151
case '{{mappingName}}':
52-
return {{modelName}}ToJSON(value);
52+
return Object.assign({}, {{modelName}}ToJSON(value), { {{discriminator.propertyName}}: '{{mappingName}}' } as const);
5353
{{/discriminator.mappedModels}}
5454
default:
5555
throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${value['{{discriminator.propertyName}}']}'`);

0 commit comments

Comments
 (0)