diff --git a/bin/typescript.sh b/bin/typescript.sh index a94b40df114..38846529cf7 100755 --- a/bin/typescript.sh +++ b/bin/typescript.sh @@ -28,10 +28,10 @@ fi # 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" 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 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 diff --git a/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache b/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache index d6a25d993ec..3c67c5bd6f1 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache @@ -21,14 +21,12 @@ export class JQueryHttpLibrary implements HttpLibrary { data: body }; - /** - * Allow receiving binary data with jquery ajax - * - * Source: https://keyangxiang.com/2017/09/01/HTML5-XHR-download-binary-content-as-Blob/ - */ - requestOptions.beforeSend = (jqXHR: any, settings: any) => { - settings.xhr().responseType = "blob"; - }; + // If we want a blob, we have to set the xhrFields' responseType AND add a + // custom converter to overwrite the default deserialization of JQuery... + requestOptions["xhrFields"] = { responseType: 'blob' }; + requestOptions["converters"] = {} + requestOptions["converters"]["* blob"] = (result:any) => result; + requestOptions["dataType"] = "blob"; if (request.getHeaders()['Content-Type']) { @@ -51,6 +49,7 @@ export class JQueryHttpLibrary implements HttpLibrary { if (body && body.constructor.name == "FormData") { requestOptions.contentType = false; } + const sentRequest = $.ajax(requestOptions); const resultPromise = new Promise((resolve, reject) => { diff --git a/pom.xml b/pom.xml index 04bf662ac84..eb1ccb213f1 100644 --- a/pom.xml +++ b/pom.xml @@ -1000,7 +1000,19 @@ - samples/client/petstore/typescript/tests/default + samples/openapi3/client/petstore/typescript/tests/default + + + + typescript-client-tests-jquery + + + env + java + + + + samples/openapi3/client/petstore/typescript/tests/jquery @@ -1271,8 +1283,10 @@ samples/client/petstore/python-tornado samples/openapi3/client/petstore/python samples/openapi3/client/petstore/python-experimental - samples/client/petstore/typescript/builds/default - samples/client/petstore/typescript/tests/default + samples/openapi3/client/petstore/typescript/builds/default + samples/openapi3/client/petstore/typescript/tests/default + samples/openapi3/client/petstore/typescript/builds/jquery + samples/openapi3/client/petstore/typescript/tests/jquery samples/client/petstore/typescript-fetch/builds/default samples/client/petstore/typescript-fetch/builds/es6-target samples/client/petstore/typescript-fetch/builds/with-npm-version diff --git a/samples/client/petstore/typescript/tests/package-lock.json b/samples/client/petstore/typescript/tests/package-lock.json deleted file mode 100644 index 48e341a0954..00000000000 --- a/samples/client/petstore/typescript/tests/package-lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lockfileVersion": 1 -} diff --git a/samples/client/petstore/typescript/builds/default/.gitignore b/samples/openapi3/client/petstore/typescript/builds/default/.gitignore similarity index 100% rename from samples/client/petstore/typescript/builds/default/.gitignore rename to samples/openapi3/client/petstore/typescript/builds/default/.gitignore diff --git a/samples/client/petstore/typescript/builds/default/.openapi-generator-ignore b/samples/openapi3/client/petstore/typescript/builds/default/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/typescript/builds/default/.openapi-generator-ignore rename to samples/openapi3/client/petstore/typescript/builds/default/.openapi-generator-ignore diff --git a/samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION b/samples/openapi3/client/petstore/typescript/builds/default/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION rename to samples/openapi3/client/petstore/typescript/builds/default/.openapi-generator/VERSION diff --git a/samples/client/petstore/typescript/builds/default/README.md b/samples/openapi3/client/petstore/typescript/builds/default/README.md similarity index 100% rename from samples/client/petstore/typescript/builds/default/README.md rename to samples/openapi3/client/petstore/typescript/builds/default/README.md diff --git a/samples/client/petstore/typescript/builds/default/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts similarity index 91% rename from samples/client/petstore/typescript/builds/default/apis/PetApi.ts rename to samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts index f86ca7a612e..b512a2cc184 100644 --- a/samples/client/petstore/typescript/builds/default/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts @@ -17,14 +17,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling addPet.'); + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + 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); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Pet", ""), + ObjectSerializer.serialize(pet, "Pet", ""), contentType ); requestContext.setBody(serializedBody); @@ -237,14 +237,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling updatePet.'); + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + 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); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Pet", ""), + ObjectSerializer.serialize(pet, "Pet", ""), contentType ); requestContext.setBody(serializedBody); @@ -406,15 +406,26 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise< void> { + public async addPet(response: ResponseContext): Promise { 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)) { throw new ApiException(response.httpStatusCode, "Invalid input"); } // Work around for missing responses in specification, e.g. for petstore.yaml 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 || ""; @@ -552,8 +563,15 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise< void> { + public async updatePet(response: ResponseContext): Promise { 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)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied"); } @@ -566,7 +584,11 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml 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 || ""; diff --git a/samples/client/petstore/typescript/builds/default/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts similarity index 95% rename from samples/client/petstore/typescript/builds/default/apis/StoreApi.ts rename to samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts index 6e92f2ac33f..e85458ba3d6 100644 --- a/samples/client/petstore/typescript/builds/default/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts @@ -121,14 +121,14 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling placeOrder.'); + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.'); } @@ -147,10 +147,12 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Order", ""), + ObjectSerializer.serialize(order, "Order", ""), contentType ); requestContext.setBody(serializedBody); diff --git a/samples/client/petstore/typescript/builds/default/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts similarity index 87% rename from samples/client/petstore/typescript/builds/default/apis/UserApi.ts rename to samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts index efce92585dc..bf6006eb62c 100644 --- a/samples/client/petstore/typescript/builds/default/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts @@ -17,14 +17,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { /** * This can only be done by the logged in 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUser.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUser.'); } @@ -43,29 +43,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "User", ""), + ObjectSerializer.serialize(user, "User", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): RequestContext { + public createUsersWithArrayInput(user: Array, options?: Configuration): RequestContext { let config = options || this.configuration; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); } @@ -84,29 +91,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Array", ""), + ObjectSerializer.serialize(user, "Array", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): RequestContext { + public createUsersWithListInput(user: Array, options?: Configuration): RequestContext { let config = options || this.configuration; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithListInput.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.'); } @@ -125,15 +139,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Array", ""), + ObjectSerializer.serialize(user, "Array", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -169,7 +190,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -278,7 +304,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -287,9 +318,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { * This can only be done by the logged in user. * Updated user * @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; // 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 - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling updateUser.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling updateUser.'); } @@ -320,15 +351,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "User", ""), + ObjectSerializer.serialize(user, "User", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } diff --git a/samples/client/petstore/typescript/builds/default/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/baseapi.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/apis/baseapi.ts rename to samples/openapi3/client/petstore/typescript/builds/default/apis/baseapi.ts diff --git a/samples/client/petstore/typescript/builds/default/apis/exception.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/exception.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/apis/exception.ts rename to samples/openapi3/client/petstore/typescript/builds/default/apis/exception.ts diff --git a/samples/client/petstore/typescript/builds/default/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/auth/auth.ts rename to samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts diff --git a/samples/client/petstore/typescript/builds/default/configuration.ts b/samples/openapi3/client/petstore/typescript/builds/default/configuration.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/configuration.ts rename to samples/openapi3/client/petstore/typescript/builds/default/configuration.ts diff --git a/samples/client/petstore/typescript/builds/default/git_push.sh b/samples/openapi3/client/petstore/typescript/builds/default/git_push.sh similarity index 100% rename from samples/client/petstore/typescript/builds/default/git_push.sh rename to samples/openapi3/client/petstore/typescript/builds/default/git_push.sh diff --git a/samples/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/http/http.ts rename to samples/openapi3/client/petstore/typescript/builds/default/http/http.ts diff --git a/samples/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts rename to samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts diff --git a/samples/client/petstore/typescript/builds/default/index.ts b/samples/openapi3/client/petstore/typescript/builds/default/index.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/index.ts rename to samples/openapi3/client/petstore/typescript/builds/default/index.ts diff --git a/samples/client/petstore/typescript/builds/default/middleware.ts b/samples/openapi3/client/petstore/typescript/builds/default/middleware.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/middleware.ts rename to samples/openapi3/client/petstore/typescript/builds/default/middleware.ts diff --git a/samples/client/petstore/typescript/builds/default/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/ApiResponse.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/ApiResponse.ts diff --git a/samples/client/petstore/typescript/builds/default/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/Category.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/Category.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject.ts new file mode 100644 index 00000000000..54192c1c835 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject.ts @@ -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() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject1.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject1.ts new file mode 100644 index 00000000000..02e988674a0 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/InlineObject1.ts @@ -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() { + } +} + diff --git a/samples/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts similarity index 97% rename from samples/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts index 6eef999baaa..f485b39e42b 100644 --- a/samples/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts @@ -1,5 +1,7 @@ export * from './ApiResponse'; export * from './Category'; +export * from './InlineObject'; +export * from './InlineObject1'; export * from './Order'; export * from './Pet'; export * from './Tag'; @@ -7,6 +9,8 @@ export * from './User'; import { ApiResponse } from './ApiResponse'; import { Category } from './Category'; +import { InlineObject } from './InlineObject'; +import { InlineObject1 } from './InlineObject1'; import { Order , OrderStatusEnum } from './Order'; import { Pet , PetStatusEnum } from './Pet'; import { Tag } from './Tag'; @@ -38,6 +42,8 @@ let enumsMap: Set = new Set([ let typeMap: {[index: string]: any} = { "ApiResponse": ApiResponse, "Category": Category, + "InlineObject": InlineObject, + "InlineObject1": InlineObject1, "Order": Order, "Pet": Pet, "Tag": Tag, diff --git a/samples/client/petstore/typescript/builds/default/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/Order.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/Order.ts diff --git a/samples/client/petstore/typescript/builds/default/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/Pet.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/Pet.ts diff --git a/samples/client/petstore/typescript/builds/default/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/Tag.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/Tag.ts diff --git a/samples/client/petstore/typescript/builds/default/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/User.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/models/User.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/User.ts diff --git a/samples/client/petstore/typescript/builds/default/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/all.ts similarity index 70% rename from samples/client/petstore/typescript/builds/default/models/all.ts rename to samples/openapi3/client/petstore/typescript/builds/default/models/all.ts index 2edba7f0bd5..d064eba93ab 100644 --- a/samples/client/petstore/typescript/builds/default/models/all.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/all.ts @@ -1,5 +1,7 @@ export * from './ApiResponse' export * from './Category' +export * from './InlineObject' +export * from './InlineObject1' export * from './Order' export * from './Pet' export * from './Tag' diff --git a/samples/client/petstore/typescript/builds/default/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json similarity index 100% rename from samples/client/petstore/typescript/builds/default/package-lock.json rename to samples/openapi3/client/petstore/typescript/builds/default/package-lock.json diff --git a/samples/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json similarity index 100% rename from samples/client/petstore/typescript/builds/default/package.json rename to samples/openapi3/client/petstore/typescript/builds/default/package.json diff --git a/samples/client/petstore/typescript/builds/jquery/pom.xml b/samples/openapi3/client/petstore/typescript/builds/default/pom.xml similarity index 96% rename from samples/client/petstore/typescript/builds/jquery/pom.xml rename to samples/openapi3/client/petstore/typescript/builds/default/pom.xml index ad8b1d386fc..c3b2ac33026 100644 --- a/samples/client/petstore/typescript/builds/jquery/pom.xml +++ b/samples/openapi3/client/petstore/typescript/builds/default/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptBuildPetstoreClientSample + TypeScriptBuildDefaultPetstoreClientSample pom 1.0-SNAPSHOT TS Default Petstore Client diff --git a/samples/client/petstore/typescript/builds/default/rxjsStub.ts b/samples/openapi3/client/petstore/typescript/builds/default/rxjsStub.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/rxjsStub.ts rename to samples/openapi3/client/petstore/typescript/builds/default/rxjsStub.ts diff --git a/samples/client/petstore/typescript/builds/default/servers.ts b/samples/openapi3/client/petstore/typescript/builds/default/servers.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/servers.ts rename to samples/openapi3/client/petstore/typescript/builds/default/servers.ts diff --git a/samples/client/petstore/typescript/builds/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript/builds/default/tsconfig.json rename to samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json diff --git a/samples/client/petstore/typescript/builds/default/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts similarity index 94% rename from samples/client/petstore/typescript/builds/default/types/ObservableAPI.ts rename to samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts index 1c31558e9b2..cdc77b530a7 100644 --- a/samples/client/petstore/typescript/builds/default/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts @@ -6,6 +6,8 @@ import {mergeMap, map} from '../rxjsStub'; import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; +import { InlineObject } from '../models/InlineObject'; +import { InlineObject1 } from '../models/InlineObject1'; import { Order } from '../models/Order'; import { Pet } from '../models/Pet'; import { Tag } from '../models/Tag'; @@ -25,10 +27,10 @@ export class ObservablePetApi { /** * 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 { - const requestContext = this.requestFactory.addPet(body, options); + public addPet(pet: Pet, options?: Configuration): Observable { + const requestContext = this.requestFactory.addPet(pet, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -144,10 +146,10 @@ export class ObservablePetApi { /** * 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 { - const requestContext = this.requestFactory.updatePet(body, options); + public updatePet(pet: Pet, options?: Configuration): Observable { + const requestContext = this.requestFactory.updatePet(pet, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -306,10 +308,10 @@ export class ObservableStoreApi { /** * 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 { - const requestContext = this.requestFactory.placeOrder(body, options); + public placeOrder(order: Order, options?: Configuration): Observable { + const requestContext = this.requestFactory.placeOrder(order, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -348,10 +350,10 @@ export class ObservableUserApi { /** * This can only be done by the logged in user. * Create user - * @param body Created user object + * @param user Created user object */ - public createUser(body: User, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUser(body, options); + public createUser(user: User, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUser(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -371,10 +373,10 @@ export class ObservableUserApi { /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUsersWithArrayInput(body, options); + public createUsersWithArrayInput(user: Array, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUsersWithArrayInput(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -394,10 +396,10 @@ export class ObservableUserApi { /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUsersWithListInput(body, options); + public createUsersWithListInput(user: Array, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUsersWithListInput(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -512,10 +514,10 @@ export class ObservableUserApi { * This can only be done by the logged in user. * Updated user * @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 { - const requestContext = this.requestFactory.updateUser(username, body, options); + public updateUser(username: string, user: User, options?: Configuration): Observable { + const requestContext = this.requestFactory.updateUser(username, user, options); // build promise chain let middlewarePreObservable = of(requestContext); diff --git a/samples/client/petstore/typescript/builds/default/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts similarity index 84% rename from samples/client/petstore/typescript/builds/default/types/PromiseAPI.ts rename to samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts index 9aabd247268..15970873706 100644 --- a/samples/client/petstore/typescript/builds/default/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts @@ -4,6 +4,8 @@ import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; +import { InlineObject } from '../models/InlineObject'; +import { InlineObject1 } from '../models/InlineObject1'; import { Order } from '../models/Order'; import { Pet } from '../models/Pet'; import { Tag } from '../models/Tag'; @@ -21,10 +23,10 @@ export class PromisePetApi { /** * 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 { - const result = this.api.addPet(body, options); + public addPet(pet: Pet, options?: Configuration): Promise { + const result = this.api.addPet(pet, options); return result.toPromise(); } @@ -70,10 +72,10 @@ export class PromisePetApi { /** * 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 { - const result = this.api.updatePet(body, options); + public updatePet(pet: Pet, options?: Configuration): Promise { + const result = this.api.updatePet(pet, options); return result.toPromise(); } @@ -146,10 +148,10 @@ export class PromiseStoreApi { /** * 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 { - const result = this.api.placeOrder(body, options); + public placeOrder(order: Order, options?: Configuration): Promise { + const result = this.api.placeOrder(order, options); return result.toPromise(); } @@ -172,28 +174,28 @@ export class PromiseUserApi { /** * This can only be done by the logged in user. * Create user - * @param body Created user object + * @param user Created user object */ - public createUser(body: User, options?: Configuration): Promise { - const result = this.api.createUser(body, options); + public createUser(user: User, options?: Configuration): Promise { + const result = this.api.createUser(user, options); return result.toPromise(); } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): Promise { - const result = this.api.createUsersWithArrayInput(body, options); + public createUsersWithArrayInput(user: Array, options?: Configuration): Promise { + const result = this.api.createUsersWithArrayInput(user, options); return result.toPromise(); } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): Promise { - const result = this.api.createUsersWithListInput(body, options); + public createUsersWithListInput(user: Array, options?: Configuration): Promise { + const result = this.api.createUsersWithListInput(user, options); return result.toPromise(); } @@ -238,10 +240,10 @@ export class PromiseUserApi { * This can only be done by the logged in user. * Updated user * @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 { - const result = this.api.updateUser(username, body, options); + public updateUser(username: string, user: User, options?: Configuration): Promise { + const result = this.api.updateUser(username, user, options); return result.toPromise(); } diff --git a/samples/client/petstore/typescript/builds/default/util.ts b/samples/openapi3/client/petstore/typescript/builds/default/util.ts similarity index 100% rename from samples/client/petstore/typescript/builds/default/util.ts rename to samples/openapi3/client/petstore/typescript/builds/default/util.ts diff --git a/samples/client/petstore/typescript/builds/jquery/.gitignore b/samples/openapi3/client/petstore/typescript/builds/jquery/.gitignore similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/.gitignore rename to samples/openapi3/client/petstore/typescript/builds/jquery/.gitignore diff --git a/samples/client/petstore/typescript/builds/jquery/.openapi-generator-ignore b/samples/openapi3/client/petstore/typescript/builds/jquery/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/.openapi-generator-ignore rename to samples/openapi3/client/petstore/typescript/builds/jquery/.openapi-generator-ignore diff --git a/samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION b/samples/openapi3/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION rename to samples/openapi3/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION diff --git a/samples/client/petstore/typescript/builds/jquery/README.md b/samples/openapi3/client/petstore/typescript/builds/jquery/README.md similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/README.md rename to samples/openapi3/client/petstore/typescript/builds/jquery/README.md diff --git a/samples/client/petstore/typescript/builds/jquery/TODO.md b/samples/openapi3/client/petstore/typescript/builds/jquery/TODO.md similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/TODO.md rename to samples/openapi3/client/petstore/typescript/builds/jquery/TODO.md diff --git a/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts similarity index 91% rename from samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts index 6fec1ad3d23..68e401b36df 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts @@ -16,14 +16,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling addPet.'); + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + 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); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Pet", ""), + ObjectSerializer.serialize(pet, "Pet", ""), contentType ); requestContext.setBody(serializedBody); @@ -236,14 +236,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling updatePet.'); + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + 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); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Pet", ""), + ObjectSerializer.serialize(pet, "Pet", ""), contentType ); requestContext.setBody(serializedBody); @@ -405,15 +405,26 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise< void> { + public async addPet(response: ResponseContext): Promise { 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)) { throw new ApiException(response.httpStatusCode, "Invalid input"); } // Work around for missing responses in specification, e.g. for petstore.yaml 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 || ""; @@ -551,8 +562,15 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise< void> { + public async updatePet(response: ResponseContext): Promise { 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)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied"); } @@ -565,7 +583,11 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml 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 || ""; diff --git a/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts similarity index 95% rename from samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts index c7cca9dc1d8..15b86c2bcf0 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts @@ -120,14 +120,14 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory { /** * 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling placeOrder.'); + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.'); } @@ -146,10 +146,12 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Order", ""), + ObjectSerializer.serialize(order, "Order", ""), contentType ); requestContext.setBody(serializedBody); diff --git a/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts similarity index 87% rename from samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts index 46222492ed8..ab56faf4770 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts @@ -16,14 +16,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { /** * This can only be done by the logged in 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; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUser.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUser.'); } @@ -42,29 +42,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "User", ""), + ObjectSerializer.serialize(user, "User", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): RequestContext { + public createUsersWithArrayInput(user: Array, options?: Configuration): RequestContext { let config = options || this.configuration; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); } @@ -83,29 +90,36 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Array", ""), + ObjectSerializer.serialize(user, "Array", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): RequestContext { + public createUsersWithListInput(user: Array, options?: Configuration): RequestContext { let config = options || this.configuration; - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithListInput.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.'); } @@ -124,15 +138,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "Array", ""), + ObjectSerializer.serialize(user, "Array", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -168,7 +189,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -277,7 +303,12 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } @@ -286,9 +317,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { * This can only be done by the logged in user. * Updated user * @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; // 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 - if (body === null || body === undefined) { - throw new RequiredError('Required parameter body was null or undefined when calling updateUser.'); + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('Required parameter user was null or undefined when calling updateUser.'); } @@ -319,15 +350,22 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory { // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([]); + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(body, "User", ""), + ObjectSerializer.serialize(user, "User", ""), contentType ); requestContext.setBody(serializedBody); + let authMethod = null; // Apply auth methods + authMethod = config.authMethods["api_key"] + if (authMethod) { + authMethod.applySecurityAuthentication(requestContext); + } return requestContext; } diff --git a/samples/client/petstore/typescript/builds/jquery/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/baseapi.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/apis/baseapi.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/apis/baseapi.ts diff --git a/samples/client/petstore/typescript/builds/jquery/apis/exception.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/exception.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/apis/exception.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/apis/exception.ts diff --git a/samples/client/petstore/typescript/builds/jquery/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/auth/auth.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts diff --git a/samples/client/petstore/typescript/builds/jquery/configuration.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/configuration.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/configuration.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/configuration.ts diff --git a/samples/client/petstore/typescript/builds/jquery/git_push.sh b/samples/openapi3/client/petstore/typescript/builds/jquery/git_push.sh similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/git_push.sh rename to samples/openapi3/client/petstore/typescript/builds/jquery/git_push.sh diff --git a/samples/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/http/http.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts diff --git a/samples/client/petstore/typescript/builds/jquery/http/jquery.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/jquery.ts similarity index 88% rename from samples/client/petstore/typescript/builds/jquery/http/jquery.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/http/jquery.ts index 238eef3be08..a0cd53a1996 100644 --- a/samples/client/petstore/typescript/builds/jquery/http/jquery.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/jquery.ts @@ -21,14 +21,12 @@ export class JQueryHttpLibrary implements HttpLibrary { data: body }; - /** - * Allow receiving binary data with jquery ajax - * - * Source: https://keyangxiang.com/2017/09/01/HTML5-XHR-download-binary-content-as-Blob/ - */ - requestOptions.beforeSend = (jqXHR: any, settings: any) => { - settings.xhr().responseType = "blob"; - }; + // If we want a blob, we have to set the xhrFields' responseType AND add a + // custom converter to overwrite the default deserialization of JQuery... + requestOptions["xhrFields"] = { responseType: 'blob' }; + requestOptions["converters"] = {} + requestOptions["converters"]["* blob"] = (result:any) => result; + requestOptions["dataType"] = "blob"; if (request.getHeaders()['Content-Type']) { @@ -51,6 +49,7 @@ export class JQueryHttpLibrary implements HttpLibrary { if (body && body.constructor.name == "FormData") { requestOptions.contentType = false; } + const sentRequest = $.ajax(requestOptions); const resultPromise = new Promise((resolve, reject) => { diff --git a/samples/client/petstore/typescript/builds/jquery/index.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/index.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/index.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/index.ts diff --git a/samples/client/petstore/typescript/builds/jquery/middleware.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/middleware.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/middleware.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/middleware.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/ApiResponse.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/ApiResponse.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/Category.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/Category.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject.ts new file mode 100644 index 00000000000..54192c1c835 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject.ts @@ -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() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject1.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject1.ts new file mode 100644 index 00000000000..02e988674a0 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/InlineObject1.ts @@ -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() { + } +} + diff --git a/samples/client/petstore/typescript/builds/default/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts similarity index 97% rename from samples/client/petstore/typescript/builds/default/models/ObjectSerializer.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts index 6eef999baaa..f485b39e42b 100644 --- a/samples/client/petstore/typescript/builds/default/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts @@ -1,5 +1,7 @@ export * from './ApiResponse'; export * from './Category'; +export * from './InlineObject'; +export * from './InlineObject1'; export * from './Order'; export * from './Pet'; export * from './Tag'; @@ -7,6 +9,8 @@ export * from './User'; import { ApiResponse } from './ApiResponse'; import { Category } from './Category'; +import { InlineObject } from './InlineObject'; +import { InlineObject1 } from './InlineObject1'; import { Order , OrderStatusEnum } from './Order'; import { Pet , PetStatusEnum } from './Pet'; import { Tag } from './Tag'; @@ -38,6 +42,8 @@ let enumsMap: Set = new Set([ let typeMap: {[index: string]: any} = { "ApiResponse": ApiResponse, "Category": Category, + "InlineObject": InlineObject, + "InlineObject1": InlineObject1, "Order": Order, "Pet": Pet, "Tag": Tag, diff --git a/samples/client/petstore/typescript/builds/jquery/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/Order.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/Order.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/Pet.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/Pet.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/Tag.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/Tag.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/models/User.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/User.ts diff --git a/samples/client/petstore/typescript/builds/jquery/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/all.ts similarity index 70% rename from samples/client/petstore/typescript/builds/jquery/models/all.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/models/all.ts index 2edba7f0bd5..d064eba93ab 100644 --- a/samples/client/petstore/typescript/builds/jquery/models/all.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/all.ts @@ -1,5 +1,7 @@ export * from './ApiResponse' export * from './Category' +export * from './InlineObject' +export * from './InlineObject1' export * from './Order' export * from './Pet' export * from './Tag' diff --git a/samples/client/petstore/typescript/builds/jquery/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/package-lock.json rename to samples/openapi3/client/petstore/typescript/builds/jquery/package-lock.json diff --git a/samples/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/package.json rename to samples/openapi3/client/petstore/typescript/builds/jquery/package.json diff --git a/samples/client/petstore/typescript/builds/default/pom.xml b/samples/openapi3/client/petstore/typescript/builds/jquery/pom.xml similarity index 96% rename from samples/client/petstore/typescript/builds/default/pom.xml rename to samples/openapi3/client/petstore/typescript/builds/jquery/pom.xml index ad8b1d386fc..9bd07b654f7 100644 --- a/samples/client/petstore/typescript/builds/default/pom.xml +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptBuildPetstoreClientSample + TypeScriptBuildJQueryPetstoreClientSample pom 1.0-SNAPSHOT TS Default Petstore Client diff --git a/samples/client/petstore/typescript/builds/jquery/rxjsStub.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/rxjsStub.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/rxjsStub.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/rxjsStub.ts diff --git a/samples/client/petstore/typescript/builds/jquery/servers.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/servers.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts diff --git a/samples/client/petstore/typescript/builds/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/tsconfig.json rename to samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json diff --git a/samples/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts similarity index 94% rename from samples/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts index 1c31558e9b2..cdc77b530a7 100644 --- a/samples/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts @@ -6,6 +6,8 @@ import {mergeMap, map} from '../rxjsStub'; import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; +import { InlineObject } from '../models/InlineObject'; +import { InlineObject1 } from '../models/InlineObject1'; import { Order } from '../models/Order'; import { Pet } from '../models/Pet'; import { Tag } from '../models/Tag'; @@ -25,10 +27,10 @@ export class ObservablePetApi { /** * 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 { - const requestContext = this.requestFactory.addPet(body, options); + public addPet(pet: Pet, options?: Configuration): Observable { + const requestContext = this.requestFactory.addPet(pet, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -144,10 +146,10 @@ export class ObservablePetApi { /** * 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 { - const requestContext = this.requestFactory.updatePet(body, options); + public updatePet(pet: Pet, options?: Configuration): Observable { + const requestContext = this.requestFactory.updatePet(pet, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -306,10 +308,10 @@ export class ObservableStoreApi { /** * 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 { - const requestContext = this.requestFactory.placeOrder(body, options); + public placeOrder(order: Order, options?: Configuration): Observable { + const requestContext = this.requestFactory.placeOrder(order, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -348,10 +350,10 @@ export class ObservableUserApi { /** * This can only be done by the logged in user. * Create user - * @param body Created user object + * @param user Created user object */ - public createUser(body: User, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUser(body, options); + public createUser(user: User, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUser(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -371,10 +373,10 @@ export class ObservableUserApi { /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUsersWithArrayInput(body, options); + public createUsersWithArrayInput(user: Array, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUsersWithArrayInput(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -394,10 +396,10 @@ export class ObservableUserApi { /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): Observable { - const requestContext = this.requestFactory.createUsersWithListInput(body, options); + public createUsersWithListInput(user: Array, options?: Configuration): Observable { + const requestContext = this.requestFactory.createUsersWithListInput(user, options); // build promise chain let middlewarePreObservable = of(requestContext); @@ -512,10 +514,10 @@ export class ObservableUserApi { * This can only be done by the logged in user. * Updated user * @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 { - const requestContext = this.requestFactory.updateUser(username, body, options); + public updateUser(username: string, user: User, options?: Configuration): Observable { + const requestContext = this.requestFactory.updateUser(username, user, options); // build promise chain let middlewarePreObservable = of(requestContext); diff --git a/samples/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts similarity index 84% rename from samples/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts index 9aabd247268..15970873706 100644 --- a/samples/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts @@ -4,6 +4,8 @@ import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; import { Category } from '../models/Category'; +import { InlineObject } from '../models/InlineObject'; +import { InlineObject1 } from '../models/InlineObject1'; import { Order } from '../models/Order'; import { Pet } from '../models/Pet'; import { Tag } from '../models/Tag'; @@ -21,10 +23,10 @@ export class PromisePetApi { /** * 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 { - const result = this.api.addPet(body, options); + public addPet(pet: Pet, options?: Configuration): Promise { + const result = this.api.addPet(pet, options); return result.toPromise(); } @@ -70,10 +72,10 @@ export class PromisePetApi { /** * 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 { - const result = this.api.updatePet(body, options); + public updatePet(pet: Pet, options?: Configuration): Promise { + const result = this.api.updatePet(pet, options); return result.toPromise(); } @@ -146,10 +148,10 @@ export class PromiseStoreApi { /** * 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 { - const result = this.api.placeOrder(body, options); + public placeOrder(order: Order, options?: Configuration): Promise { + const result = this.api.placeOrder(order, options); return result.toPromise(); } @@ -172,28 +174,28 @@ export class PromiseUserApi { /** * This can only be done by the logged in user. * Create user - * @param body Created user object + * @param user Created user object */ - public createUser(body: User, options?: Configuration): Promise { - const result = this.api.createUser(body, options); + public createUser(user: User, options?: Configuration): Promise { + const result = this.api.createUser(user, options); return result.toPromise(); } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithArrayInput(body: Array, options?: Configuration): Promise { - const result = this.api.createUsersWithArrayInput(body, options); + public createUsersWithArrayInput(user: Array, options?: Configuration): Promise { + const result = this.api.createUsersWithArrayInput(user, options); return result.toPromise(); } /** * Creates list of users with given input array - * @param body List of user object + * @param user List of user object */ - public createUsersWithListInput(body: Array, options?: Configuration): Promise { - const result = this.api.createUsersWithListInput(body, options); + public createUsersWithListInput(user: Array, options?: Configuration): Promise { + const result = this.api.createUsersWithListInput(user, options); return result.toPromise(); } @@ -238,10 +240,10 @@ export class PromiseUserApi { * This can only be done by the logged in user. * Updated user * @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 { - const result = this.api.updateUser(username, body, options); + public updateUser(username: string, user: User, options?: Configuration): Promise { + const result = this.api.updateUser(username, user, options); return result.toPromise(); } diff --git a/samples/client/petstore/typescript/builds/jquery/util.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/util.ts similarity index 100% rename from samples/client/petstore/typescript/builds/jquery/util.ts rename to samples/openapi3/client/petstore/typescript/builds/jquery/util.ts diff --git a/samples/client/petstore/typescript/tests/default/.gitignore b/samples/openapi3/client/petstore/typescript/tests/default/.gitignore similarity index 100% rename from samples/client/petstore/typescript/tests/default/.gitignore rename to samples/openapi3/client/petstore/typescript/tests/default/.gitignore diff --git a/samples/client/petstore/typescript/tests/default/package-lock.json b/samples/openapi3/client/petstore/typescript/tests/default/package-lock.json similarity index 94% rename from samples/client/petstore/typescript/tests/default/package-lock.json rename to samples/openapi3/client/petstore/typescript/tests/default/package-lock.json index 6bd3eb97155..60e8e1b6f4b 100644 --- a/samples/client/petstore/typescript/tests/default/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/tests/default/package-lock.json @@ -1224,6 +1224,7 @@ "version": "file:../../builds/default", "requires": { "@types/node": "*", + "@types/node-fetch": "^2.5.7", "btoa": "^1.2.1", "es6-promise": "^4.2.4", "form-data": "^2.5.0", @@ -1233,46 +1234,57 @@ "dependencies": { "@types/isomorphic-fetch": { "version": "0.0.34", - "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz", - "integrity": "sha1-PDSD5gbAQTeEOOlRRk8A5OYHBtY=" + "bundled": true }, "@types/node": { "version": "12.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", - "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==" + "bundled": true + }, + "@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": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "bundled": true }, "btoa": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", - "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" + "bundled": true }, "combined-stream": { "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "bundled": true, "requires": { "delayed-stream": "~1.0.0" } }, "delayed-stream": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "bundled": true }, "es6-promise": { "version": "4.2.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", - "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==" + "bundled": true }, "form-data": { "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "bundled": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -1281,49 +1293,41 @@ }, "isomorphic-fetch": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "bundled": true, "requires": { "whatwg-fetch": ">=0.10.0" } }, "mime-db": { "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "bundled": true }, "mime-types": { "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "bundled": true, "requires": { "mime-db": "1.40.0" } }, "node-fetch": { "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + "bundled": true }, "querystringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", - "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" + "bundled": true }, "requires-port": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + "bundled": true }, "typescript": { "version": "2.9.2", - "resolved": false, - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==" + "bundled": true }, "url-parse": { "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", + "bundled": true, "requires": { "querystringify": "^2.0.0", "requires-port": "^1.0.0" @@ -1331,8 +1335,7 @@ }, "whatwg-fetch": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + "bundled": true } } }, diff --git a/samples/client/petstore/typescript/tests/default/package.json b/samples/openapi3/client/petstore/typescript/tests/default/package.json similarity index 100% rename from samples/client/petstore/typescript/tests/default/package.json rename to samples/openapi3/client/petstore/typescript/tests/default/package.json diff --git a/samples/client/petstore/typescript/tests/default/pom.xml b/samples/openapi3/client/petstore/typescript/tests/default/pom.xml similarity index 97% rename from samples/client/petstore/typescript/tests/default/pom.xml rename to samples/openapi3/client/petstore/typescript/tests/default/pom.xml index 6cf652cef1e..e6135cc7f84 100644 --- a/samples/client/petstore/typescript/tests/default/pom.xml +++ b/samples/openapi3/client/petstore/typescript/tests/default/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptPetstoreClientTests + TypeScriptDefaultPetstoreClientTests pom 1.0-SNAPSHOT TS Petstore Test Client diff --git a/samples/client/petstore/typescript/tests/default/test/api/PetApi.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/api/PetApi.test.ts similarity index 100% rename from samples/client/petstore/typescript/tests/default/test/api/PetApi.test.ts rename to samples/openapi3/client/petstore/typescript/tests/default/test/api/PetApi.test.ts diff --git a/samples/client/petstore/typescript/tests/default/test/api/pet.png b/samples/openapi3/client/petstore/typescript/tests/default/test/api/pet.png similarity index 100% rename from samples/client/petstore/typescript/tests/default/test/api/pet.png rename to samples/openapi3/client/petstore/typescript/tests/default/test/api/pet.png diff --git a/samples/client/petstore/typescript/tests/default/test/auth/auth.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/auth/auth.test.ts similarity index 100% rename from samples/client/petstore/typescript/tests/default/test/auth/auth.test.ts rename to samples/openapi3/client/petstore/typescript/tests/default/test/auth/auth.test.ts diff --git a/samples/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts similarity index 100% rename from samples/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts rename to samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts diff --git a/samples/client/petstore/typescript/tests/default/test/models/ObjectSerializer.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/models/ObjectSerializer.test.ts similarity index 100% rename from samples/client/petstore/typescript/tests/default/test/models/ObjectSerializer.test.ts rename to samples/openapi3/client/petstore/typescript/tests/default/test/models/ObjectSerializer.test.ts diff --git a/samples/client/petstore/typescript/tests/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript/tests/default/tsconfig.json rename to samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json diff --git a/samples/client/petstore/typescript/tests/jquery/.gitignore b/samples/openapi3/client/petstore/typescript/tests/jquery/.gitignore similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/.gitignore rename to samples/openapi3/client/petstore/typescript/tests/jquery/.gitignore diff --git a/samples/client/petstore/typescript/tests/jquery/index.html b/samples/openapi3/client/petstore/typescript/tests/jquery/index.html similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/index.html rename to samples/openapi3/client/petstore/typescript/tests/jquery/index.html diff --git a/samples/client/petstore/typescript/tests/jquery/node-qunit-puppeteer.d.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/node-qunit-puppeteer.d.ts similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/node-qunit-puppeteer.d.ts rename to samples/openapi3/client/petstore/typescript/tests/jquery/node-qunit-puppeteer.d.ts diff --git a/samples/client/petstore/typescript/tests/jquery/package-lock.json b/samples/openapi3/client/petstore/typescript/tests/jquery/package-lock.json similarity index 96% rename from samples/client/petstore/typescript/tests/jquery/package-lock.json rename to samples/openapi3/client/petstore/typescript/tests/jquery/package-lock.json index b947dee2738..cb57318ae68 100644 --- a/samples/client/petstore/typescript/tests/jquery/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/tests/jquery/package-lock.json @@ -2886,8 +2886,7 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "optional": true + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, "npm-run-path": { "version": "2.0.2", @@ -3145,8 +3144,7 @@ "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "optional": true + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" }, "pify": { "version": "4.0.1", @@ -4294,35 +4292,31 @@ "@types/jquery": "^3.3.29", "btoa": "^1.2.1", "es6-promise": "^4.2.4", - "jquery": "^3.5.1", + "jquery": "^3.4.1", "url-parse": "^1.4.3" }, "dependencies": { "@types/form-data": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", - "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", + "bundled": true, "requires": { "@types/node": "*" } }, "@types/jquery": { "version": "3.3.29", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz", - "integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==", + "bundled": true, "requires": { "@types/sizzle": "*" } }, "@types/node": { "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.0.tgz", - "integrity": "sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg==" + "bundled": true }, "@types/rx": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz", - "integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=", + "bundled": true, "requires": { "@types/rx-core": "*", "@types/rx-core-binding": "*", @@ -4340,21 +4334,18 @@ }, "@types/rx-core": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-core/-/rx-core-4.0.3.tgz", - "integrity": "sha1-CzNUsSOM7b4rdPYybxOdvHpZHWA=" + "bundled": true }, "@types/rx-core-binding": { "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz", - "integrity": "sha512-5pkfxnC4w810LqBPUwP5bg7SFR/USwhMSaAeZQQbEHeBp57pjKXRlXmqpMrLJB4y1oglR/c2502853uN0I+DAQ==", + "bundled": true, "requires": { "@types/rx-core": "*" } }, "@types/rx-lite": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/rx-lite/-/rx-lite-4.0.6.tgz", - "integrity": "sha512-oYiDrFIcor9zDm0VDUca1UbROiMYBxMLMaM6qzz4ADAfOmA9r1dYEcAFH+2fsPI5BCCjPvV9pWC3X3flbrvs7w==", + "bundled": true, "requires": { "@types/rx-core": "*", "@types/rx-core-binding": "*" @@ -4362,113 +4353,97 @@ }, "@types/rx-lite-aggregates": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz", - "integrity": "sha512-MAGDAHy8cRatm94FDduhJF+iNS5//jrZ/PIfm+QYw9OCeDgbymFHChM8YVIvN2zArwsRftKgE33QfRWvQk4DPg==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-async": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz", - "integrity": "sha512-vTEv5o8l6702ZwfAM5aOeVDfUwBSDOs+ARoGmWAKQ6LOInQ8J4/zjM7ov12fuTpktUKdMQjkeCp07Vd73mPkxw==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-backpressure": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz", - "integrity": "sha512-Y6aIeQCtNban5XSAF4B8dffhIKu6aAy/TXFlScHzSxh6ivfQBQw6UjxyEJxIOt3IT49YkS+siuayM2H/Q0cmgA==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-coincidence": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz", - "integrity": "sha512-1VNJqzE9gALUyMGypDXZZXzR0Tt7LC9DdAZQ3Ou/Q0MubNU35agVUNXKGHKpNTba+fr8GdIdkC26bRDqtCQBeQ==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-experimental": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz", - "integrity": "sha1-xTL1y98/LBXaFt7Ykw0bKYQCPL0=", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-joinpatterns": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz", - "integrity": "sha1-9w/jcFGKhDLykVjMkv+1a05K/D4=", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-testing": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz", - "integrity": "sha1-IbGdEfTf1v/vWp0WSOnIh5v+Iek=", + "bundled": true, "requires": { "@types/rx-lite-virtualtime": "*" } }, "@types/rx-lite-time": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz", - "integrity": "sha512-ukO5sPKDRwCGWRZRqPlaAU0SKVxmWwSjiOrLhoQDoWxZWg6vyB9XLEZViKOzIO6LnTIQBlk4UylYV0rnhJLxQw==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/rx-lite-virtualtime": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz", - "integrity": "sha512-3uC6sGmjpOKatZSVHI2xB1+dedgml669ZRvqxy+WqmGJDVusOdyxcKfyzjW0P3/GrCiN4nmRkLVMhPwHCc5QLg==", + "bundled": true, "requires": { "@types/rx-lite": "*" } }, "@types/sizzle": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", - "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" + "bundled": true }, "asynckit": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "bundled": true }, "btoa": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", - "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" + "bundled": true }, "combined-stream": { "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "bundled": true, "requires": { "delayed-stream": "~1.0.0" } }, "delayed-stream": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "bundled": true }, "es6-promise": { "version": "4.2.6", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", - "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" + "bundled": true }, "form-data": { "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "bundled": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -4477,54 +4452,45 @@ }, "jquery": { "version": "3.5.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", - "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" + "bundled": true }, "mime-db": { "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "bundled": true }, "mime-types": { "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "bundled": true, "requires": { "mime-db": "1.40.0" } }, "querystringify": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", - "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" + "bundled": true }, "requires-port": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + "bundled": true }, "rxjs": { "version": "6.5.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.1.tgz", - "integrity": "sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg==", + "bundled": true, "requires": { "tslib": "^1.9.0" } }, "tslib": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + "bundled": true }, "typescript": { "version": "2.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==" + "bundled": true }, "url-parse": { "version": "1.4.7", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", + "bundled": true, "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" diff --git a/samples/client/petstore/typescript/tests/jquery/package.json b/samples/openapi3/client/petstore/typescript/tests/jquery/package.json similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/package.json rename to samples/openapi3/client/petstore/typescript/tests/jquery/package.json diff --git a/samples/client/petstore/typescript/tests/jquery/pom.xml b/samples/openapi3/client/petstore/typescript/tests/jquery/pom.xml similarity index 97% rename from samples/client/petstore/typescript/tests/jquery/pom.xml rename to samples/openapi3/client/petstore/typescript/tests/jquery/pom.xml index c8fea0f2c06..13f65131ba9 100644 --- a/samples/client/petstore/typescript/tests/jquery/pom.xml +++ b/samples/openapi3/client/petstore/typescript/tests/jquery/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptPetstoreClientTests + TypeScriptJQueryPetstoreClientTests pom 1.0-SNAPSHOT TS Petstore Test Client diff --git a/samples/client/petstore/typescript/tests/jquery/require1k.min.js b/samples/openapi3/client/petstore/typescript/tests/jquery/require1k.min.js similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/require1k.min.js rename to samples/openapi3/client/petstore/typescript/tests/jquery/require1k.min.js diff --git a/samples/client/petstore/typescript/tests/jquery/test-runner.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/test-runner.ts similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/test-runner.ts rename to samples/openapi3/client/petstore/typescript/tests/jquery/test-runner.ts diff --git a/samples/client/petstore/typescript/tests/jquery/test/api/PetApi.test.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/test/api/PetApi.test.ts similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/test/api/PetApi.test.ts rename to samples/openapi3/client/petstore/typescript/tests/jquery/test/api/PetApi.test.ts diff --git a/samples/client/petstore/typescript/tests/jquery/test/api/pet.png b/samples/openapi3/client/petstore/typescript/tests/jquery/test/api/pet.png similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/test/api/pet.png rename to samples/openapi3/client/petstore/typescript/tests/jquery/test/api/pet.png diff --git a/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts similarity index 91% rename from samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts rename to samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts index c8715e14a27..0898ca7f155 100644 --- a/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts @@ -17,10 +17,12 @@ for (let libName in libs) { return new Promise((resolve, reject) => { lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => { 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.equal(body["headers"]["X-Test-Token"],"Test-Token"); - resolve() + resolve() }, (e: any) => { console.error(e) @@ -44,12 +46,14 @@ for (let libName in libs) { lib.send(requestContext).toPromise().then( (resp: petstore.ResponseContext) => { 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.equal(body["headers"]["X-Test-Token"], "Test-Token"); assert.equal(body["files"]["testFile"], "abc"); assert.equal(body["form"]["test"], "test2"); - resolve(); + resolve(); }, (e: any) => { console.error(e) diff --git a/samples/client/petstore/typescript/tests/jquery/tests.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/tests.ts similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/tests.ts rename to samples/openapi3/client/petstore/typescript/tests/jquery/tests.ts diff --git a/samples/client/petstore/typescript/tests/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/tests/jquery/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/tsconfig.json rename to samples/openapi3/client/petstore/typescript/tests/jquery/tsconfig.json diff --git a/samples/client/petstore/typescript/tests/jquery/webpack.config.js b/samples/openapi3/client/petstore/typescript/tests/jquery/webpack.config.js similarity index 100% rename from samples/client/petstore/typescript/tests/jquery/webpack.config.js rename to samples/openapi3/client/petstore/typescript/tests/jquery/webpack.config.js