From 8505f229cfd530730319bd60212c485f25206ac2 Mon Sep 17 00:00:00 2001 From: Brendan Burns <5751682+brendandburns@users.noreply.github.com> Date: Wed, 19 Aug 2026 21:41:47 +0000 Subject: [PATCH] Add custom TLS server names and preserve serialized fields - Add custom TLS server name support and update generated samples.\n- Fix the missing declaration.\n- Preserve unmapped baseName fields during TypeScript serialization. --- .../src/main/resources/typescript-node/models.mustache | 5 ++++- .../resources/typescript/model/ObjectSerializer.mustache | 5 ++++- .../typescript/objectsWithEnums-expected/model/models.ts | 5 ++++- .../echo_api/typescript/build/models/ObjectSerializer.ts | 5 ++++- .../typescript-node/encode-decode/build/model/models.ts | 5 ++++- .../builds/array-of-lists/models/ObjectSerializer.ts | 5 ++++- .../builds/enum-single-value/models/ObjectSerializer.ts | 5 ++++- .../builds/null-types-simple/models/ObjectSerializer.ts | 5 ++++- .../builds/with-unique-items/models/ObjectSerializer.ts | 5 ++++- .../encode-decode/build/models/ObjectSerializer.ts | 5 ++++- samples/client/petstore/typescript-node/3_0/model/models.ts | 5 ++++- .../client/petstore/typescript-node/default/model/models.ts | 5 ++++- samples/client/petstore/typescript-node/npm/model/models.ts | 5 ++++- .../typescript/builds/browser/models/ObjectSerializer.ts | 5 ++++- .../builds/composed-schemas/models/ObjectSerializer.ts | 5 ++++- .../typescript/builds/default/models/ObjectSerializer.ts | 5 ++++- .../typescript/builds/deno/models/ObjectSerializer.ts | 5 ++++- .../builds/deno_object_params/models/ObjectSerializer.ts | 5 ++++- .../builds/explode-query/models/ObjectSerializer.ts | 5 ++++- .../typescript/builds/inversify/models/ObjectSerializer.ts | 5 ++++- .../typescript/builds/jquery/models/ObjectSerializer.ts | 5 ++++- .../builds/nullable-enum/models/ObjectSerializer.ts | 5 ++++- .../builds/object_params/models/ObjectSerializer.ts | 5 ++++- 23 files changed, 92 insertions(+), 23 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache index 96b3fb2b826b..fe2e679314f6 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache @@ -168,7 +168,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index = 0; index < attributeTypes.length; index++) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache index 714af5bbe22e..d3e8aa0198ae 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache @@ -205,7 +205,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts index 896cb588758b..33b414acc8da 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts @@ -95,7 +95,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index in attributeTypes) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts b/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts index a91cfd29d80e..70ee5775729d 100644 --- a/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts +++ b/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts @@ -213,7 +213,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/others/typescript-node/encode-decode/build/model/models.ts b/samples/client/others/typescript-node/encode-decode/build/model/models.ts index 362945f18a31..b4087cab2d48 100644 --- a/samples/client/others/typescript-node/encode-decode/build/model/models.ts +++ b/samples/client/others/typescript-node/encode-decode/build/model/models.ts @@ -139,7 +139,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index = 0; index < attributeTypes.length; index++) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/samples/client/others/typescript/builds/array-of-lists/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/array-of-lists/models/ObjectSerializer.ts index d10cdbc5eff7..786d4452c696 100644 --- a/samples/client/others/typescript/builds/array-of-lists/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/array-of-lists/models/ObjectSerializer.ts @@ -180,7 +180,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/others/typescript/builds/enum-single-value/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/enum-single-value/models/ObjectSerializer.ts index 5ecf3d4ac6e7..58d393a4bff6 100644 --- a/samples/client/others/typescript/builds/enum-single-value/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/enum-single-value/models/ObjectSerializer.ts @@ -182,7 +182,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts index 7cde51dbea02..8a96a18bfc84 100644 --- a/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts @@ -180,7 +180,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts index 1318620d22e9..94ebbdee01a9 100644 --- a/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts @@ -177,7 +177,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/others/typescript/encode-decode/build/models/ObjectSerializer.ts b/samples/client/others/typescript/encode-decode/build/models/ObjectSerializer.ts index a907494c3961..0317e74cd847 100644 --- a/samples/client/others/typescript/encode-decode/build/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/encode-decode/build/models/ObjectSerializer.ts @@ -180,7 +180,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/client/petstore/typescript-node/3_0/model/models.ts b/samples/client/petstore/typescript-node/3_0/model/models.ts index 01b62488cb90..b7b857eb951a 100644 --- a/samples/client/petstore/typescript-node/3_0/model/models.ts +++ b/samples/client/petstore/typescript-node/3_0/model/models.ts @@ -145,7 +145,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index = 0; index < attributeTypes.length; index++) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/samples/client/petstore/typescript-node/default/model/models.ts b/samples/client/petstore/typescript-node/default/model/models.ts index 7a784c6a9730..9aa78c793c0c 100644 --- a/samples/client/petstore/typescript-node/default/model/models.ts +++ b/samples/client/petstore/typescript-node/default/model/models.ts @@ -153,7 +153,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index = 0; index < attributeTypes.length; index++) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/samples/client/petstore/typescript-node/npm/model/models.ts b/samples/client/petstore/typescript-node/npm/model/models.ts index 7a784c6a9730..9aa78c793c0c 100644 --- a/samples/client/petstore/typescript-node/npm/model/models.ts +++ b/samples/client/petstore/typescript-node/npm/model/models.ts @@ -153,7 +153,10 @@ export class ObjectSerializer { let instance: {[index: string]: any} = {}; for (let index = 0; index < attributeTypes.length; index++) { let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts index fe462a298a3a..f3dfc78a2637 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts index 46d1a1994ba7..049ef72e6a54 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts @@ -199,7 +199,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts index fe462a298a3a..f3dfc78a2637 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts index 3f31d6689023..45b6b0de073d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/models/ObjectSerializer.ts index 3f31d6689023..45b6b0de073d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts index 9b1bff296530..c995bef8eb95 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts @@ -324,7 +324,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts index fe462a298a3a..f3dfc78a2637 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts index fe462a298a3a..f3dfc78a2637 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/models/ObjectSerializer.ts index e02fd5f3757b..4163f18d7383 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/models/ObjectSerializer.ts @@ -178,7 +178,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts index fe462a298a3a..f3dfc78a2637 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts @@ -194,7 +194,10 @@ export class ObjectSerializer { let attributeTypes = typeMap[type].getAttributeTypeMap(); let instance: {[index: string]: any} = {}; for (let attributeType of attributeTypes) { - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + const value = Object.prototype.hasOwnProperty.call(data, attributeType.name) + ? data[attributeType.name] + : data[attributeType.baseName]; + instance[attributeType.baseName] = ObjectSerializer.serialize(value, attributeType.type, attributeType.format); } return instance; }