[TypeScript-Refactor] Use OAIv3 spec and fix bugs in JQuery Blob download (#6416)

* Change to OAIv3 spec for TS-Refactor

* Moved samples to oaiv3 folder

* Updated package-lock

* Update pom to use OAIv3 paths for Typescript-refactor

* Renamed ts-refactor samples & tests in pom.xmls

* Fixed compile issues in ts-refactor jquery http test

* Fixed bugs in blob handling of jquery
This commit is contained in:
Tino Fuhrmann 2020-05-25 22:10:44 +02:00 committed by GitHub
parent dee6ed420e
commit 33c8d19564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
99 changed files with 643 additions and 321 deletions

View File

@ -28,10 +28,10 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
echo "Creating default (fetch) client!" echo "Creating default (fetch) client!"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/default --additional-properties=platform=node,npmName=ts-petstore-client $@" ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript -o samples/openapi3/client/petstore/typescript/builds/default --additional-properties=platform=node,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags
echo "Creating jquery client!" echo "Creating jquery client!"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/jquery --additional-properties=framework=jquery,npmName=ts-petstore-client $@" ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript -o samples/openapi3/client/petstore/typescript/builds/jquery --additional-properties=framework=jquery,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -21,14 +21,12 @@ export class JQueryHttpLibrary implements HttpLibrary {
data: body data: body
}; };
/** // If we want a blob, we have to set the xhrFields' responseType AND add a
* Allow receiving binary data with jquery ajax // custom converter to overwrite the default deserialization of JQuery...
* requestOptions["xhrFields"] = { responseType: 'blob' };
* Source: https://keyangxiang.com/2017/09/01/HTML5-XHR-download-binary-content-as-Blob/ requestOptions["converters"] = {}
*/ requestOptions["converters"]["* blob"] = (result:any) => result;
requestOptions.beforeSend = (jqXHR: any, settings: any) => { requestOptions["dataType"] = "blob";
settings.xhr().responseType = "blob";
};
if (request.getHeaders()['Content-Type']) { if (request.getHeaders()['Content-Type']) {
@ -51,6 +49,7 @@ export class JQueryHttpLibrary implements HttpLibrary {
if (body && body.constructor.name == "FormData") { if (body && body.constructor.name == "FormData") {
requestOptions.contentType = false; requestOptions.contentType = false;
} }
const sentRequest = $.ajax(requestOptions); const sentRequest = $.ajax(requestOptions);
const resultPromise = new Promise<ResponseContext>((resolve, reject) => { const resultPromise = new Promise<ResponseContext>((resolve, reject) => {

20
pom.xml
View File

@ -1000,7 +1000,19 @@
</property> </property>
</activation> </activation>
<modules> <modules>
<module>samples/client/petstore/typescript/tests/default</module> <module>samples/openapi3/client/petstore/typescript/tests/default</module>
</modules>
</profile>
<profile>
<id>typescript-client-tests-jquery</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/openapi3/client/petstore/typescript/tests/jquery</module>
</modules> </modules>
</profile> </profile>
<profile> <profile>
@ -1271,8 +1283,10 @@
<module>samples/client/petstore/python-tornado</module> <module>samples/client/petstore/python-tornado</module>
<module>samples/openapi3/client/petstore/python</module> <module>samples/openapi3/client/petstore/python</module>
<module>samples/openapi3/client/petstore/python-experimental</module> <module>samples/openapi3/client/petstore/python-experimental</module>
<module>samples/client/petstore/typescript/builds/default</module> <module>samples/openapi3/client/petstore/typescript/builds/default</module>
<module>samples/client/petstore/typescript/tests/default</module> <module>samples/openapi3/client/petstore/typescript/tests/default</module>
<module>samples/openapi3/client/petstore/typescript/builds/jquery</module>
<module>samples/openapi3/client/petstore/typescript/tests/jquery</module>
<module>samples/client/petstore/typescript-fetch/builds/default</module> <module>samples/client/petstore/typescript-fetch/builds/default</module>
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module> <module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module> <module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>

View File

@ -1,3 +0,0 @@
{
"lockfileVersion": 1
}

View File

@ -17,14 +17,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): RequestContext { public addPet(pet: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'pet' is not null or undefined
if (body === null || body === undefined) { if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling addPet.'); throw new RequiredError('Required parameter pet was null or undefined when calling addPet.');
} }
@ -50,7 +50,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
]); ]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Pet", ""), ObjectSerializer.serialize(pet, "Pet", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
@ -237,14 +237,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): RequestContext { public updatePet(pet: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'pet' is not null or undefined
if (body === null || body === undefined) { if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updatePet.'); throw new RequiredError('Required parameter pet was null or undefined when calling updatePet.');
} }
@ -270,7 +270,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
]); ]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Pet", ""), ObjectSerializer.serialize(pet, "Pet", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
@ -406,15 +406,26 @@ export class PetApiResponseProcessor {
* @params response Response returned by the server for a request to addPet * @params response Response returned by the server for a request to addPet
* @throws ApiException if the response code was not in [200, 299] * @throws ApiException if the response code was not in [200, 299]
*/ */
public async addPet(response: ResponseContext): Promise< void> { public async addPet(response: ResponseContext): Promise<Pet > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) { if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<string>(response.httpStatusCode, "Invalid input"); throw new ApiException<string>(response.httpStatusCode, "Invalid input");
} }
// Work around for missing responses in specification, e.g. for petstore.yaml // Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
return; const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
} }
let body = response.body || ""; let body = response.body || "";
@ -552,8 +563,15 @@ export class PetApiResponseProcessor {
* @params response Response returned by the server for a request to updatePet * @params response Response returned by the server for a request to updatePet
* @throws ApiException if the response code was not in [200, 299] * @throws ApiException if the response code was not in [200, 299]
*/ */
public async updatePet(response: ResponseContext): Promise< void> { public async updatePet(response: ResponseContext): Promise<Pet > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) { if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<string>(response.httpStatusCode, "Invalid ID supplied"); throw new ApiException<string>(response.httpStatusCode, "Invalid ID supplied");
} }
@ -566,7 +584,11 @@ export class PetApiResponseProcessor {
// Work around for missing responses in specification, e.g. for petstore.yaml // Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
return; const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
} }
let body = response.body || ""; let body = response.body || "";

View File

@ -121,14 +121,14 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): RequestContext { public placeOrder(order: Order, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'order' is not null or undefined
if (body === null || body === undefined) { if (order === null || order === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling placeOrder.'); throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.');
} }
@ -147,10 +147,12 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Order", ""), ObjectSerializer.serialize(order, "Order", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);

View File

@ -17,14 +17,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): RequestContext { public createUser(user: User, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUser.'); throw new RequiredError('Required parameter user was null or undefined when calling createUser.');
} }
@ -43,29 +43,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "User", ""), ObjectSerializer.serialize(user, "User", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): RequestContext { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
} }
@ -84,29 +91,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Array<User>", ""), ObjectSerializer.serialize(user, "Array<User>", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): RequestContext { public createUsersWithListInput(user: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.');
} }
@ -125,15 +139,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Array<User>", ""), ObjectSerializer.serialize(user, "Array<User>", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -169,7 +190,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -278,7 +304,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -287,9 +318,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): RequestContext { public updateUser(username: string, user: User, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
@ -298,9 +329,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
} }
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updateUser.'); throw new RequiredError('Required parameter user was null or undefined when calling updateUser.');
} }
@ -320,15 +351,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "User", ""), ObjectSerializer.serialize(user, "User", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }

View File

@ -0,0 +1,48 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpFile } from '../http/http';
export class InlineObject {
/**
* Updated name of the pet
*/
'name'?: string;
/**
* Updated status of the pet
*/
'status'?: string;
static readonly discriminator: string | undefined = undefined;
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "name",
"baseName": "name",
"type": "string",
"format": ""
},
{
"name": "status",
"baseName": "status",
"type": "string",
"format": ""
} ];
static getAttributeTypeMap() {
return InlineObject.attributeTypeMap;
}
public constructor() {
}
}

View File

@ -0,0 +1,48 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpFile } from '../http/http';
export class InlineObject1 {
/**
* Additional data to pass to server
*/
'additionalMetadata'?: string;
/**
* file to upload
*/
'file'?: HttpFile;
static readonly discriminator: string | undefined = undefined;
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "additionalMetadata",
"baseName": "additionalMetadata",
"type": "string",
"format": ""
},
{
"name": "file",
"baseName": "file",
"type": "HttpFile",
"format": "binary"
} ];
static getAttributeTypeMap() {
return InlineObject1.attributeTypeMap;
}
public constructor() {
}
}

View File

@ -1,5 +1,7 @@
export * from './ApiResponse'; export * from './ApiResponse';
export * from './Category'; export * from './Category';
export * from './InlineObject';
export * from './InlineObject1';
export * from './Order'; export * from './Order';
export * from './Pet'; export * from './Pet';
export * from './Tag'; export * from './Tag';
@ -7,6 +9,8 @@ export * from './User';
import { ApiResponse } from './ApiResponse'; import { ApiResponse } from './ApiResponse';
import { Category } from './Category'; import { Category } from './Category';
import { InlineObject } from './InlineObject';
import { InlineObject1 } from './InlineObject1';
import { Order , OrderStatusEnum } from './Order'; import { Order , OrderStatusEnum } from './Order';
import { Pet , PetStatusEnum } from './Pet'; import { Pet , PetStatusEnum } from './Pet';
import { Tag } from './Tag'; import { Tag } from './Tag';
@ -38,6 +42,8 @@ let enumsMap: Set<string> = new Set<string>([
let typeMap: {[index: string]: any} = { let typeMap: {[index: string]: any} = {
"ApiResponse": ApiResponse, "ApiResponse": ApiResponse,
"Category": Category, "Category": Category,
"InlineObject": InlineObject,
"InlineObject1": InlineObject1,
"Order": Order, "Order": Order,
"Pet": Pet, "Pet": Pet,
"Tag": Tag, "Tag": Tag,

View File

@ -1,5 +1,7 @@
export * from './ApiResponse' export * from './ApiResponse'
export * from './Category' export * from './Category'
export * from './InlineObject'
export * from './InlineObject1'
export * from './Order' export * from './Order'
export * from './Pet' export * from './Pet'
export * from './Tag' export * from './Tag'

View File

@ -1,7 +1,7 @@
<project> <project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>TypeScriptBuildPetstoreClientSample</artifactId> <artifactId>TypeScriptBuildDefaultPetstoreClientSample</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>TS Default Petstore Client</name> <name>TS Default Petstore Client</name>

View File

@ -6,6 +6,8 @@ import {mergeMap, map} from '../rxjsStub';
import { ApiResponse } from '../models/ApiResponse'; import { ApiResponse } from '../models/ApiResponse';
import { Category } from '../models/Category'; import { Category } from '../models/Category';
import { InlineObject } from '../models/InlineObject';
import { InlineObject1 } from '../models/InlineObject1';
import { Order } from '../models/Order'; import { Order } from '../models/Order';
import { Pet } from '../models/Pet'; import { Pet } from '../models/Pet';
import { Tag } from '../models/Tag'; import { Tag } from '../models/Tag';
@ -25,10 +27,10 @@ export class ObservablePetApi {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): Observable<void> { public addPet(pet: Pet, options?: Configuration): Observable<Pet> {
const requestContext = this.requestFactory.addPet(body, options); const requestContext = this.requestFactory.addPet(pet, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -144,10 +146,10 @@ export class ObservablePetApi {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): Observable<void> { public updatePet(pet: Pet, options?: Configuration): Observable<Pet> {
const requestContext = this.requestFactory.updatePet(body, options); const requestContext = this.requestFactory.updatePet(pet, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -306,10 +308,10 @@ export class ObservableStoreApi {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): Observable<Order> { public placeOrder(order: Order, options?: Configuration): Observable<Order> {
const requestContext = this.requestFactory.placeOrder(body, options); const requestContext = this.requestFactory.placeOrder(order, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -348,10 +350,10 @@ export class ObservableUserApi {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): Observable<void> { public createUser(user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUser(body, options); const requestContext = this.requestFactory.createUser(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -371,10 +373,10 @@ export class ObservableUserApi {
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Observable<void> { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithArrayInput(body, options); const requestContext = this.requestFactory.createUsersWithArrayInput(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -394,10 +396,10 @@ export class ObservableUserApi {
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): Observable<void> { public createUsersWithListInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithListInput(body, options); const requestContext = this.requestFactory.createUsersWithListInput(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -512,10 +514,10 @@ export class ObservableUserApi {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): Observable<void> { public updateUser(username: string, user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updateUser(username, body, options); const requestContext = this.requestFactory.updateUser(username, user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);

View File

@ -4,6 +4,8 @@ import { Configuration} from '../configuration'
import { ApiResponse } from '../models/ApiResponse'; import { ApiResponse } from '../models/ApiResponse';
import { Category } from '../models/Category'; import { Category } from '../models/Category';
import { InlineObject } from '../models/InlineObject';
import { InlineObject1 } from '../models/InlineObject1';
import { Order } from '../models/Order'; import { Order } from '../models/Order';
import { Pet } from '../models/Pet'; import { Pet } from '../models/Pet';
import { Tag } from '../models/Tag'; import { Tag } from '../models/Tag';
@ -21,10 +23,10 @@ export class PromisePetApi {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): Promise<void> { public addPet(pet: Pet, options?: Configuration): Promise<Pet> {
const result = this.api.addPet(body, options); const result = this.api.addPet(pet, options);
return result.toPromise(); return result.toPromise();
} }
@ -70,10 +72,10 @@ export class PromisePetApi {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): Promise<void> { public updatePet(pet: Pet, options?: Configuration): Promise<Pet> {
const result = this.api.updatePet(body, options); const result = this.api.updatePet(pet, options);
return result.toPromise(); return result.toPromise();
} }
@ -146,10 +148,10 @@ export class PromiseStoreApi {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): Promise<Order> { public placeOrder(order: Order, options?: Configuration): Promise<Order> {
const result = this.api.placeOrder(body, options); const result = this.api.placeOrder(order, options);
return result.toPromise(); return result.toPromise();
} }
@ -172,28 +174,28 @@ export class PromiseUserApi {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): Promise<void> { public createUser(user: User, options?: Configuration): Promise<void> {
const result = this.api.createUser(body, options); const result = this.api.createUser(user, options);
return result.toPromise(); return result.toPromise();
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Promise<void> { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithArrayInput(body, options); const result = this.api.createUsersWithArrayInput(user, options);
return result.toPromise(); return result.toPromise();
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): Promise<void> { public createUsersWithListInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithListInput(body, options); const result = this.api.createUsersWithListInput(user, options);
return result.toPromise(); return result.toPromise();
} }
@ -238,10 +240,10 @@ export class PromiseUserApi {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): Promise<void> { public updateUser(username: string, user: User, options?: Configuration): Promise<void> {
const result = this.api.updateUser(username, body, options); const result = this.api.updateUser(username, user, options);
return result.toPromise(); return result.toPromise();
} }

View File

@ -16,14 +16,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): RequestContext { public addPet(pet: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'pet' is not null or undefined
if (body === null || body === undefined) { if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling addPet.'); throw new RequiredError('Required parameter pet was null or undefined when calling addPet.');
} }
@ -49,7 +49,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
]); ]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Pet", ""), ObjectSerializer.serialize(pet, "Pet", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
@ -236,14 +236,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): RequestContext { public updatePet(pet: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'pet' is not null or undefined
if (body === null || body === undefined) { if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updatePet.'); throw new RequiredError('Required parameter pet was null or undefined when calling updatePet.');
} }
@ -269,7 +269,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
]); ]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Pet", ""), ObjectSerializer.serialize(pet, "Pet", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
@ -405,15 +405,26 @@ export class PetApiResponseProcessor {
* @params response Response returned by the server for a request to addPet * @params response Response returned by the server for a request to addPet
* @throws ApiException if the response code was not in [200, 299] * @throws ApiException if the response code was not in [200, 299]
*/ */
public async addPet(response: ResponseContext): Promise< void> { public async addPet(response: ResponseContext): Promise<Pet > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
}
if (isCodeInRange("405", response.httpStatusCode)) { if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<string>(response.httpStatusCode, "Invalid input"); throw new ApiException<string>(response.httpStatusCode, "Invalid input");
} }
// Work around for missing responses in specification, e.g. for petstore.yaml // Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
return; const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
} }
let body = response.body || ""; let body = response.body || "";
@ -551,8 +562,15 @@ export class PetApiResponseProcessor {
* @params response Response returned by the server for a request to updatePet * @params response Response returned by the server for a request to updatePet
* @throws ApiException if the response code was not in [200, 299] * @throws ApiException if the response code was not in [200, 299]
*/ */
public async updatePet(response: ResponseContext): Promise< void> { public async updatePet(response: ResponseContext): Promise<Pet > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
}
if (isCodeInRange("400", response.httpStatusCode)) { if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<string>(response.httpStatusCode, "Invalid ID supplied"); throw new ApiException<string>(response.httpStatusCode, "Invalid ID supplied");
} }
@ -565,7 +583,11 @@ export class PetApiResponseProcessor {
// Work around for missing responses in specification, e.g. for petstore.yaml // Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
return; const body: Pet = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Pet", ""
) as Pet;
return body;
} }
let body = response.body || ""; let body = response.body || "";

View File

@ -120,14 +120,14 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): RequestContext { public placeOrder(order: Order, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'order' is not null or undefined
if (body === null || body === undefined) { if (order === null || order === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling placeOrder.'); throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.');
} }
@ -146,10 +146,12 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Order", ""), ObjectSerializer.serialize(order, "Order", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);

View File

@ -16,14 +16,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): RequestContext { public createUser(user: User, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUser.'); throw new RequiredError('Required parameter user was null or undefined when calling createUser.');
} }
@ -42,29 +42,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "User", ""), ObjectSerializer.serialize(user, "User", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): RequestContext { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
} }
@ -83,29 +90,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Array<User>", ""), ObjectSerializer.serialize(user, "Array<User>", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): RequestContext { public createUsersWithListInput(user: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.');
} }
@ -124,15 +138,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "Array<User>", ""), ObjectSerializer.serialize(user, "Array<User>", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -168,7 +189,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -277,7 +303,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }
@ -286,9 +317,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): RequestContext { public updateUser(username: string, user: User, options?: Configuration): RequestContext {
let config = options || this.configuration; let config = options || this.configuration;
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
@ -297,9 +328,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
} }
// verify required parameter 'body' is not null or undefined // verify required parameter 'user' is not null or undefined
if (body === null || body === undefined) { if (user === null || user === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updateUser.'); throw new RequiredError('Required parameter user was null or undefined when calling updateUser.');
} }
@ -319,15 +350,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
// Body Params // Body Params
const contentType = ObjectSerializer.getPreferredMediaType([]); const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType); requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify( const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(body, "User", ""), ObjectSerializer.serialize(user, "User", ""),
contentType contentType
); );
requestContext.setBody(serializedBody); requestContext.setBody(serializedBody);
let authMethod = null;
// Apply auth methods // Apply auth methods
authMethod = config.authMethods["api_key"]
if (authMethod) {
authMethod.applySecurityAuthentication(requestContext);
}
return requestContext; return requestContext;
} }

View File

@ -21,14 +21,12 @@ export class JQueryHttpLibrary implements HttpLibrary {
data: body data: body
}; };
/** // If we want a blob, we have to set the xhrFields' responseType AND add a
* Allow receiving binary data with jquery ajax // custom converter to overwrite the default deserialization of JQuery...
* requestOptions["xhrFields"] = { responseType: 'blob' };
* Source: https://keyangxiang.com/2017/09/01/HTML5-XHR-download-binary-content-as-Blob/ requestOptions["converters"] = {}
*/ requestOptions["converters"]["* blob"] = (result:any) => result;
requestOptions.beforeSend = (jqXHR: any, settings: any) => { requestOptions["dataType"] = "blob";
settings.xhr().responseType = "blob";
};
if (request.getHeaders()['Content-Type']) { if (request.getHeaders()['Content-Type']) {
@ -51,6 +49,7 @@ export class JQueryHttpLibrary implements HttpLibrary {
if (body && body.constructor.name == "FormData") { if (body && body.constructor.name == "FormData") {
requestOptions.contentType = false; requestOptions.contentType = false;
} }
const sentRequest = $.ajax(requestOptions); const sentRequest = $.ajax(requestOptions);
const resultPromise = new Promise<ResponseContext>((resolve, reject) => { const resultPromise = new Promise<ResponseContext>((resolve, reject) => {

View File

@ -0,0 +1,48 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpFile } from '../http/http';
export class InlineObject {
/**
* Updated name of the pet
*/
'name'?: string;
/**
* Updated status of the pet
*/
'status'?: string;
static readonly discriminator: string | undefined = undefined;
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "name",
"baseName": "name",
"type": "string",
"format": ""
},
{
"name": "status",
"baseName": "status",
"type": "string",
"format": ""
} ];
static getAttributeTypeMap() {
return InlineObject.attributeTypeMap;
}
public constructor() {
}
}

View File

@ -0,0 +1,48 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpFile } from '../http/http';
export class InlineObject1 {
/**
* Additional data to pass to server
*/
'additionalMetadata'?: string;
/**
* file to upload
*/
'file'?: HttpFile;
static readonly discriminator: string | undefined = undefined;
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "additionalMetadata",
"baseName": "additionalMetadata",
"type": "string",
"format": ""
},
{
"name": "file",
"baseName": "file",
"type": "HttpFile",
"format": "binary"
} ];
static getAttributeTypeMap() {
return InlineObject1.attributeTypeMap;
}
public constructor() {
}
}

View File

@ -1,5 +1,7 @@
export * from './ApiResponse'; export * from './ApiResponse';
export * from './Category'; export * from './Category';
export * from './InlineObject';
export * from './InlineObject1';
export * from './Order'; export * from './Order';
export * from './Pet'; export * from './Pet';
export * from './Tag'; export * from './Tag';
@ -7,6 +9,8 @@ export * from './User';
import { ApiResponse } from './ApiResponse'; import { ApiResponse } from './ApiResponse';
import { Category } from './Category'; import { Category } from './Category';
import { InlineObject } from './InlineObject';
import { InlineObject1 } from './InlineObject1';
import { Order , OrderStatusEnum } from './Order'; import { Order , OrderStatusEnum } from './Order';
import { Pet , PetStatusEnum } from './Pet'; import { Pet , PetStatusEnum } from './Pet';
import { Tag } from './Tag'; import { Tag } from './Tag';
@ -38,6 +42,8 @@ let enumsMap: Set<string> = new Set<string>([
let typeMap: {[index: string]: any} = { let typeMap: {[index: string]: any} = {
"ApiResponse": ApiResponse, "ApiResponse": ApiResponse,
"Category": Category, "Category": Category,
"InlineObject": InlineObject,
"InlineObject1": InlineObject1,
"Order": Order, "Order": Order,
"Pet": Pet, "Pet": Pet,
"Tag": Tag, "Tag": Tag,

View File

@ -1,5 +1,7 @@
export * from './ApiResponse' export * from './ApiResponse'
export * from './Category' export * from './Category'
export * from './InlineObject'
export * from './InlineObject1'
export * from './Order' export * from './Order'
export * from './Pet' export * from './Pet'
export * from './Tag' export * from './Tag'

View File

@ -1,7 +1,7 @@
<project> <project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>TypeScriptBuildPetstoreClientSample</artifactId> <artifactId>TypeScriptBuildJQueryPetstoreClientSample</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>TS Default Petstore Client</name> <name>TS Default Petstore Client</name>

View File

@ -6,6 +6,8 @@ import {mergeMap, map} from '../rxjsStub';
import { ApiResponse } from '../models/ApiResponse'; import { ApiResponse } from '../models/ApiResponse';
import { Category } from '../models/Category'; import { Category } from '../models/Category';
import { InlineObject } from '../models/InlineObject';
import { InlineObject1 } from '../models/InlineObject1';
import { Order } from '../models/Order'; import { Order } from '../models/Order';
import { Pet } from '../models/Pet'; import { Pet } from '../models/Pet';
import { Tag } from '../models/Tag'; import { Tag } from '../models/Tag';
@ -25,10 +27,10 @@ export class ObservablePetApi {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): Observable<void> { public addPet(pet: Pet, options?: Configuration): Observable<Pet> {
const requestContext = this.requestFactory.addPet(body, options); const requestContext = this.requestFactory.addPet(pet, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -144,10 +146,10 @@ export class ObservablePetApi {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): Observable<void> { public updatePet(pet: Pet, options?: Configuration): Observable<Pet> {
const requestContext = this.requestFactory.updatePet(body, options); const requestContext = this.requestFactory.updatePet(pet, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -306,10 +308,10 @@ export class ObservableStoreApi {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): Observable<Order> { public placeOrder(order: Order, options?: Configuration): Observable<Order> {
const requestContext = this.requestFactory.placeOrder(body, options); const requestContext = this.requestFactory.placeOrder(order, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -348,10 +350,10 @@ export class ObservableUserApi {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): Observable<void> { public createUser(user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUser(body, options); const requestContext = this.requestFactory.createUser(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -371,10 +373,10 @@ export class ObservableUserApi {
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Observable<void> { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithArrayInput(body, options); const requestContext = this.requestFactory.createUsersWithArrayInput(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -394,10 +396,10 @@ export class ObservableUserApi {
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): Observable<void> { public createUsersWithListInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithListInput(body, options); const requestContext = this.requestFactory.createUsersWithListInput(user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);
@ -512,10 +514,10 @@ export class ObservableUserApi {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): Observable<void> { public updateUser(username: string, user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updateUser(username, body, options); const requestContext = this.requestFactory.updateUser(username, user, options);
// build promise chain // build promise chain
let middlewarePreObservable = of(requestContext); let middlewarePreObservable = of(requestContext);

View File

@ -4,6 +4,8 @@ import { Configuration} from '../configuration'
import { ApiResponse } from '../models/ApiResponse'; import { ApiResponse } from '../models/ApiResponse';
import { Category } from '../models/Category'; import { Category } from '../models/Category';
import { InlineObject } from '../models/InlineObject';
import { InlineObject1 } from '../models/InlineObject1';
import { Order } from '../models/Order'; import { Order } from '../models/Order';
import { Pet } from '../models/Pet'; import { Pet } from '../models/Pet';
import { Tag } from '../models/Tag'; import { Tag } from '../models/Tag';
@ -21,10 +23,10 @@ export class PromisePetApi {
/** /**
* Add a new pet to the store * Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public addPet(body: Pet, options?: Configuration): Promise<void> { public addPet(pet: Pet, options?: Configuration): Promise<Pet> {
const result = this.api.addPet(body, options); const result = this.api.addPet(pet, options);
return result.toPromise(); return result.toPromise();
} }
@ -70,10 +72,10 @@ export class PromisePetApi {
/** /**
* Update an existing pet * Update an existing pet
* @param body Pet object that needs to be added to the store * @param pet Pet object that needs to be added to the store
*/ */
public updatePet(body: Pet, options?: Configuration): Promise<void> { public updatePet(pet: Pet, options?: Configuration): Promise<Pet> {
const result = this.api.updatePet(body, options); const result = this.api.updatePet(pet, options);
return result.toPromise(); return result.toPromise();
} }
@ -146,10 +148,10 @@ export class PromiseStoreApi {
/** /**
* Place an order for a pet * Place an order for a pet
* @param body order placed for purchasing the pet * @param order order placed for purchasing the pet
*/ */
public placeOrder(body: Order, options?: Configuration): Promise<Order> { public placeOrder(order: Order, options?: Configuration): Promise<Order> {
const result = this.api.placeOrder(body, options); const result = this.api.placeOrder(order, options);
return result.toPromise(); return result.toPromise();
} }
@ -172,28 +174,28 @@ export class PromiseUserApi {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Create user * Create user
* @param body Created user object * @param user Created user object
*/ */
public createUser(body: User, options?: Configuration): Promise<void> { public createUser(user: User, options?: Configuration): Promise<void> {
const result = this.api.createUser(body, options); const result = this.api.createUser(user, options);
return result.toPromise(); return result.toPromise();
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Promise<void> { public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithArrayInput(body, options); const result = this.api.createUsersWithArrayInput(user, options);
return result.toPromise(); return result.toPromise();
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* @param body List of user object * @param user List of user object
*/ */
public createUsersWithListInput(body: Array<User>, options?: Configuration): Promise<void> { public createUsersWithListInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithListInput(body, options); const result = this.api.createUsersWithListInput(user, options);
return result.toPromise(); return result.toPromise();
} }
@ -238,10 +240,10 @@ export class PromiseUserApi {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* Updated user * Updated user
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param user Updated user object
*/ */
public updateUser(username: string, body: User, options?: Configuration): Promise<void> { public updateUser(username: string, user: User, options?: Configuration): Promise<void> {
const result = this.api.updateUser(username, body, options); const result = this.api.updateUser(username, user, options);
return result.toPromise(); return result.toPromise();
} }

View File

@ -1224,6 +1224,7 @@
"version": "file:../../builds/default", "version": "file:../../builds/default",
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
"@types/node-fetch": "^2.5.7",
"btoa": "^1.2.1", "btoa": "^1.2.1",
"es6-promise": "^4.2.4", "es6-promise": "^4.2.4",
"form-data": "^2.5.0", "form-data": "^2.5.0",
@ -1233,46 +1234,57 @@
"dependencies": { "dependencies": {
"@types/isomorphic-fetch": { "@types/isomorphic-fetch": {
"version": "0.0.34", "version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz", "bundled": true
"integrity": "sha1-PDSD5gbAQTeEOOlRRk8A5OYHBtY="
}, },
"@types/node": { "@types/node": {
"version": "12.12.7", "version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", "bundled": true
"integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==" },
"@types/node-fetch": {
"version": "2.5.7",
"bundled": true,
"requires": {
"@types/node": "*",
"form-data": "^3.0.0"
},
"dependencies": {
"form-data": {
"version": "3.0.0",
"bundled": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
}, },
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "bundled": true
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
}, },
"btoa": { "btoa": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", "bundled": true
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g=="
}, },
"combined-stream": { "combined-stream": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "bundled": true,
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": { "requires": {
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
} }
}, },
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "bundled": true
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
}, },
"es6-promise": { "es6-promise": {
"version": "4.2.5", "version": "4.2.5",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", "bundled": true
"integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg=="
}, },
"form-data": { "form-data": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", "bundled": true,
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"requires": { "requires": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.6", "combined-stream": "^1.0.6",
@ -1281,49 +1293,41 @@
}, },
"isomorphic-fetch": { "isomorphic-fetch": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", "bundled": true,
"integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=",
"requires": { "requires": {
"whatwg-fetch": ">=0.10.0" "whatwg-fetch": ">=0.10.0"
} }
}, },
"mime-db": { "mime-db": {
"version": "1.40.0", "version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", "bundled": true
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
}, },
"mime-types": { "mime-types": {
"version": "2.1.24", "version": "2.1.24",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", "bundled": true,
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"requires": { "requires": {
"mime-db": "1.40.0" "mime-db": "1.40.0"
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "bundled": true
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
}, },
"querystringify": { "querystringify": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", "bundled": true
"integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg=="
}, },
"requires-port": { "requires-port": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "bundled": true
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
}, },
"typescript": { "typescript": {
"version": "2.9.2", "version": "2.9.2",
"resolved": false, "bundled": true
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w=="
}, },
"url-parse": { "url-parse": {
"version": "1.4.3", "version": "1.4.3",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", "bundled": true,
"integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==",
"requires": { "requires": {
"querystringify": "^2.0.0", "querystringify": "^2.0.0",
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
@ -1331,8 +1335,7 @@
}, },
"whatwg-fetch": { "whatwg-fetch": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", "bundled": true
"integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q=="
} }
} }
}, },

View File

@ -1,7 +1,7 @@
<project> <project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>TypeScriptPetstoreClientTests</artifactId> <artifactId>TypeScriptDefaultPetstoreClientTests</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>TS Petstore Test Client</name> <name>TS Petstore Test Client</name>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -2886,8 +2886,7 @@
"normalize-path": { "normalize-path": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
"optional": true
}, },
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
@ -3145,8 +3144,7 @@
"picomatch": { "picomatch": {
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
"optional": true
}, },
"pify": { "pify": {
"version": "4.0.1", "version": "4.0.1",
@ -4294,35 +4292,31 @@
"@types/jquery": "^3.3.29", "@types/jquery": "^3.3.29",
"btoa": "^1.2.1", "btoa": "^1.2.1",
"es6-promise": "^4.2.4", "es6-promise": "^4.2.4",
"jquery": "^3.5.1", "jquery": "^3.4.1",
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"dependencies": { "dependencies": {
"@types/form-data": { "@types/form-data": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", "bundled": true,
"integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/jquery": { "@types/jquery": {
"version": "3.3.29", "version": "3.3.29",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz", "bundled": true,
"integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==",
"requires": { "requires": {
"@types/sizzle": "*" "@types/sizzle": "*"
} }
}, },
"@types/node": { "@types/node": {
"version": "12.0.0", "version": "12.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.0.tgz", "bundled": true
"integrity": "sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg=="
}, },
"@types/rx": { "@types/rx": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz", "bundled": true,
"integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=",
"requires": { "requires": {
"@types/rx-core": "*", "@types/rx-core": "*",
"@types/rx-core-binding": "*", "@types/rx-core-binding": "*",
@ -4340,21 +4334,18 @@
}, },
"@types/rx-core": { "@types/rx-core": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-core/-/rx-core-4.0.3.tgz", "bundled": true
"integrity": "sha1-CzNUsSOM7b4rdPYybxOdvHpZHWA="
}, },
"@types/rx-core-binding": { "@types/rx-core-binding": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz", "bundled": true,
"integrity": "sha512-5pkfxnC4w810LqBPUwP5bg7SFR/USwhMSaAeZQQbEHeBp57pjKXRlXmqpMrLJB4y1oglR/c2502853uN0I+DAQ==",
"requires": { "requires": {
"@types/rx-core": "*" "@types/rx-core": "*"
} }
}, },
"@types/rx-lite": { "@types/rx-lite": {
"version": "4.0.6", "version": "4.0.6",
"resolved": "https://registry.npmjs.org/@types/rx-lite/-/rx-lite-4.0.6.tgz", "bundled": true,
"integrity": "sha512-oYiDrFIcor9zDm0VDUca1UbROiMYBxMLMaM6qzz4ADAfOmA9r1dYEcAFH+2fsPI5BCCjPvV9pWC3X3flbrvs7w==",
"requires": { "requires": {
"@types/rx-core": "*", "@types/rx-core": "*",
"@types/rx-core-binding": "*" "@types/rx-core-binding": "*"
@ -4362,113 +4353,97 @@
}, },
"@types/rx-lite-aggregates": { "@types/rx-lite-aggregates": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz", "bundled": true,
"integrity": "sha512-MAGDAHy8cRatm94FDduhJF+iNS5//jrZ/PIfm+QYw9OCeDgbymFHChM8YVIvN2zArwsRftKgE33QfRWvQk4DPg==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-async": { "@types/rx-lite-async": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz", "bundled": true,
"integrity": "sha512-vTEv5o8l6702ZwfAM5aOeVDfUwBSDOs+ARoGmWAKQ6LOInQ8J4/zjM7ov12fuTpktUKdMQjkeCp07Vd73mPkxw==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-backpressure": { "@types/rx-lite-backpressure": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz", "bundled": true,
"integrity": "sha512-Y6aIeQCtNban5XSAF4B8dffhIKu6aAy/TXFlScHzSxh6ivfQBQw6UjxyEJxIOt3IT49YkS+siuayM2H/Q0cmgA==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-coincidence": { "@types/rx-lite-coincidence": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz", "bundled": true,
"integrity": "sha512-1VNJqzE9gALUyMGypDXZZXzR0Tt7LC9DdAZQ3Ou/Q0MubNU35agVUNXKGHKpNTba+fr8GdIdkC26bRDqtCQBeQ==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-experimental": { "@types/rx-lite-experimental": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz", "bundled": true,
"integrity": "sha1-xTL1y98/LBXaFt7Ykw0bKYQCPL0=",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-joinpatterns": { "@types/rx-lite-joinpatterns": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz", "bundled": true,
"integrity": "sha1-9w/jcFGKhDLykVjMkv+1a05K/D4=",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-testing": { "@types/rx-lite-testing": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz", "bundled": true,
"integrity": "sha1-IbGdEfTf1v/vWp0WSOnIh5v+Iek=",
"requires": { "requires": {
"@types/rx-lite-virtualtime": "*" "@types/rx-lite-virtualtime": "*"
} }
}, },
"@types/rx-lite-time": { "@types/rx-lite-time": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz", "bundled": true,
"integrity": "sha512-ukO5sPKDRwCGWRZRqPlaAU0SKVxmWwSjiOrLhoQDoWxZWg6vyB9XLEZViKOzIO6LnTIQBlk4UylYV0rnhJLxQw==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/rx-lite-virtualtime": { "@types/rx-lite-virtualtime": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz", "bundled": true,
"integrity": "sha512-3uC6sGmjpOKatZSVHI2xB1+dedgml669ZRvqxy+WqmGJDVusOdyxcKfyzjW0P3/GrCiN4nmRkLVMhPwHCc5QLg==",
"requires": { "requires": {
"@types/rx-lite": "*" "@types/rx-lite": "*"
} }
}, },
"@types/sizzle": { "@types/sizzle": {
"version": "2.3.2", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", "bundled": true
"integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg=="
}, },
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "bundled": true
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
}, },
"btoa": { "btoa": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", "bundled": true
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g=="
}, },
"combined-stream": { "combined-stream": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "bundled": true,
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": { "requires": {
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
} }
}, },
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "bundled": true
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
}, },
"es6-promise": { "es6-promise": {
"version": "4.2.6", "version": "4.2.6",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", "bundled": true
"integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q=="
}, },
"form-data": { "form-data": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", "bundled": true,
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"requires": { "requires": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.6", "combined-stream": "^1.0.6",
@ -4477,54 +4452,45 @@
}, },
"jquery": { "jquery": {
"version": "3.5.1", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", "bundled": true
"integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
}, },
"mime-db": { "mime-db": {
"version": "1.40.0", "version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", "bundled": true
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
}, },
"mime-types": { "mime-types": {
"version": "2.1.24", "version": "2.1.24",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", "bundled": true,
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"requires": { "requires": {
"mime-db": "1.40.0" "mime-db": "1.40.0"
} }
}, },
"querystringify": { "querystringify": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", "bundled": true
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA=="
}, },
"requires-port": { "requires-port": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "bundled": true
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
}, },
"rxjs": { "rxjs": {
"version": "6.5.1", "version": "6.5.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.1.tgz", "bundled": true,
"integrity": "sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"tslib": { "tslib": {
"version": "1.9.3", "version": "1.9.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", "bundled": true
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
}, },
"typescript": { "typescript": {
"version": "2.9.2", "version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", "bundled": true
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w=="
}, },
"url-parse": { "url-parse": {
"version": "1.4.7", "version": "1.4.7",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", "bundled": true,
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
"requires": { "requires": {
"querystringify": "^2.1.1", "querystringify": "^2.1.1",
"requires-port": "^1.0.0" "requires-port": "^1.0.0"

View File

@ -1,7 +1,7 @@
<project> <project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>TypeScriptPetstoreClientTests</artifactId> <artifactId>TypeScriptJQueryPetstoreClientTests</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>TS Petstore Test Client</name> <name>TS Petstore Test Client</name>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -17,7 +17,9 @@ for (let libName in libs) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => { lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => {
assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200"); assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200");
let body = JSON.parse(resp.body); return resp.body.text();
}).then((txtBody: string) => {
let body = JSON.parse(txtBody);
assert.ok(body["headers"]); assert.ok(body["headers"]);
assert.equal(body["headers"]["X-Test-Token"],"Test-Token"); assert.equal(body["headers"]["X-Test-Token"],"Test-Token");
resolve() resolve()
@ -44,7 +46,9 @@ for (let libName in libs) {
lib.send(requestContext).toPromise().then( lib.send(requestContext).toPromise().then(
(resp: petstore.ResponseContext) => { (resp: petstore.ResponseContext) => {
assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200"); assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200");
let body = JSON.parse(resp.body); return resp.body.text();
}).then((txtBody: any) => {
let body = JSON.parse(txtBody);
assert.ok(body["headers"]); assert.ok(body["headers"]);
assert.equal(body["headers"]["X-Test-Token"], "Test-Token"); assert.equal(body["headers"]["X-Test-Token"], "Test-Token");
assert.equal(body["files"]["testFile"], "abc"); assert.equal(body["files"]["testFile"], "abc");