From d64af1b8362ef21d2d267e276b430d07db047348 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 May 2016 22:16:07 +0800 Subject: [PATCH] fix typescript tmeplate folder --- .../AbstractTypeScriptClientCodegen.java | 1 + .../languages/JavascriptClientCodegen.java | 1 + samples/client/petstore/javascript/README.md | 2 +- .../typescript-angular/API/Client/PetApi.ts | 125 ++---------------- .../typescript-angular/API/Client/StoreApi.ts | 73 +--------- .../typescript-angular/API/Client/UserApi.ts | 34 ++--- .../typescript-angular/API/Client/api.d.ts | 5 - .../petstore/typescript-angular/git_push.sh | 4 +- .../petstore/typescript-node/default/api.ts | 10 +- .../typescript-node/default/git_push.sh | 4 +- .../petstore/typescript-node/npm/api.ts | 10 +- .../petstore/typescript-node/npm/git_push.sh | 4 +- .../petstore/typescript-node/npm/package.json | 2 +- 13 files changed, 44 insertions(+), 231 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 0676372e64a..a5e62fc3053 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -60,6 +60,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // mapped to String as a workaround typeMapping.put("binary", "string"); typeMapping.put("ByteArray", "string"); + typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase")); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index 175f3eab0c1..9ca4589be5d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -136,6 +136,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo // binary not supported in JavaScript client right now, using String as a workaround typeMapping.put("ByteArray", "String"); // I don't see ByteArray defined in the Swagger docs. typeMapping.put("binary", "String"); + typeMapping.put("UUID", "String"); importMapping.clear(); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 2d707697bf2..2ddda0aa351 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-01T12:06:44.623+08:00 +- Build date: 2016-05-02T22:07:48.077+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation diff --git a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts index d11e0d780ed..62492c17d80 100644 --- a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts @@ -41,36 +41,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - */ - public addPetUsingByteArray (body?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - const localVarPath = this.basePath + '/pet?testing_byte_array=true'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let httpRequestParams: any = { - method: 'POST', - url: localVarPath, - json: true, - data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -102,9 +73,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -116,8 +85,8 @@ namespace API.Client { } /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter */ public findPetsByStatus (status?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const localVarPath = this.basePath + '/pet/findByStatus'; @@ -132,9 +101,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -162,9 +129,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -193,71 +158,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public getPetByIdInObject (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/pet/{petId}?response=inline_arbitrary_object' - .replace('{' + 'petId' + '}', String(petId)); - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling getPetByIdInObject'); - } - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public petPetIdtestingByteArraytrueGet (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/pet/{petId}?testing_byte_array=true' - .replace('{' + 'petId' + '}', String(petId)); - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling petPetIdtestingByteArraytrueGet'); - } - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -282,9 +183,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -323,9 +222,7 @@ namespace API.Client { method: 'POST', url: localVarPath, json: false, - - data: this.$httpParamSerializer(formParams), - + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; @@ -365,9 +262,7 @@ namespace API.Client { method: 'POST', url: localVarPath, json: false, - - data: this.$httpParamSerializer(formParams), - + data: this.$httpParamSerializer(formParams), params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts index 193e12fe5e5..976ee7acd48 100644 --- a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts @@ -45,39 +45,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Finds orders by status - * A single status value can be provided as a string - * @param status Status value that needs to be considered for query - */ - public findOrdersByStatus (status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise> { - const localVarPath = this.basePath + '/store/findByStatus'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - if (status !== undefined) { - queryParameters['status'] = status; - } - - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -100,34 +68,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, - headers: headerParams - }; - - if (extraHttpRequestParams) { - httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); - } - - return this.$http(httpRequestParams); - } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - */ - public getInventoryInObject (extraHttpRequestParams?: any ) : ng.IHttpPromise { - const localVarPath = this.basePath + '/store/inventory?response=arbitrary_object'; - - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let httpRequestParams: any = { - method: 'GET', - url: localVarPath, - json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -139,7 +80,7 @@ namespace API.Client { } /** * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { @@ -156,9 +97,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -183,9 +122,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts index c1111e146ad..79f6326b99c 100644 --- a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts @@ -41,9 +41,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -68,9 +66,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -95,9 +91,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -126,9 +120,7 @@ namespace API.Client { method: 'DELETE', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -141,7 +133,7 @@ namespace API.Client { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. */ public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/user/{username}' @@ -157,9 +149,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -192,9 +182,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -217,9 +205,7 @@ namespace API.Client { method: 'GET', url: localVarPath, json: true, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; @@ -250,9 +236,7 @@ namespace API.Client { url: localVarPath, json: true, data: body, - - - params: queryParameters, + params: queryParameters, headers: headerParams }; diff --git a/samples/client/petstore/typescript-angular/API/Client/api.d.ts b/samples/client/petstore/typescript-angular/API/Client/api.d.ts index c9e5e7a2f57..f2a86d96e96 100644 --- a/samples/client/petstore/typescript-angular/API/Client/api.d.ts +++ b/samples/client/petstore/typescript-angular/API/Client/api.d.ts @@ -1,11 +1,6 @@ /// -/// -/// -/// -/// /// /// -/// /// /// diff --git a/samples/client/petstore/typescript-angular/git_push.sh b/samples/client/petstore/typescript-angular/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/typescript-angular/git_push.sh +++ b/samples/client/petstore/typescript-angular/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/default/api.ts b/samples/client/petstore/typescript-node/default/api.ts index 3e25b5e718c..c2bd53e8ca2 100644 --- a/samples/client/petstore/typescript-node/default/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -129,8 +129,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -409,10 +409,10 @@ export class PetApi { json: true, } - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -632,8 +632,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -881,8 +881,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); diff --git a/samples/client/petstore/typescript-node/default/git_push.sh b/samples/client/petstore/typescript-node/default/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/typescript-node/default/git_push.sh +++ b/samples/client/petstore/typescript-node/default/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index 3e25b5e718c..c2bd53e8ca2 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -129,8 +129,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -409,10 +409,10 @@ export class PetApi { json: true, } - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.api_key.applyToRequest(requestOptions); + this.authentications.petstore_auth.applyToRequest(requestOptions); + this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { @@ -632,8 +632,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); @@ -881,8 +881,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'petstore_auth': new OAuth(), 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), } constructor(basePath?: string); diff --git a/samples/client/petstore/typescript-node/npm/git_push.sh b/samples/client/petstore/typescript-node/npm/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/typescript-node/npm/git_push.sh +++ b/samples/client/petstore/typescript-node/npm/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/typescript-node/npm/package.json b/samples/client/petstore/typescript-node/npm/package.json index 67a7cc03a36..5654c9ed4a3 100644 --- a/samples/client/petstore/typescript-node/npm/package.json +++ b/samples/client/petstore/typescript-node/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201604282147", + "version": "0.0.1-SNAPSHOT.201605022215", "description": "NodeJS client for @swagger/angular2-typescript-petstore", "main": "api.js", "scripts": {