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 46b31091bc7..f1daba360f4 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 class DefaultCodegen { // 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 class DefaultCodegen { 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 273cdb5583e..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 @@ -1,14 +1,10 @@ package io.swagger.codegen.languages; +import io.swagger.models.parameters.Parameter; 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; @@ -234,6 +230,101 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp return super.getTypeDeclaration(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; + 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' + * + * @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 a529711a5cf..0ca5848f7ff 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.CodegenOperation; 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"); @@ -161,16 +156,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode @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"; @@ -179,6 +165,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode } } + @Override public String getSwaggerType(Property p) { String swaggerType = super.getSwaggerType(p); 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..2bf1c1ccf36 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 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 50794f17f1a..2bf1c1ccf36 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 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 50794f17f1a..2bf1c1ccf36 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 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 50794f17f1a..2bf1c1ccf36 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 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 50794f17f1a..2bf1c1ccf36 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 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.'); } 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 7d1ab010c49..68203071fd8 100644 --- a/samples/client/petstore/typescript-jquery/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-jquery/default/api/PetApi.ts @@ -191,7 +191,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array; }> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): 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 7d1ab010c49..68203071fd8 100644 --- a/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-jquery/npm/api/PetApi.ts @@ -191,7 +191,7 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array; }> { + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): 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'>"); }