[Feature][TypeScript] request param enum as literal unions (#7433)

* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: improve docs

* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()

* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()

* #7365: allow parameter data type customizations

* #7365: re-enable disabled unit test assertions

* #7365: remove enum handling from type declaration generation

* #7365: generate all typescript samples

* #7365: re-enable disabled unit test assertion
This commit is contained in:
Esteban Marin 2018-01-25 11:36:14 +01:00 committed by William Cheng
parent 6d4d9056f4
commit 20305139b5
36 changed files with 199 additions and 103 deletions

View File

@ -2508,7 +2508,12 @@ public class DefaultCodegen {
// set boolean flag (e.g. isString)
setParameterBooleanFlagWithCodegenProperty(p, cp);
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");

View File

@ -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<Number>(sp.getEnum()));
}
} else if (p instanceof LongProperty) {
// Handle long enums
LongProperty sp = (LongProperty) p;
if (sp.getEnum() != null) {
return numericEnumValuesToEnumTypeUnion(new ArrayList<Number>(sp.getEnum()));
}
} else if (p instanceof DoubleProperty) {
// Handle double enums
DoubleProperty sp = (DoubleProperty) p;
if (sp.getEnum() != null) {
return numericEnumValuesToEnumTypeUnion(new ArrayList<Number>(sp.getEnum()));
}
} else if (p instanceof FloatProperty) {
// Handle float enums
FloatProperty sp = (FloatProperty) p;
if (sp.getEnum() != null) {
return numericEnumValuesToEnumTypeUnion(new ArrayList<Number>(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<String> 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<Number> values) {
List<String> 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) {

View File

@ -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);

View File

@ -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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}

View File

@ -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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}

View File

@ -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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}

View File

@ -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<string>, extraHttpRequestParams?: any): Observable<Array<Pet>>;
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: any): Observable<Array<Pet>>;
/**
* Finds Pets by tags

View File

@ -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<string>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByStatus(status: Array<string>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<string>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByStatus(status: Array<string>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}

View File

@ -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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Array<Pet>> {
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<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}

View File

@ -1 +1 @@
2.3.0-SNAPSHOT
2.3.1

View File

@ -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<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
const localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};

View File

@ -19,6 +19,7 @@ import {
any,
Pet,
ApiResponse,
Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;,
} from './models';
/**
@ -40,7 +41,7 @@ export interface IDeletePetParams {
* findPetsByStatus - parameters interface
*/
export interface IFindPetsByStatusParams {
status: Array<string>;
status: Array<'available' | 'pending' | 'sold'>;
}
/**

View File

@ -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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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<string>, options?: any) {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) {
return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath);
}

View File

@ -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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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<string>, options?: any) {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) {
return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath);
}

View File

@ -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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Array<Pet>> {
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&lt;string&gt;} status Status values that need to be considered for filter
* @param {Array&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<string>, 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<string>, options?: any) {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) {
return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.fetch, this.basePath);
}

View File

@ -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<string>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
let localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};

View File

@ -1 +1 @@
2.3.0-SNAPSHOT
2.3.1

View File

@ -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):_

View File

@ -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<string>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
let localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};

View File

@ -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"

View File

@ -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<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByStatus';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -648,7 +648,7 @@ export class PetApi {
}
if (status !== undefined) {
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<string>");
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>");
}

View File

@ -1 +1 @@
2.3.0-SNAPSHOT
2.3.1

View File

@ -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<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByStatus';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -648,7 +648,7 @@ export class PetApi {
}
if (status !== undefined) {
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<string>");
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>");
}