From 5031ecae66267ac6649f8c78132c2e90bb2a64b5 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Thu, 11 Jan 2018 15:02:55 +0100 Subject: [PATCH 01/11] #7365: use enums string / number literals for request parameter if it is an enum --- .../TypeScriptAngularClientCodegen.java | 74 +++++++++++++++++-- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 71eabaa4fad..3e82d08c36f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -17,12 +17,7 @@ import io.swagger.codegen.SupportingFile; import io.swagger.codegen.utils.SemVer; import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.FileProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.Property; +import io.swagger.models.properties.*; public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen { private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); @@ -174,9 +169,72 @@ public String getTypeDeclaration(Property p) { return "Blob"; } else if (p instanceof ObjectProperty) { return "any"; - } else { - return super.getTypeDeclaration(p); + } else if (p instanceof StringProperty) { + // Handle string enums + StringProperty sp = (StringProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof IntegerProperty) { + // Handle integer enums + IntegerProperty sp = (IntegerProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof LongProperty) { + // Handle integer enums + LongProperty sp = (LongProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DoubleProperty) { + // Handle integer enums + DoubleProperty sp = (DoubleProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof FloatProperty) { + // Handle integer enums + FloatProperty sp = (FloatProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DateProperty) { + // Handle integer enums + DateProperty sp = (DateProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof DateTimeProperty) { + // Handle integer enums + DateTimeProperty sp = (DateTimeProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } + + return super.getTypeDeclaration(p); + } + + private String enumValuesToEnumTypeUnion(List values, String dataType) { + StringBuilder b = new StringBuilder(); + boolean isFirst = true; + for (String value: values) { + if (!isFirst) { + b.append(" | "); + } + b.append(toEnumValue(value.toString(), dataType)); + isFirst = false; + } + return b.toString(); + } + + private String numericEnumValuesToEnumTypeUnion(List values) { + List stringValues = new ArrayList<>(); + for (Object value: values) { + stringValues.add(value.toString()); } + return enumValuesToEnumTypeUnion(stringValues, "number"); } @Override From e78434dd42cef797415a33e7a705ba03687dc9db Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Thu, 11 Jan 2018 15:04:25 +0100 Subject: [PATCH 02/11] #7365: use enums string / number literals for request parameter if it is an enum --- .../languages/TypeScriptAngularClientCodegen.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 3e82d08c36f..360ed702102 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -182,31 +182,31 @@ public String getTypeDeclaration(Property p) { return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof LongProperty) { - // Handle integer enums + // Handle long enums LongProperty sp = (LongProperty) p; if (sp.getEnum() != null) { return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof DoubleProperty) { - // Handle integer enums + // Handle double enums DoubleProperty sp = (DoubleProperty) p; if (sp.getEnum() != null) { return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof FloatProperty) { - // Handle integer enums + // Handle float enums FloatProperty sp = (FloatProperty) p; if (sp.getEnum() != null) { return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof DateProperty) { - // Handle integer enums + // Handle date enums DateProperty sp = (DateProperty) p; if (sp.getEnum() != null) { return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); } } else if (p instanceof DateTimeProperty) { - // Handle integer enums + // Handle datetime enums DateTimeProperty sp = (DateTimeProperty) p; if (sp.getEnum() != null) { return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); From f57b9b7128b45642862a87eb9920611dce818533 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Thu, 11 Jan 2018 15:05:33 +0100 Subject: [PATCH 03/11] #7365: use enums string / number literals for request parameter if it is an enum --- .../default/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v2/default/api/pet.service.ts | 4 ++-- .../typescript-angular-v2/npm/.swagger-codegen/VERSION | 2 +- .../petstore/typescript-angular-v2/npm/api/pet.service.ts | 4 ++-- .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../with-interfaces/api/pet.service.ts | 4 ++-- .../with-interfaces/api/pet.serviceInterface.ts | 2 +- .../typescript-angular-v4.3/npm/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v4.3/npm/api/pet.service.ts | 8 ++++---- .../typescript-angular-v4/npm/.swagger-codegen/VERSION | 2 +- .../petstore/typescript-angular-v4/npm/api/pet.service.ts | 4 ++-- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION index cc6612c36e0..50794f17f1a 100644 --- a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts index 3f5b8fd227e..30354b57437 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts @@ -96,7 +96,7 @@ export class PetService { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -305,7 +305,7 @@ export class PetService { * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION index cc6612c36e0..50794f17f1a 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts index 3f5b8fd227e..30354b57437 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts @@ -96,7 +96,7 @@ export class PetService { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -305,7 +305,7 @@ export class PetService { * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION index cc6612c36e0..50794f17f1a 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts index 5f5d730060c..565e6d3dbe4 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts @@ -97,7 +97,7 @@ export class PetService implements PetServiceInterface { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -306,7 +306,7 @@ export class PetService implements PetServiceInterface { * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts index 968ed61c846..160b06ffaca 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.serviceInterface.ts @@ -42,7 +42,7 @@ export interface PetServiceInterface { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable>; + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: any): Observable>; /** * Finds Pets by tags diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION index cc6612c36e0..50794f17f1a 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts index 40fb7221bd3..5dc987751bc 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts @@ -173,10 +173,10 @@ export class PetService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public findPetsByStatus(status: Array, observe?: 'body', reportProgress?: boolean): Observable>; - public findPetsByStatus(status: Array, observe?: 'response', reportProgress?: boolean): Observable>>; - public findPetsByStatus(status: Array, observe?: 'events', reportProgress?: boolean): Observable>>; - public findPetsByStatus(status: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable>; + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable>>; + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable>>; + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION index cc6612c36e0..50794f17f1a 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts index 3f5b8fd227e..30354b57437 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts @@ -96,7 +96,7 @@ export class PetService { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -305,7 +305,7 @@ export class PetService { * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } From fd5cf82368e3913edb4c25fc0a6fda257a55962a Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Thu, 11 Jan 2018 15:14:29 +0100 Subject: [PATCH 04/11] #7365: improve docs --- .../TypeScriptAngularClientCodegen.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 360ed702102..0e93ba88f7b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -179,25 +179,25 @@ public String getTypeDeclaration(Property p) { // Handle integer enums IntegerProperty sp = (IntegerProperty) p; if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof LongProperty) { // Handle long enums LongProperty sp = (LongProperty) p; if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof DoubleProperty) { // Handle double enums DoubleProperty sp = (DoubleProperty) p; if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof FloatProperty) { // Handle float enums FloatProperty sp = (FloatProperty) p; if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); } } else if (p instanceof DateProperty) { // Handle date enums @@ -216,6 +216,14 @@ public String getTypeDeclaration(Property p) { return super.getTypeDeclaration(p); } + /** + * Converts a list of strings to a literal union for representing enum values as a type. + * Example: 'available' | 'pending' | 'sold' + * + * @param values list of allowed enum values + * @param dataType either "string" or "number" + * @return + */ private String enumValuesToEnumTypeUnion(List values, String dataType) { StringBuilder b = new StringBuilder(); boolean isFirst = true; @@ -229,7 +237,14 @@ private String enumValuesToEnumTypeUnion(List values, String dataType) { return b.toString(); } - private String numericEnumValuesToEnumTypeUnion(List values) { + /** + * Converts a list of numbers to a literal union for representing enum values as a type. + * Example: 3 | 9 | 55 + * + * @param values + * @return + */ + private String numericEnumValuesToEnumTypeUnion(List values) { List stringValues = new ArrayList<>(); for (Object value: values) { stringValues.add(value.toString()); From e03f389665b7470a0c16114e70e499dab621ef21 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 12:23:04 +0100 Subject: [PATCH 05/11] #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion() --- .../AbstractTypeScriptClientCodegen.java | 86 +++++++++++++++-- .../TypeScriptAngularClientCodegen.java | 92 +------------------ 2 files changed, 83 insertions(+), 95 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 273cdb5583e..5321120d917 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -3,12 +3,7 @@ import org.apache.commons.lang3.StringUtils; import java.io.File; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; +import java.util.*; import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; @@ -230,10 +225,89 @@ public String getTypeDeclaration(Property p) { return "{ [key: string]: "+ getTypeDeclaration(inner) + "; }"; } else if (p instanceof FileProperty) { return "any"; + } else if (p instanceof StringProperty) { + // Handle string enums + StringProperty sp = (StringProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof IntegerProperty) { + // Handle integer enums + IntegerProperty sp = (IntegerProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof LongProperty) { + // Handle long enums + LongProperty sp = (LongProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DoubleProperty) { + // Handle double enums + DoubleProperty sp = (DoubleProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof FloatProperty) { + // Handle float enums + FloatProperty sp = (FloatProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DateProperty) { + // Handle date enums + DateProperty sp = (DateProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof DateTimeProperty) { + // Handle datetime enums + DateTimeProperty sp = (DateTimeProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } } return super.getTypeDeclaration(p); } + + /** + * Converts a list of strings to a literal union for representing enum values as a type. + * Example output: 'available' | 'pending' | 'sold' + * + * @param values list of allowed enum values + * @param dataType either "string" or "number" + * @return + */ + protected String enumValuesToEnumTypeUnion(List values, String dataType) { + StringBuilder b = new StringBuilder(); + boolean isFirst = true; + for (String value: values) { + if (!isFirst) { + b.append(" | "); + } + b.append(toEnumValue(value.toString(), dataType)); + isFirst = false; + } + return b.toString(); + } + + /** + * Converts a list of numbers to a literal union for representing enum values as a type. + * Example output: 3 | 9 | 55 + * + * @param values + * @return + */ + protected String numericEnumValuesToEnumTypeUnion(List values) { + List stringValues = new ArrayList<>(); + for (Number value: values) { + stringValues.add(value.toString()); + } + return enumValuesToEnumTypeUnion(stringValues, "number"); + } + @Override public String toDefaultValue(Property p) { if (p instanceof StringProperty) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 0e93ba88f7b..0302382921e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -156,101 +156,15 @@ public boolean isDataTypeFile(final String dataType) { @Override public String getTypeDeclaration(Property p) { - Property inner; - if (p instanceof ArrayProperty) { - ArrayProperty mp1 = (ArrayProperty) p; - inner = mp1.getItems(); - return this.getSwaggerType(p) + "<" + this.getTypeDeclaration(inner) + ">"; - } else if (p instanceof MapProperty) { - MapProperty mp = (MapProperty) p; - inner = mp.getAdditionalProperties(); - return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; - } else if (p instanceof FileProperty) { + if (p instanceof FileProperty) { return "Blob"; } else if (p instanceof ObjectProperty) { return "any"; - } else if (p instanceof StringProperty) { - // Handle string enums - StringProperty sp = (StringProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } - } else if (p instanceof IntegerProperty) { - // Handle integer enums - IntegerProperty sp = (IntegerProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof LongProperty) { - // Handle long enums - LongProperty sp = (LongProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof DoubleProperty) { - // Handle double enums - DoubleProperty sp = (DoubleProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof FloatProperty) { - // Handle float enums - FloatProperty sp = (FloatProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof DateProperty) { - // Handle date enums - DateProperty sp = (DateProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } - } else if (p instanceof DateTimeProperty) { - // Handle datetime enums - DateTimeProperty sp = (DateTimeProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } - } - - return super.getTypeDeclaration(p); - } - - /** - * Converts a list of strings to a literal union for representing enum values as a type. - * Example: 'available' | 'pending' | 'sold' - * - * @param values list of allowed enum values - * @param dataType either "string" or "number" - * @return - */ - private String enumValuesToEnumTypeUnion(List values, String dataType) { - StringBuilder b = new StringBuilder(); - boolean isFirst = true; - for (String value: values) { - if (!isFirst) { - b.append(" | "); - } - b.append(toEnumValue(value.toString(), dataType)); - isFirst = false; + } else { + return super.getTypeDeclaration(p); } - return b.toString(); } - /** - * Converts a list of numbers to a literal union for representing enum values as a type. - * Example: 3 | 9 | 55 - * - * @param values - * @return - */ - private String numericEnumValuesToEnumTypeUnion(List values) { - List stringValues = new ArrayList<>(); - for (Object value: values) { - stringValues.add(value.toString()); - } - return enumValuesToEnumTypeUnion(stringValues, "number"); - } @Override public String getSwaggerType(Property p) { From 1db9a77f323cfa51e1c41f305662df6fa7066443 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 16:40:34 +0100 Subject: [PATCH 06/11] #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion() --- .../codegen/typescript/fetch/TypeScriptFetchModelTest.java | 6 +++--- .../typescript-angular-v2/default/.swagger-codegen/VERSION | 2 +- .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v4.3/npm/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v4/npm/.swagger-codegen/VERSION | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java index a7f38c02043..5a5252cb48f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java @@ -202,7 +202,7 @@ public void enumArrayMdoelTest() { Property property = definition.getProperties().get("array_enum"); CodegenProperty prope = codegen.fromProperty("array_enum", property); codegen.updateCodegenPropertyEnum(prope); - Assert.assertEquals(prope.datatypeWithEnum, "Array"); + // Assert.assertEquals(prope.datatypeWithEnum, "Array"); Assert.assertEquals(prope.enumName, "ArrayEnumEnum"); Assert.assertTrue(prope.isEnum); Assert.assertEquals(prope.allowableValues.get("values"), Arrays.asList("fish", "crab")); @@ -216,7 +216,7 @@ public void enumArrayMdoelTest() { Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(fish, crab)); // assert inner items - Assert.assertEquals(prope.datatypeWithEnum, "Array"); + // Assert.assertEquals(prope.datatypeWithEnum, "Array"); Assert.assertEquals(prope.enumName, "ArrayEnumEnum"); Assert.assertTrue(prope.items.isEnum); Assert.assertEquals(prope.items.allowableValues.get("values"), Arrays.asList("fish", "crab")); @@ -249,7 +249,7 @@ public void enumMdoelValueTest() { HashMap minusOne = new HashMap(); minusOne.put("name", "NUMBER_MINUS_1"); minusOne.put("value", "-1"); - Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(one, minusOne)); + // Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(one, minusOne)); //IMPORTANT: these are not final enum values, which may be further updated //by postProcessModels diff --git a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION index 50794f17f1a..a6254504e40 100644 --- a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION index 50794f17f1a..a6254504e40 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION index 50794f17f1a..a6254504e40 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION index 50794f17f1a..a6254504e40 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file From b5876d5d171ccca20a5908a8e6c5c4abe7b31baf Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 18:42:19 +0100 Subject: [PATCH 07/11] #7365: allow parameter data type customizations --- .../io/swagger/codegen/DefaultCodegen.java | 19 +++++- .../AbstractTypeScriptClientCodegen.java | 58 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 605e33c2112..dfffa31a341 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -2508,7 +2508,12 @@ public CodegenParameter fromParameter(Parameter param, Set imports) { // set boolean flag (e.g. isString) setParameterBooleanFlagWithCodegenProperty(p, cp); - p.dataType = cp.datatype; + String parameterDataType = this.getParameterDataType(param, property); + if (parameterDataType != null) { + p.dataType = parameterDataType; + } else { + p.dataType = cp.datatype; + } p.dataFormat = cp.dataFormat; if(cp.isEnum) { p.datatypeWithEnum = cp.datatypeWithEnum; @@ -2719,6 +2724,18 @@ public CodegenParameter fromParameter(Parameter param, Set imports) { return p; } + /** + * Returns the data type of a parameter. + * Returns null by default to use the CodegenProperty.datatype value + * @param parameter + * @param property + * @return + */ + protected String getParameterDataType(Parameter parameter, Property property) { + return null; + } + + public boolean isDataTypeBinary(String dataType) { if (dataType != null) { return dataType.toLowerCase().startsWith("byte"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 5321120d917..730e65558b8 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -1,5 +1,6 @@ package io.swagger.codegen.languages; +import io.swagger.models.parameters.Parameter; import org.apache.commons.lang3.StringUtils; import java.io.File; @@ -272,6 +273,63 @@ public String getTypeDeclaration(Property p) { } + @Override + protected String getParameterDataType(Parameter parameter, Property p) { + Property inner; + if (p instanceof ArrayProperty) { + ArrayProperty mp1 = (ArrayProperty) p; + inner = mp1.getItems(); + return this.getSwaggerType(p) + "<" + this.getParameterDataType(parameter, inner) + ">"; + } else if (p instanceof MapProperty) { + MapProperty mp = (MapProperty) p; + inner = mp.getAdditionalProperties(); + return "{ [key: string]: " + this.getParameterDataType(parameter, inner) + "; }"; + } else if (p instanceof StringProperty) { + // Handle string enums + StringProperty sp = (StringProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof IntegerProperty) { + // Handle integer enums + IntegerProperty sp = (IntegerProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof LongProperty) { + // Handle long enums + LongProperty sp = (LongProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DoubleProperty) { + // Handle double enums + DoubleProperty sp = (DoubleProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof FloatProperty) { + // Handle float enums + FloatProperty sp = (FloatProperty) p; + if (sp.getEnum() != null) { + return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); + } + } else if (p instanceof DateProperty) { + // Handle date enums + DateProperty sp = (DateProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } else if (p instanceof DateTimeProperty) { + // Handle datetime enums + DateTimeProperty sp = (DateTimeProperty) p; + if (sp.getEnum() != null) { + return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); + } + } + return this.getTypeDeclaration(p); + } + /** * Converts a list of strings to a literal union for representing enum values as a type. * Example output: 'available' | 'pending' | 'sold' From daeec14eabf6d82f8a78edc5ad6cac43c1fe0eb4 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 18:43:07 +0100 Subject: [PATCH 08/11] #7365: re-enable disabled unit test assertions --- .../codegen/typescript/fetch/TypeScriptFetchModelTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java index 5a5252cb48f..8a83bbbfe8f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java @@ -216,7 +216,7 @@ public void enumArrayMdoelTest() { Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(fish, crab)); // assert inner items - // Assert.assertEquals(prope.datatypeWithEnum, "Array"); + Assert.assertEquals(prope.datatypeWithEnum, "Array"); Assert.assertEquals(prope.enumName, "ArrayEnumEnum"); Assert.assertTrue(prope.items.isEnum); Assert.assertEquals(prope.items.allowableValues.get("values"), Arrays.asList("fish", "crab")); @@ -249,7 +249,7 @@ public void enumMdoelValueTest() { HashMap minusOne = new HashMap(); minusOne.put("name", "NUMBER_MINUS_1"); minusOne.put("value", "-1"); - // Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(one, minusOne)); + Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(one, minusOne)); //IMPORTANT: these are not final enum values, which may be further updated //by postProcessModels From 307df191b9ec5f386efb6ab02114267ded47139f Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 19:12:19 +0100 Subject: [PATCH 09/11] #7365: remove enum handling from type declaration generation --- .../AbstractTypeScriptClientCodegen.java | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 730e65558b8..d676f4a342c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -226,48 +226,6 @@ public String getTypeDeclaration(Property p) { return "{ [key: string]: "+ getTypeDeclaration(inner) + "; }"; } else if (p instanceof FileProperty) { return "any"; - } else if (p instanceof StringProperty) { - // Handle string enums - StringProperty sp = (StringProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } - } else if (p instanceof IntegerProperty) { - // Handle integer enums - IntegerProperty sp = (IntegerProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof LongProperty) { - // Handle long enums - LongProperty sp = (LongProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof DoubleProperty) { - // Handle double enums - DoubleProperty sp = (DoubleProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof FloatProperty) { - // Handle float enums - FloatProperty sp = (FloatProperty) p; - if (sp.getEnum() != null) { - return numericEnumValuesToEnumTypeUnion(new ArrayList(sp.getEnum())); - } - } else if (p instanceof DateProperty) { - // Handle date enums - DateProperty sp = (DateProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } - } else if (p instanceof DateTimeProperty) { - // Handle datetime enums - DateTimeProperty sp = (DateTimeProperty) p; - if (sp.getEnum() != null) { - return enumValuesToEnumTypeUnion(sp.getEnum(), "string"); - } } return super.getTypeDeclaration(p); } @@ -275,6 +233,7 @@ public String getTypeDeclaration(Property p) { @Override protected String getParameterDataType(Parameter parameter, Property p) { + // handle enums of various data types Property inner; if (p instanceof ArrayProperty) { ArrayProperty mp1 = (ArrayProperty) p; From 93d8273befc53bbf9ca370f1359ddb124409f45f Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Wed, 17 Jan 2018 19:35:03 +0100 Subject: [PATCH 10/11] #7365: generate all typescript samples --- .../npm/.swagger-codegen/VERSION | 2 +- .../.swagger-codegen/VERSION | 2 +- .../typescript-angularjs/api/PetApi.ts | 18 +++++++++--------- .../typescript-angularjs/api/StoreApi.ts | 8 ++++---- .../typescript-angularjs/api/UserApi.ts | 16 ++++++++-------- .../default/.swagger-codegen/VERSION | 2 +- .../typescript-aurelia/default/PetApi.ts | 3 ++- .../builds/default/.swagger-codegen/VERSION | 2 +- .../typescript-fetch/builds/default/api.ts | 14 +++++++------- .../builds/es6-target/.swagger-codegen/VERSION | 2 +- .../typescript-fetch/builds/es6-target/api.ts | 14 +++++++------- .../with-npm-version/.swagger-codegen/VERSION | 2 +- .../builds/with-npm-version/api.ts | 14 +++++++------- .../default/.swagger-codegen/VERSION | 2 +- .../typescript-jquery/default/api/PetApi.ts | 2 +- .../npm/.swagger-codegen/VERSION | 2 +- .../petstore/typescript-jquery/npm/README.md | 4 ++-- .../typescript-jquery/npm/api/PetApi.ts | 2 +- .../typescript-jquery/npm/package.json | 4 ++-- .../default/.swagger-codegen/VERSION | 2 +- .../petstore/typescript-node/default/api.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../client/petstore/typescript-node/npm/api.ts | 4 ++-- 23 files changed, 64 insertions(+), 63 deletions(-) diff --git a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION index 50794f17f1a..a6254504e40 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angularjs/api/PetApi.ts b/samples/client/petstore/typescript-angularjs/api/PetApi.ts index 1db89920e73..8991c0b3862 100644 --- a/samples/client/petstore/typescript-angularjs/api/PetApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/PetApi.ts @@ -45,7 +45,7 @@ export class PetApi { method: 'POST', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -77,7 +77,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'DELETE', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -92,7 +92,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus (status: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { + public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const localVarPath = this.basePath + '/pet/findByStatus'; let queryParameters: any = {}; @@ -109,7 +109,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -141,7 +141,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -170,7 +170,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -199,7 +199,7 @@ export class PetApi { method: 'PUT', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -238,7 +238,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, - data: this.$httpParamSerializer(formParams), + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; @@ -278,7 +278,7 @@ export class PetApi { let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, - data: this.$httpParamSerializer(formParams), + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angularjs/api/StoreApi.ts b/samples/client/petstore/typescript-angularjs/api/StoreApi.ts index 1d26cfa0312..6ac29c56660 100644 --- a/samples/client/petstore/typescript-angularjs/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/StoreApi.ts @@ -45,7 +45,7 @@ export class StoreApi { let httpRequestParams: ng.IRequestConfig = { method: 'DELETE', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -67,7 +67,7 @@ export class StoreApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -96,7 +96,7 @@ export class StoreApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -125,7 +125,7 @@ export class StoreApi { method: 'POST', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angularjs/api/UserApi.ts b/samples/client/petstore/typescript-angularjs/api/UserApi.ts index 091ad8b5dca..d846cf25afc 100644 --- a/samples/client/petstore/typescript-angularjs/api/UserApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/UserApi.ts @@ -45,7 +45,7 @@ export class UserApi { method: 'POST', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -74,7 +74,7 @@ export class UserApi { method: 'POST', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -103,7 +103,7 @@ export class UserApi { method: 'POST', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -132,7 +132,7 @@ export class UserApi { let httpRequestParams: ng.IRequestConfig = { method: 'DELETE', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -161,7 +161,7 @@ export class UserApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -203,7 +203,7 @@ export class UserApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -225,7 +225,7 @@ export class UserApi { let httpRequestParams: ng.IRequestConfig = { method: 'GET', url: localVarPath, - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -261,7 +261,7 @@ export class UserApi { method: 'PUT', url: localVarPath, data: body, - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-aurelia/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-aurelia/default/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-aurelia/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-aurelia/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-aurelia/default/PetApi.ts b/samples/client/petstore/typescript-aurelia/default/PetApi.ts index 2d0cf2d84f1..446d3171854 100644 --- a/samples/client/petstore/typescript-aurelia/default/PetApi.ts +++ b/samples/client/petstore/typescript-aurelia/default/PetApi.ts @@ -19,6 +19,7 @@ import { any, Pet, ApiResponse, + Array<'available' | 'pending' | 'sold'>, } from './models'; /** @@ -40,7 +41,7 @@ export interface IDeletePetParams { * findPetsByStatus - parameters interface */ export interface IFindPetsByStatusParams { - status: Array; + status: Array<'available' | 'pending' | 'sold'>; } /** diff --git a/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/default/api.ts b/samples/client/petstore/typescript-fetch/builds/default/api.ts index 74b5bd4f72e..72e705621fa 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/api.ts @@ -414,11 +414,11 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options: any = {}): FetchArgs { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): FetchArgs { // verify required parameter 'status' is not null or undefined if (status === null || status === undefined) { throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); @@ -726,11 +726,11 @@ export const PetApiFp = function(configuration?: Configuration) { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { const localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { @@ -874,11 +874,11 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any) { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(configuration).findPetsByStatus(status, options)(fetch, basePath); }, /** @@ -978,7 +978,7 @@ export class PetApi extends BaseAPI { * @throws {RequiredError} * @memberof PetApi */ - public findPetsByStatus(status: Array, options?: any) { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts index 74b5bd4f72e..72e705621fa 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts @@ -414,11 +414,11 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options: any = {}): FetchArgs { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): FetchArgs { // verify required parameter 'status' is not null or undefined if (status === null || status === undefined) { throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); @@ -726,11 +726,11 @@ export const PetApiFp = function(configuration?: Configuration) { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { const localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { @@ -874,11 +874,11 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any) { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(configuration).findPetsByStatus(status, options)(fetch, basePath); }, /** @@ -978,7 +978,7 @@ export class PetApi extends BaseAPI { * @throws {RequiredError} * @memberof PetApi */ - public findPetsByStatus(status: Array, options?: any) { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts index 74b5bd4f72e..72e705621fa 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts @@ -414,11 +414,11 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options: any = {}): FetchArgs { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): FetchArgs { // verify required parameter 'status' is not null or undefined if (status === null || status === undefined) { throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); @@ -726,11 +726,11 @@ export const PetApiFp = function(configuration?: Configuration) { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { const localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { @@ -874,11 +874,11 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {Array<string>} status Status values that need to be considered for filter + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findPetsByStatus(status: Array, options?: any) { + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(configuration).findPetsByStatus(status, options)(fetch, basePath); }, /** @@ -978,7 +978,7 @@ export class PetApi extends BaseAPI { * @throws {RequiredError} * @memberof PetApi */ - public findPetsByStatus(status: Array, options?: any) { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath); } diff --git a/samples/client/petstore/typescript-jquery/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-jquery/default/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-jquery/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-jquery/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-jquery/default/api/PetApi.ts b/samples/client/petstore/typescript-jquery/default/api/PetApi.ts index 7c893cfe242..6d404cda5f7 100644 --- a/samples/client/petstore/typescript-jquery/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-jquery/default/api/PetApi.ts @@ -171,7 +171,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array): JQueryPromise<{ response: JQueryXHR; body: Array; }> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>): JQueryPromise<{ response: JQueryXHR; body: Array; }> { let localVarPath = this.basePath + '/pet/findByStatus'; let queryParameters: any = {}; diff --git a/samples/client/petstore/typescript-jquery/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-jquery/npm/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-jquery/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-jquery/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-jquery/npm/README.md b/samples/client/petstore/typescript-jquery/npm/README.md index 6b1105e1d49..112a6835205 100644 --- a/samples/client/petstore/typescript-jquery/npm/README.md +++ b/samples/client/petstore/typescript-jquery/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/jquery-typescript-petstore@0.0.1 +## @swagger/angular2-typescript-petstore@0.0.1 This generator creates TypeScript/JavaScript client that utilizes [jQuery](https://jquery.com/). The generated Node module can be used in the following environments: @@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co _published:_ ``` -npm install @swagger/jquery-typescript-petstore@0.0.1 --save +npm install @swagger/angular2-typescript-petstore@0.0.1 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts b/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts index 7c893cfe242..6d404cda5f7 100644 --- a/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts @@ -171,7 +171,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array): JQueryPromise<{ response: JQueryXHR; body: Array; }> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>): JQueryPromise<{ response: JQueryXHR; body: Array; }> { let localVarPath = this.basePath + '/pet/findByStatus'; let queryParameters: any = {}; diff --git a/samples/client/petstore/typescript-jquery/npm/package.json b/samples/client/petstore/typescript-jquery/npm/package.json index 2e3360574b8..e55912ffa06 100644 --- a/samples/client/petstore/typescript-jquery/npm/package.json +++ b/samples/client/petstore/typescript-jquery/npm/package.json @@ -1,7 +1,7 @@ { - "name": "@swagger/jquery-typescript-petstore", + "name": "@swagger/angular2-typescript-petstore", "version": "0.0.1", - "description": "JQuery client for @swagger/jquery-typescript-petstore", + "description": "JQuery client for @swagger/angular2-typescript-petstore", "main": "api.js", "scripts": { "build": "tsc" diff --git a/samples/client/petstore/typescript-node/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-node/default/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-node/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-node/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/default/api.ts b/samples/client/petstore/typescript-node/default/api.ts index bd7f39968cc..1e75275a066 100644 --- a/samples/client/petstore/typescript-node/default/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -636,7 +636,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus (status: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/pet/findByStatus'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -648,7 +648,7 @@ export class PetApi { } if (status !== undefined) { - localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array"); + localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); } diff --git a/samples/client/petstore/typescript-node/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-node/npm/.swagger-codegen/VERSION index f9f7450d135..a6254504e40 100644 --- a/samples/client/petstore/typescript-node/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-node/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index bd7f39968cc..1e75275a066 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -636,7 +636,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus (status: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/pet/findByStatus'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); @@ -648,7 +648,7 @@ export class PetApi { } if (status !== undefined) { - localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array"); + localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); } From 4b25ad6a9d118664cc6209d2fac622a039247765 Mon Sep 17 00:00:00 2001 From: Esteban Marin Date: Thu, 18 Jan 2018 07:33:40 +0100 Subject: [PATCH 11/11] #7365: re-enable disabled unit test assertion --- .../codegen/typescript/fetch/TypeScriptFetchModelTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java index 8a83bbbfe8f..a7f38c02043 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/fetch/TypeScriptFetchModelTest.java @@ -202,7 +202,7 @@ public void enumArrayMdoelTest() { Property property = definition.getProperties().get("array_enum"); CodegenProperty prope = codegen.fromProperty("array_enum", property); codegen.updateCodegenPropertyEnum(prope); - // Assert.assertEquals(prope.datatypeWithEnum, "Array"); + Assert.assertEquals(prope.datatypeWithEnum, "Array"); Assert.assertEquals(prope.enumName, "ArrayEnumEnum"); Assert.assertTrue(prope.isEnum); Assert.assertEquals(prope.allowableValues.get("values"), Arrays.asList("fish", "crab"));