From 7527911393ec1984299c04a52e356d281260eb14 Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Thu, 20 Apr 2023 17:32:57 +0200 Subject: [PATCH 1/5] Fix invalid discrimnator value and enum type --- .../openapitools/codegen/DefaultCodegen.java | 6 +- .../AbstractTypeScriptClientCodegen.java | 9 ++- .../languages/TypeScriptClientCodegen.java | 63 ++++++++++++++++++- .../model/ObjectSerializer.mustache | 4 +- .../resources/typescript/model/model.mustache | 17 ++++- 5 files changed, 90 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index a3c1bef3db1c..1fef0ed65733 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1648,7 +1648,9 @@ public String toArrayModelParamName(String name) { */ @SuppressWarnings("static-method") public String toEnumName(CodegenProperty property) { - return StringUtils.capitalize(property.name) + "Enum"; + String enumName = StringUtils.capitalize(property.name) + "Enum"; + System.out.println("Default CodeGen: " + enumName); + return enumName; } /** @@ -4140,6 +4142,8 @@ protected void updateDataTypeWithEnumForArray(CodegenProperty property) { } if (baseItem != null) { // set both datatype and datetypeWithEnum as only the inner type is enum + System.out.println("Marker: 1"); + System.out.println("Replace: " + property.datatypeWithEnum + " from " + baseItem.baseType + " to " + toEnumName(baseItem)); property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, toEnumName(baseItem)); // naming the enum with respect to the language enum naming convention diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 89ac30bb52d8..404493dd3ba0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -604,12 +604,14 @@ public String getTypeDeclaration(Schema p) { } else if (ModelUtils.isMapSchema(p)) { Schema inner = getSchemaAdditionalProperties(p); String nullSafeSuffix = getNullSafeAdditionalProps() ? " | undefined" : ""; + System.out.println("[getTypeDeclaration] Inner: "+ inner.toString()); return "{ [key: string]: " + getTypeDeclaration(unaliasSchema(inner)) + nullSafeSuffix + "; }"; } else if (ModelUtils.isFileSchema(p)) { return "File"; } else if (ModelUtils.isBinarySchema(p)) { return "ArrayBuffer"; } + return super.getTypeDeclaration(p); } @@ -884,8 +886,12 @@ public String toEnumVarName(String name, String datatype) { @Override public String toEnumName(CodegenProperty property) { String enumName = property.name; + System.out.println("enumName: " + enumName); enumName = addSuffix(enumName, enumSuffix); - return toTypescriptTypeName(enumName, "_"); + System.out.println("enumName with Suffix: " + enumName); + String tsName = toTypescriptTypeName(enumName, "_"); + System.out.println("TS Name: " + tsName); + return tsName; } protected void setEnumPropertyNaming(String naming) { @@ -971,6 +977,7 @@ public Map postProcessAllModels(Map objs) CodegenModel cm = mo.getModel(); if (cm.discriminator != null && cm.children != null) { for (CodegenModel child : cm.children) { + // TODO marker5 this.setDiscriminatorValue(child, cm.discriminator.getPropertyName(), this.getDiscriminatorValue(child)); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index 62887e2cf617..085296096a34 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -293,6 +293,52 @@ public String toEnumValue(String value, String datatype) { } } + /** + * Update datatypeWithEnum for array container + * + * @param property Codegen property + */ + protected void updateDataTypeWithEnumForArray(CodegenProperty property) { + CodegenProperty baseItem = property.items; + while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap) + || Boolean.TRUE.equals(baseItem.isArray))) { + baseItem = baseItem.items; + } + if (baseItem != null) { + // set both datatype and datetypeWithEnum as only the inner type is enum + System.out.println("Marker: 1"); + System.out.println("Replace: " + property.datatypeWithEnum + " from " + baseItem.baseType + " to " + toEnumName(baseItem)); + System.out.println("Property info: " + property.isArray + " // " + property.isContainer + " // " + property.isFreeFormObject + " // " + property.isMap); + System.out.println("Property: "+ property.dataType); + System.out.println("Base ITem: " + baseItem.isMap + " // " + baseItem.baseName + " // " + baseItem.containerType + " // " + baseItem.dataType); + System.out.println("Base Type: "+ baseItem.jsonSchema); + System.out.println("Property: "+ property.jsonSchema); + + /* + * Note: There are cases where we have datatypeWithEnum == Array<{ [key: string]: string} + * In these cases, we then have Array <{ [key: EnumName]: EnumName}> - which is invalid typescript + * To protect agains this we first replace [key: string] with a special/reserved placeholder (i.e. *[key]* ) + */ + property.datatypeWithEnum = property.datatypeWithEnum.replace("[key: string]", "*key*") + .replace(baseItem.baseType, toEnumName(baseItem)) + .replace("*key*", "[key: string]"); + + // naming the enum with respect to the language enum naming convention + // e.g. remove [], {} from array/map of enum + property.enumName = toEnumName(property); + + // set default value for variable with inner enum + if (property.defaultValue != null) { + System.out.println("Default Vaule: " + property.defaultValue); + System.out.println("Base Type: " + baseItem.baseType); + System.out.println("Enum Name: "+ toEnumName(baseItem)); + property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); + } + + updateCodegenPropertyEnum(property); + } + } + @Override public ModelsMap postProcessModels(ModelsMap objs) { // process enum in models @@ -303,14 +349,24 @@ public ModelsMap postProcessModels(ModelsMap objs) { // name enum with model name, e.g. StatusEnum => Pet.StatusEnum for (CodegenProperty var : cm.vars) { if (Boolean.TRUE.equals(var.isEnum)) { + System.out.println("Generating data type with enum"); + System.out.println("Enum name before processing (datatype):" + var.dataType); + System.out.println("Enum name before processing (datatypeWenum): " + var.datatypeWithEnum); + String replaceName = var.isInnerEnum ? "Inner" + super.enumSuffix : var.enumName; + System.out.println("Enum data: " + replaceName + " / " + cm.classname + " " + var.enumName); + var.datatypeWithEnum = var.datatypeWithEnum.replace(replaceName, var.enumName); var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName); + System.out.println("Final data type with enum: " + var.datatypeWithEnum); } } if (cm.parent != null) { for (CodegenProperty var : cm.allVars) { if (Boolean.TRUE.equals(var.isEnum)) { - var.datatypeWithEnum = var.datatypeWithEnum + System.out.println("Generating data type with enum"); + System.out.println("Enum data: " + var.enumName + " / " + cm.classname + " " + var.enumName); + var.datatypeWithEnum = var.datatypeWithEnum .replace(var.enumName, cm.classname + var.enumName); + System.out.println("Final data type with enum: " + var.datatypeWithEnum); } } } @@ -422,12 +478,13 @@ public String getTypeDeclaration(Schema p) { if (ModelUtils.isArraySchema(p)) { inner = ((ArraySchema) p).getItems(); return this.getSchemaType(p) + "<" + this.getTypeDeclaration(unaliasSchema(inner)) + ">"; - } else if (ModelUtils.isMapSchema(p)) { - inner = getSchemaAdditionalProperties(p); + } else if (ModelUtils.isMapSchema(p)) { // it is an object schema + inner = getSchemaAdditionalProperties(p); // additional properties? String postfix = ""; if (Boolean.TRUE.equals(inner.getNullable())) { postfix = " | null"; } + System.out.println("[getTypeDeclaration] Inner: "+ inner.toString()); return "{ [key: string]: " + this.getTypeDeclaration(unaliasSchema(inner)) + postfix + "; }"; } else if (ModelUtils.isFileSchema(p)) { return "HttpFile"; 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 25367e89994c..2a996ed8a8b1 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache @@ -79,7 +79,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache index 20782a320a04..73ba27fcbdf7 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache @@ -19,11 +19,17 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ * {{{.}}} */ {{/description}} + // HERE? '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; {{/vars}} {{#discriminator}} static readonly discriminator: string | undefined = "{{discriminatorName}}"; + static readonly discriminatorTypeMap = { + {{#mappedModels}} + "{{mappingName}}": "{{modelName}}"{{^-last}},{{/-last}} + {{/mappedModels}} + } {{/discriminator}} {{^discriminator}} static readonly discriminator: string | undefined = undefined; @@ -35,7 +41,7 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ { "name": "{{name}}", "baseName": "{{baseName}}", - "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}", + "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}} ", "format": "{{dataFormat}}" }{{^-last}}, {{/-last}} @@ -61,9 +67,14 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ this.{{name}} = "{{discriminatorValue}}"; {{/discriminatorValue}} {{/allVars}} - {{#discriminatorName}} + + {{#discriminator}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{#discriminatorName}} this.{{discriminatorName}} = "{{classname}}"; - {{/discriminatorName}} + {{/discriminatorName}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/discriminator}} } } From cd79f5eff9e03d9b0bd5fd8a70adb443ac4a5299 Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Thu, 20 Apr 2023 17:34:24 +0200 Subject: [PATCH 2/5] Remove printlns --- .../openapitools/codegen/DefaultCodegen.java | 6 +----- .../AbstractTypeScriptClientCodegen.java | 5 ----- .../languages/TypeScriptClientCodegen.java | 21 ------------------- .../resources/typescript/model/model.mustache | 1 - 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 1fef0ed65733..a3c1bef3db1c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1648,9 +1648,7 @@ public String toArrayModelParamName(String name) { */ @SuppressWarnings("static-method") public String toEnumName(CodegenProperty property) { - String enumName = StringUtils.capitalize(property.name) + "Enum"; - System.out.println("Default CodeGen: " + enumName); - return enumName; + return StringUtils.capitalize(property.name) + "Enum"; } /** @@ -4142,8 +4140,6 @@ protected void updateDataTypeWithEnumForArray(CodegenProperty property) { } if (baseItem != null) { // set both datatype and datetypeWithEnum as only the inner type is enum - System.out.println("Marker: 1"); - System.out.println("Replace: " + property.datatypeWithEnum + " from " + baseItem.baseType + " to " + toEnumName(baseItem)); property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, toEnumName(baseItem)); // naming the enum with respect to the language enum naming convention diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 404493dd3ba0..b85ed5ae83c7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -604,7 +604,6 @@ public String getTypeDeclaration(Schema p) { } else if (ModelUtils.isMapSchema(p)) { Schema inner = getSchemaAdditionalProperties(p); String nullSafeSuffix = getNullSafeAdditionalProps() ? " | undefined" : ""; - System.out.println("[getTypeDeclaration] Inner: "+ inner.toString()); return "{ [key: string]: " + getTypeDeclaration(unaliasSchema(inner)) + nullSafeSuffix + "; }"; } else if (ModelUtils.isFileSchema(p)) { return "File"; @@ -886,11 +885,8 @@ public String toEnumVarName(String name, String datatype) { @Override public String toEnumName(CodegenProperty property) { String enumName = property.name; - System.out.println("enumName: " + enumName); enumName = addSuffix(enumName, enumSuffix); - System.out.println("enumName with Suffix: " + enumName); String tsName = toTypescriptTypeName(enumName, "_"); - System.out.println("TS Name: " + tsName); return tsName; } @@ -977,7 +973,6 @@ public Map postProcessAllModels(Map objs) CodegenModel cm = mo.getModel(); if (cm.discriminator != null && cm.children != null) { for (CodegenModel child : cm.children) { - // TODO marker5 this.setDiscriminatorValue(child, cm.discriminator.getPropertyName(), this.getDiscriminatorValue(child)); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index 085296096a34..a8d6c3927213 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -305,15 +305,6 @@ protected void updateDataTypeWithEnumForArray(CodegenProperty property) { baseItem = baseItem.items; } if (baseItem != null) { - // set both datatype and datetypeWithEnum as only the inner type is enum - System.out.println("Marker: 1"); - System.out.println("Replace: " + property.datatypeWithEnum + " from " + baseItem.baseType + " to " + toEnumName(baseItem)); - System.out.println("Property info: " + property.isArray + " // " + property.isContainer + " // " + property.isFreeFormObject + " // " + property.isMap); - System.out.println("Property: "+ property.dataType); - System.out.println("Base ITem: " + baseItem.isMap + " // " + baseItem.baseName + " // " + baseItem.containerType + " // " + baseItem.dataType); - System.out.println("Base Type: "+ baseItem.jsonSchema); - System.out.println("Property: "+ property.jsonSchema); - /* * Note: There are cases where we have datatypeWithEnum == Array<{ [key: string]: string} * In these cases, we then have Array <{ [key: EnumName]: EnumName}> - which is invalid typescript @@ -329,9 +320,6 @@ protected void updateDataTypeWithEnumForArray(CodegenProperty property) { // set default value for variable with inner enum if (property.defaultValue != null) { - System.out.println("Default Vaule: " + property.defaultValue); - System.out.println("Base Type: " + baseItem.baseType); - System.out.println("Enum Name: "+ toEnumName(baseItem)); property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); } @@ -349,24 +337,16 @@ public ModelsMap postProcessModels(ModelsMap objs) { // name enum with model name, e.g. StatusEnum => Pet.StatusEnum for (CodegenProperty var : cm.vars) { if (Boolean.TRUE.equals(var.isEnum)) { - System.out.println("Generating data type with enum"); - System.out.println("Enum name before processing (datatype):" + var.dataType); - System.out.println("Enum name before processing (datatypeWenum): " + var.datatypeWithEnum); String replaceName = var.isInnerEnum ? "Inner" + super.enumSuffix : var.enumName; - System.out.println("Enum data: " + replaceName + " / " + cm.classname + " " + var.enumName); var.datatypeWithEnum = var.datatypeWithEnum.replace(replaceName, var.enumName); var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName); - System.out.println("Final data type with enum: " + var.datatypeWithEnum); } } if (cm.parent != null) { for (CodegenProperty var : cm.allVars) { if (Boolean.TRUE.equals(var.isEnum)) { - System.out.println("Generating data type with enum"); - System.out.println("Enum data: " + var.enumName + " / " + cm.classname + " " + var.enumName); var.datatypeWithEnum = var.datatypeWithEnum .replace(var.enumName, cm.classname + var.enumName); - System.out.println("Final data type with enum: " + var.datatypeWithEnum); } } } @@ -484,7 +464,6 @@ public String getTypeDeclaration(Schema p) { if (Boolean.TRUE.equals(inner.getNullable())) { postfix = " | null"; } - System.out.println("[getTypeDeclaration] Inner: "+ inner.toString()); return "{ [key: string]: " + this.getTypeDeclaration(unaliasSchema(inner)) + postfix + "; }"; } else if (ModelUtils.isFileSchema(p)) { return "HttpFile"; diff --git a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache index 73ba27fcbdf7..c5b0cd3785ec 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache @@ -19,7 +19,6 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ * {{{.}}} */ {{/description}} - // HERE? '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; {{/vars}} From 9546218bb89a1e27d4c0fb4ac0ea03cffdfd6836 Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Thu, 20 Apr 2023 17:37:42 +0200 Subject: [PATCH 3/5] Regenerated samples --- .../models/ObjectSerializer.ts | 4 +++- .../builds/with-unique-items/models/Response.ts | 5 +++-- .../builds/browser/models/ApiResponse.ts | 7 ++++--- .../builds/browser/models/Category.ts | 5 +++-- .../builds/browser/models/ObjectSerializer.ts | 4 +++- .../typescript/builds/browser/models/Order.ts | 13 +++++++------ .../typescript/builds/browser/models/Pet.ts | 13 +++++++------ .../typescript/builds/browser/models/Tag.ts | 5 +++-- .../typescript/builds/browser/models/User.ts | 17 +++++++++-------- .../builds/composed-schemas/models/Cat.ts | 5 +++-- .../builds/composed-schemas/models/CatAllOf.ts | 5 +++-- .../builds/composed-schemas/models/Dog.ts | 5 +++-- .../builds/composed-schemas/models/DogAllOf.ts | 5 +++-- .../composed-schemas/models/FilePostRequest.ts | 3 ++- .../composed-schemas/models/ObjectSerializer.ts | 4 +++- .../builds/composed-schemas/models/PetByAge.ts | 5 +++-- .../builds/composed-schemas/models/PetByType.ts | 5 +++-- .../models/PetsFilteredPatchRequest.ts | 9 +++++---- .../composed-schemas/models/PetsPatchRequest.ts | 11 +++++++---- .../builds/default/models/ApiResponse.ts | 7 ++++--- .../builds/default/models/Category.ts | 5 +++-- .../builds/default/models/ObjectSerializer.ts | 4 +++- .../typescript/builds/default/models/Order.ts | 13 +++++++------ .../typescript/builds/default/models/Pet.ts | 13 +++++++------ .../typescript/builds/default/models/Tag.ts | 5 +++-- .../typescript/builds/default/models/User.ts | 17 +++++++++-------- .../builds/deno/models/ApiResponse.ts | 7 ++++--- .../typescript/builds/deno/models/Category.ts | 5 +++-- .../builds/deno/models/ObjectSerializer.ts | 4 +++- .../typescript/builds/deno/models/Order.ts | 13 +++++++------ .../typescript/builds/deno/models/Pet.ts | 13 +++++++------ .../typescript/builds/deno/models/Tag.ts | 5 +++-- .../typescript/builds/deno/models/User.ts | 17 +++++++++-------- .../builds/inversify/models/ApiResponse.ts | 7 ++++--- .../builds/inversify/models/Category.ts | 5 +++-- .../builds/inversify/models/ObjectSerializer.ts | 4 +++- .../typescript/builds/inversify/models/Order.ts | 13 +++++++------ .../typescript/builds/inversify/models/Pet.ts | 13 +++++++------ .../typescript/builds/inversify/models/Tag.ts | 5 +++-- .../typescript/builds/inversify/models/User.ts | 17 +++++++++-------- .../builds/jquery/models/ApiResponse.ts | 7 ++++--- .../typescript/builds/jquery/models/Category.ts | 5 +++-- .../builds/jquery/models/ObjectSerializer.ts | 4 +++- .../typescript/builds/jquery/models/Order.ts | 13 +++++++------ .../typescript/builds/jquery/models/Pet.ts | 13 +++++++------ .../typescript/builds/jquery/models/Tag.ts | 5 +++-- .../typescript/builds/jquery/models/User.ts | 17 +++++++++-------- .../builds/object_params/models/ApiResponse.ts | 7 ++++--- .../builds/object_params/models/Category.ts | 5 +++-- .../object_params/models/ObjectSerializer.ts | 4 +++- .../builds/object_params/models/Order.ts | 13 +++++++------ .../builds/object_params/models/Pet.ts | 13 +++++++------ .../builds/object_params/models/Tag.ts | 5 +++-- .../builds/object_params/models/User.ts | 17 +++++++++-------- 54 files changed, 257 insertions(+), 193 deletions(-) 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 f10b52732140..ee369be5c2e0 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 @@ -51,7 +51,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/client/others/typescript/builds/with-unique-items/models/Response.ts b/samples/client/others/typescript/builds/with-unique-items/models/Response.ts index 6a53fbd9f9d0..d3dcf4059bc1 100644 --- a/samples/client/others/typescript/builds/with-unique-items/models/Response.ts +++ b/samples/client/others/typescript/builds/with-unique-items/models/Response.ts @@ -22,13 +22,13 @@ export class Response { { "name": "nonUniqueArray", "baseName": "non-unique-array", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "uniqueArray", "baseName": "unique-array", - "type": "Set", + "type": "Set ", "format": "" } ]; @@ -37,6 +37,7 @@ export class Response { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts index f4b2d010fb71..48b5493794fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts index 5d63fc87a998..de2e51eec81d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 dfbb605553b0..5ab4695bcd53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts index a2f84555ff1e..bdde3c21f57f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts index b3a7ddb9f719..2adbccd60c5c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts index 8c4f6967b9a1..22efbf3cbf0e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts index 68528ad3c9e0..58fd46589ad0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts index 2790b653b556..ab23c38acd7b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts @@ -22,13 +22,13 @@ export class Cat { { "name": "hunts", "baseName": "hunts", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "age", "baseName": "age", - "type": "number", + "type": "number ", "format": "" } ]; @@ -37,6 +37,7 @@ export class Cat { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts index 049c937cadbc..87fd2a8ff121 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts @@ -22,13 +22,13 @@ export class CatAllOf { { "name": "hunts", "baseName": "hunts", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "age", "baseName": "age", - "type": "number", + "type": "number ", "format": "" } ]; @@ -37,6 +37,7 @@ export class CatAllOf { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts index dd2380572f68..ae0b4b5581fb 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts @@ -22,13 +22,13 @@ export class Dog { { "name": "bark", "baseName": "bark", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "DogBreedEnum", + "type": "DogBreedEnum ", "format": "" } ]; @@ -37,6 +37,7 @@ export class Dog { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts index 5bc68d788891..def2cbf5aaf9 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts @@ -22,13 +22,13 @@ export class DogAllOf { { "name": "bark", "baseName": "bark", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "DogAllOfBreedEnum", + "type": "DogAllOfBreedEnum ", "format": "" } ]; @@ -37,6 +37,7 @@ export class DogAllOf { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts index ddd7a052d56a..6bf1e6bbfc59 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts @@ -21,7 +21,7 @@ export class FilePostRequest { { "name": "file", "baseName": "file", - "type": "any", + "type": "any ", "format": "" } ]; @@ -30,6 +30,7 @@ export class FilePostRequest { } public constructor() { + } } 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 e726b1bbdc33..54af3ae7ea59 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 @@ -80,7 +80,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts index 6c7e3c20f0f4..5f5d4468014f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts @@ -22,13 +22,13 @@ export class PetByAge { { "name": "age", "baseName": "age", - "type": "number", + "type": "number ", "format": "" }, { "name": "nickname", "baseName": "nickname", - "type": "string", + "type": "string ", "format": "" } ]; @@ -37,6 +37,7 @@ export class PetByAge { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts index aef39d9d6018..72d6de4445d5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts @@ -22,13 +22,13 @@ export class PetByType { { "name": "petType", "baseName": "pet_type", - "type": "PetByTypePetTypeEnum", + "type": "PetByTypePetTypeEnum ", "format": "" }, { "name": "hunts", "baseName": "hunts", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -37,6 +37,7 @@ export class PetByType { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts index 12ae18d6b74e..38017bcb5d4e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts @@ -26,25 +26,25 @@ export class PetsFilteredPatchRequest { { "name": "age", "baseName": "age", - "type": "number", + "type": "number ", "format": "" }, { "name": "nickname", "baseName": "nickname", - "type": "string", + "type": "string ", "format": "" }, { "name": "petType", "baseName": "pet_type", - "type": "PetsFilteredPatchRequestPetTypeEnum", + "type": "PetsFilteredPatchRequestPetTypeEnum ", "format": "" }, { "name": "hunts", "baseName": "hunts", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -53,6 +53,7 @@ export class PetsFilteredPatchRequest { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts index c68b69a32965..16c1f35681f9 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts @@ -21,30 +21,32 @@ export class PetsPatchRequest { 'breed'?: PetsPatchRequestBreedEnum; static readonly discriminator: string | undefined = "petType"; + static readonly discriminatorTypeMap = { + } static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ { "name": "hunts", "baseName": "hunts", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "age", "baseName": "age", - "type": "number", + "type": "number ", "format": "" }, { "name": "bark", "baseName": "bark", - "type": "boolean", + "type": "boolean ", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "PetsPatchRequestBreedEnum", + "type": "PetsPatchRequestBreedEnum ", "format": "" } ]; @@ -53,6 +55,7 @@ export class PetsPatchRequest { } public constructor() { + this.petType = "PetsPatchRequest"; } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts index f4b2d010fb71..48b5493794fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts index 5d63fc87a998..de2e51eec81d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 dfbb605553b0..5ab4695bcd53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts index a2f84555ff1e..bdde3c21f57f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts index b3a7ddb9f719..2adbccd60c5c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts index 8c4f6967b9a1..22efbf3cbf0e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts index 68528ad3c9e0..58fd46589ad0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts index b5cfa4948a07..c0f46652e693 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts index 9c1bdd236145..99022f531151 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 0da0325edc80..8aebaab0575f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts index 644657299f36..52a9f499152f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts index 229681feacde..32b5d5a864e5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts index dc2c98212c34..d0b3b750bbf9 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts index 76c6a9ae8692..3f6017bfd3d7 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts index f4b2d010fb71..48b5493794fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts index 5d63fc87a998..de2e51eec81d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 dfbb605553b0..5ab4695bcd53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts index a2f84555ff1e..bdde3c21f57f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts index b3a7ddb9f719..2adbccd60c5c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts index 8c4f6967b9a1..22efbf3cbf0e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts index 68528ad3c9e0..58fd46589ad0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts index f4b2d010fb71..48b5493794fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts index 5d63fc87a998..de2e51eec81d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 dfbb605553b0..5ab4695bcd53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts index a2f84555ff1e..bdde3c21f57f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts index b3a7ddb9f719..2adbccd60c5c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts index 8c4f6967b9a1..22efbf3cbf0e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts index 68528ad3c9e0..58fd46589ad0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts index f4b2d010fb71..48b5493794fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string", + "type": "string ", "format": "" }, { "name": "message", "baseName": "message", - "type": "string", + "type": "string ", "format": "" } ]; @@ -47,6 +47,7 @@ export class ApiResponse { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts index 5d63fc87a998..de2e51eec81d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Category { } public constructor() { + } } 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 dfbb605553b0..5ab4695bcd53 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 @@ -68,7 +68,9 @@ export class ObjectSerializer { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; + var discriminatorValue = data[discriminatorProperty]; + // if it has a mapping we need to map from discriminatorvalue to the actual type name + var discriminatorType = data.discriminatorTypeMap[discriminatorValue] || discriminatorValue; if(typeMap[discriminatorType]){ return discriminatorType; // use the type given in the discriminator } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts index a2f84555ff1e..bdde3c21f57f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number", + "type": "number ", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date", + "type": "Date ", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum", + "type": "OrderStatusEnum ", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean", + "type": "boolean ", "format": "" } ]; @@ -71,6 +71,7 @@ export class Order { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts index b3a7ddb9f719..2adbccd60c5c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category", + "type": "Category ", "format": "" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array", + "type": "Array ", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum", + "type": "PetStatusEnum ", "format": "" } ]; @@ -73,6 +73,7 @@ export class Pet { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts index 8c4f6967b9a1..22efbf3cbf0e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string", + "type": "string ", "format": "" } ]; @@ -40,6 +40,7 @@ export class Tag { } public constructor() { + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts index 68528ad3c9e0..58fd46589ad0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number", + "type": "number ", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string", + "type": "string ", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string", + "type": "string ", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string", + "type": "string ", "format": "" }, { "name": "email", "baseName": "email", - "type": "string", + "type": "string ", "format": "" }, { "name": "password", "baseName": "password", - "type": "string", + "type": "string ", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string", + "type": "string ", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number", + "type": "number ", "format": "int32" } ]; @@ -85,6 +85,7 @@ export class User { } public constructor() { + } } From 6f1d1c008453664de597328909e416b13b44d4fe Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Thu, 20 Apr 2023 20:41:19 +0200 Subject: [PATCH 4/5] Remove space from "type" --- .../resources/typescript/model/model.mustache | 2 +- .../builds/with-unique-items/models/Response.ts | 4 ++-- .../builds/browser/models/ApiResponse.ts | 6 +++--- .../typescript/builds/browser/models/Category.ts | 4 ++-- .../typescript/builds/browser/models/Order.ts | 12 ++++++------ .../typescript/builds/browser/models/Pet.ts | 12 ++++++------ .../typescript/builds/browser/models/Tag.ts | 4 ++-- .../typescript/builds/browser/models/User.ts | 16 ++++++++-------- .../builds/composed-schemas/models/Cat.ts | 4 ++-- .../builds/composed-schemas/models/CatAllOf.ts | 4 ++-- .../builds/composed-schemas/models/Dog.ts | 4 ++-- .../builds/composed-schemas/models/DogAllOf.ts | 4 ++-- .../composed-schemas/models/FilePostRequest.ts | 2 +- .../builds/composed-schemas/models/PetByAge.ts | 4 ++-- .../builds/composed-schemas/models/PetByType.ts | 4 ++-- .../models/PetsFilteredPatchRequest.ts | 8 ++++---- .../composed-schemas/models/PetsPatchRequest.ts | 8 ++++---- .../builds/default/models/ApiResponse.ts | 6 +++--- .../typescript/builds/default/models/Category.ts | 4 ++-- .../typescript/builds/default/models/Order.ts | 12 ++++++------ .../typescript/builds/default/models/Pet.ts | 12 ++++++------ .../typescript/builds/default/models/Tag.ts | 4 ++-- .../typescript/builds/default/models/User.ts | 16 ++++++++-------- .../typescript/builds/deno/models/ApiResponse.ts | 6 +++--- .../typescript/builds/deno/models/Category.ts | 4 ++-- .../typescript/builds/deno/models/Order.ts | 12 ++++++------ .../typescript/builds/deno/models/Pet.ts | 12 ++++++------ .../typescript/builds/deno/models/Tag.ts | 4 ++-- .../typescript/builds/deno/models/User.ts | 16 ++++++++-------- .../builds/inversify/models/ApiResponse.ts | 6 +++--- .../builds/inversify/models/Category.ts | 4 ++-- .../typescript/builds/inversify/models/Order.ts | 12 ++++++------ .../typescript/builds/inversify/models/Pet.ts | 12 ++++++------ .../typescript/builds/inversify/models/Tag.ts | 4 ++-- .../typescript/builds/inversify/models/User.ts | 16 ++++++++-------- .../builds/jquery/models/ApiResponse.ts | 6 +++--- .../typescript/builds/jquery/models/Category.ts | 4 ++-- .../typescript/builds/jquery/models/Order.ts | 12 ++++++------ .../typescript/builds/jquery/models/Pet.ts | 12 ++++++------ .../typescript/builds/jquery/models/Tag.ts | 4 ++-- .../typescript/builds/jquery/models/User.ts | 16 ++++++++-------- .../builds/object_params/models/ApiResponse.ts | 6 +++--- .../builds/object_params/models/Category.ts | 4 ++-- .../builds/object_params/models/Order.ts | 12 ++++++------ .../builds/object_params/models/Pet.ts | 12 ++++++------ .../builds/object_params/models/Tag.ts | 4 ++-- .../builds/object_params/models/User.ts | 16 ++++++++-------- 47 files changed, 186 insertions(+), 186 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache index c5b0cd3785ec..5c42a024183c 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/model.mustache @@ -40,7 +40,7 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ { "name": "{{name}}", "baseName": "{{baseName}}", - "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}} ", + "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}", "format": "{{dataFormat}}" }{{^-last}}, {{/-last}} diff --git a/samples/client/others/typescript/builds/with-unique-items/models/Response.ts b/samples/client/others/typescript/builds/with-unique-items/models/Response.ts index d3dcf4059bc1..463f3f6ae6d3 100644 --- a/samples/client/others/typescript/builds/with-unique-items/models/Response.ts +++ b/samples/client/others/typescript/builds/with-unique-items/models/Response.ts @@ -22,13 +22,13 @@ export class Response { { "name": "nonUniqueArray", "baseName": "non-unique-array", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "uniqueArray", "baseName": "unique-array", - "type": "Set ", + "type": "Set", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts index 48b5493794fa..7d9ec27b6296 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts index de2e51eec81d..bd30cfaf7a4f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts index bdde3c21f57f..c23fd802963c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts index 2adbccd60c5c..00b19ee6beb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts index 22efbf3cbf0e..a534e7af0470 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts index 58fd46589ad0..61ce3dfddf14 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts index ab23c38acd7b..128b9896a07f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Cat.ts @@ -22,13 +22,13 @@ export class Cat { { "name": "hunts", "baseName": "hunts", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "age", "baseName": "age", - "type": "number ", + "type": "number", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts index 87fd2a8ff121..98217152ec94 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/CatAllOf.ts @@ -22,13 +22,13 @@ export class CatAllOf { { "name": "hunts", "baseName": "hunts", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "age", "baseName": "age", - "type": "number ", + "type": "number", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts index ae0b4b5581fb..338344dc9d81 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/Dog.ts @@ -22,13 +22,13 @@ export class Dog { { "name": "bark", "baseName": "bark", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "DogBreedEnum ", + "type": "DogBreedEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts index def2cbf5aaf9..8e2d4e61e7e0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/DogAllOf.ts @@ -22,13 +22,13 @@ export class DogAllOf { { "name": "bark", "baseName": "bark", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "DogAllOfBreedEnum ", + "type": "DogAllOfBreedEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts index 6bf1e6bbfc59..c7ae2946fd37 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts @@ -21,7 +21,7 @@ export class FilePostRequest { { "name": "file", "baseName": "file", - "type": "any ", + "type": "any", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts index 5f5d4468014f..aae1e8f9c93d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByAge.ts @@ -22,13 +22,13 @@ export class PetByAge { { "name": "age", "baseName": "age", - "type": "number ", + "type": "number", "format": "" }, { "name": "nickname", "baseName": "nickname", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts index 72d6de4445d5..e392109b479b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetByType.ts @@ -22,13 +22,13 @@ export class PetByType { { "name": "petType", "baseName": "pet_type", - "type": "PetByTypePetTypeEnum ", + "type": "PetByTypePetTypeEnum", "format": "" }, { "name": "hunts", "baseName": "hunts", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts index 38017bcb5d4e..e339dd763e5f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts @@ -26,25 +26,25 @@ export class PetsFilteredPatchRequest { { "name": "age", "baseName": "age", - "type": "number ", + "type": "number", "format": "" }, { "name": "nickname", "baseName": "nickname", - "type": "string ", + "type": "string", "format": "" }, { "name": "petType", "baseName": "pet_type", - "type": "PetsFilteredPatchRequestPetTypeEnum ", + "type": "PetsFilteredPatchRequestPetTypeEnum", "format": "" }, { "name": "hunts", "baseName": "hunts", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts index 16c1f35681f9..0dc083f81354 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts @@ -28,25 +28,25 @@ export class PetsPatchRequest { { "name": "hunts", "baseName": "hunts", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "age", "baseName": "age", - "type": "number ", + "type": "number", "format": "" }, { "name": "bark", "baseName": "bark", - "type": "boolean ", + "type": "boolean", "format": "" }, { "name": "breed", "baseName": "breed", - "type": "PetsPatchRequestBreedEnum ", + "type": "PetsPatchRequestBreedEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts index 48b5493794fa..7d9ec27b6296 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts index de2e51eec81d..bd30cfaf7a4f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts index bdde3c21f57f..c23fd802963c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts index 2adbccd60c5c..00b19ee6beb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts index 22efbf3cbf0e..a534e7af0470 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts index 58fd46589ad0..61ce3dfddf14 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts index c0f46652e693..da7d8aefb6c6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts index 99022f531151..db70f05c1e56 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts index 52a9f499152f..e2ca32a363e7 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts index 32b5d5a864e5..1f6207cbf1e3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts index d0b3b750bbf9..32abb751d6fa 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts index 3f6017bfd3d7..ae43307df210 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts index 48b5493794fa..7d9ec27b6296 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts index de2e51eec81d..bd30cfaf7a4f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts index bdde3c21f57f..c23fd802963c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts index 2adbccd60c5c..00b19ee6beb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts index 22efbf3cbf0e..a534e7af0470 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts index 58fd46589ad0..61ce3dfddf14 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts index 48b5493794fa..7d9ec27b6296 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts index de2e51eec81d..bd30cfaf7a4f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts index bdde3c21f57f..c23fd802963c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts index 2adbccd60c5c..00b19ee6beb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts index 22efbf3cbf0e..a534e7af0470 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts index 58fd46589ad0..61ce3dfddf14 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts index 48b5493794fa..7d9ec27b6296 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ApiResponse.ts @@ -26,19 +26,19 @@ export class ApiResponse { { "name": "code", "baseName": "code", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "type", "baseName": "type", - "type": "string ", + "type": "string", "format": "" }, { "name": "message", "baseName": "message", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts index de2e51eec81d..bd30cfaf7a4f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Category.ts @@ -25,13 +25,13 @@ export class Category { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts index bdde3c21f57f..c23fd802963c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Order.ts @@ -32,37 +32,37 @@ export class Order { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "petId", "baseName": "petId", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "quantity", "baseName": "quantity", - "type": "number ", + "type": "number", "format": "int32" }, { "name": "shipDate", "baseName": "shipDate", - "type": "Date ", + "type": "Date", "format": "date-time" }, { "name": "status", "baseName": "status", - "type": "OrderStatusEnum ", + "type": "OrderStatusEnum", "format": "" }, { "name": "complete", "baseName": "complete", - "type": "boolean ", + "type": "boolean", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts index 2adbccd60c5c..00b19ee6beb1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Pet.ts @@ -34,37 +34,37 @@ export class Pet { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "category", "baseName": "category", - "type": "Category ", + "type": "Category", "format": "" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" }, { "name": "photoUrls", "baseName": "photoUrls", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "tags", "baseName": "tags", - "type": "Array ", + "type": "Array", "format": "" }, { "name": "status", "baseName": "status", - "type": "PetStatusEnum ", + "type": "PetStatusEnum", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts index 22efbf3cbf0e..a534e7af0470 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/Tag.ts @@ -25,13 +25,13 @@ export class Tag { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "name", "baseName": "name", - "type": "string ", + "type": "string", "format": "" } ]; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts index 58fd46589ad0..61ce3dfddf14 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/User.ts @@ -34,49 +34,49 @@ export class User { { "name": "id", "baseName": "id", - "type": "number ", + "type": "number", "format": "int64" }, { "name": "username", "baseName": "username", - "type": "string ", + "type": "string", "format": "" }, { "name": "firstName", "baseName": "firstName", - "type": "string ", + "type": "string", "format": "" }, { "name": "lastName", "baseName": "lastName", - "type": "string ", + "type": "string", "format": "" }, { "name": "email", "baseName": "email", - "type": "string ", + "type": "string", "format": "" }, { "name": "password", "baseName": "password", - "type": "string ", + "type": "string", "format": "" }, { "name": "phone", "baseName": "phone", - "type": "string ", + "type": "string", "format": "" }, { "name": "userStatus", "baseName": "userStatus", - "type": "number ", + "type": "number", "format": "int32" } ]; From 4f788e7ae79db38b4c4a2a009c5304d0dffecdc5 Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Sat, 29 Apr 2023 08:44:23 +0200 Subject: [PATCH 5/5] Extract enum type fix to abstract client codegen --- .../AbstractTypeScriptClientCodegen.java | 34 +++++++++++++++++++ .../languages/TypeScriptClientCodegen.java | 34 ------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index b85ed5ae83c7..c27f1414b82f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -964,6 +964,40 @@ public ModelsMap postProcessModels(ModelsMap objs) { return objs; } + /** + * Update datatypeWithEnum for array container + * + * @param property Codegen property + */ + protected void updateDataTypeWithEnumForArray(CodegenProperty property) { + CodegenProperty baseItem = property.items; + while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap) + || Boolean.TRUE.equals(baseItem.isArray))) { + baseItem = baseItem.items; + } + if (baseItem != null) { + /* + * Note: There are cases where we have datatypeWithEnum == Array<{ [key: string]: string} + * In these cases, we then have Array <{ [key: EnumName]: EnumName}> - which is invalid typescript + * To protect agains this we first replace [key: string] with a special/reserved placeholder (i.e. *[key]* ) + */ + property.datatypeWithEnum = property.datatypeWithEnum.replace("[key: string]", "*PLACEHOLDER*") + .replace(baseItem.baseType, toEnumName(baseItem)) + .replace("*PLACEHOLDER*", "[key: string]"); + + // naming the enum with respect to the language enum naming convention + // e.g. remove [], {} from array/map of enum + property.enumName = toEnumName(property); + + // set default value for variable with inner enum + if (property.defaultValue != null) { + property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); + } + + updateCodegenPropertyEnum(property); + } + } + @Override public Map postProcessAllModels(Map objs) { Map result = super.postProcessAllModels(objs); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index a8d6c3927213..d52a98007e55 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -293,40 +293,6 @@ public String toEnumValue(String value, String datatype) { } } - /** - * Update datatypeWithEnum for array container - * - * @param property Codegen property - */ - protected void updateDataTypeWithEnumForArray(CodegenProperty property) { - CodegenProperty baseItem = property.items; - while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap) - || Boolean.TRUE.equals(baseItem.isArray))) { - baseItem = baseItem.items; - } - if (baseItem != null) { - /* - * Note: There are cases where we have datatypeWithEnum == Array<{ [key: string]: string} - * In these cases, we then have Array <{ [key: EnumName]: EnumName}> - which is invalid typescript - * To protect agains this we first replace [key: string] with a special/reserved placeholder (i.e. *[key]* ) - */ - property.datatypeWithEnum = property.datatypeWithEnum.replace("[key: string]", "*key*") - .replace(baseItem.baseType, toEnumName(baseItem)) - .replace("*key*", "[key: string]"); - - // naming the enum with respect to the language enum naming convention - // e.g. remove [], {} from array/map of enum - property.enumName = toEnumName(property); - - // set default value for variable with inner enum - if (property.defaultValue != null) { - property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); - } - - updateCodegenPropertyEnum(property); - } - } - @Override public ModelsMap postProcessModels(ModelsMap objs) { // process enum in models