From ccfe7f5cbf565c6544f61a459dc6d08437b34409 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 28 Aug 2017 18:36:37 +0800 Subject: [PATCH] minor fix to ts angularjs bin script --- bin/typescript-angularjs-petstore.sh | 2 +- pom.xml | 3 +- .../.swagger-codegen/VERSION | 2 +- .../typescript-angularjs/api/PetApi.ts | 36 +++++++++++++----- .../typescript-angularjs/api/StoreApi.ts | 12 ++++-- .../typescript-angularjs/api/UserApi.ts | 38 +++++++++++++++---- .../typescript-angularjs/model/ApiResponse.ts | 23 +++++++++++ .../typescript-angularjs/model/Category.ts | 7 +++- .../typescript-angularjs/model/Order.ts | 7 +++- .../typescript-angularjs/model/Pet.ts | 7 +++- .../typescript-angularjs/model/Tag.ts | 7 +++- .../typescript-angularjs/model/User.ts | 7 +++- .../typescript-angularjs/model/models.ts | 1 + 13 files changed, 117 insertions(+), 35 deletions(-) create mode 100644 samples/client/petstore/typescript-angularjs/model/ApiResponse.ts diff --git a/bin/typescript-angularjs-petstore.sh b/bin/typescript-angularjs-petstore.sh index a0567704ed3..107e6291149 100755 --- a/bin/typescript-angularjs-petstore.sh +++ b/bin/typescript-angularjs-petstore.sh @@ -26,6 +26,6 @@ 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" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angularjs -o samples/client/petstore/typescript-angular" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angularjs -o samples/client/petstore/typescript-angularjs" java $JAVA_OPTS -jar $executable $ags diff --git a/pom.xml b/pom.xml index a2839090114..fe4c198e2da 100644 --- a/pom.xml +++ b/pom.xml @@ -829,10 +829,9 @@ samples/client/petstore/typescript-fetch/tests/default samples/client/petstore/typescript-node/npm + samples/client/petstore/typescript-angularjs--> - samples/client/petstore/typescript-angularjs samples/client/petstore/typescript-angular-v2/npm samples/client/petstore/typescript-angular-v4/npm samples/client/petstore/swift3/default/SwaggerClientTests diff --git a/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION index 6b4d1577382..f9f7450d135 100644 --- a/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angularjs/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3 \ No newline at end of file +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angularjs/api/PetApi.ts b/samples/client/petstore/typescript-angularjs/api/PetApi.ts index 0d182b75d08..eedcbb36425 100644 --- a/samples/client/petstore/typescript-angularjs/api/PetApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/PetApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -31,11 +31,15 @@ export class PetApi { * @summary Add a new pet to the store * @param body Pet object that needs to be added to the store */ - public addPet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public addPet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/pet'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addPet.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, @@ -86,11 +90,15 @@ export class PetApi { * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus (status?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { + public findPetsByStatus (status: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const localVarPath = this.basePath + '/pet/findByStatus'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } if (status !== undefined) { queryParameters['status'] = status; } @@ -113,11 +121,15 @@ export class PetApi { * @summary Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags (tags?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { + public findPetsByTags (tags: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const localVarPath = this.basePath + '/pet/findByTags'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } if (tags !== undefined) { queryParameters['tags'] = tags; } @@ -136,9 +148,9 @@ export class PetApi { return this.$http(httpRequestParams); } /** - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * Returns a single pet * @summary Find pet by ID - * @param petId ID of pet that needs to be fetched + * @param petId ID of pet to return */ public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/pet/{petId}' @@ -168,11 +180,15 @@ export class PetApi { * @summary Update an existing pet * @param body Pet object that needs to be added to the store */ - public updatePet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public updatePet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/pet'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updatePet.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'PUT', url: localVarPath, @@ -194,7 +210,7 @@ export class PetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public updatePetWithForm (petId: number, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/pet/{petId}' .replace('{' + 'petId' + '}', String(petId)); @@ -233,7 +249,7 @@ export class PetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/pet/{petId}/uploadImage' .replace('{' + 'petId' + '}', String(petId)); diff --git a/samples/client/petstore/typescript-angularjs/api/StoreApi.ts b/samples/client/petstore/typescript-angularjs/api/StoreApi.ts index bb71dc9846e..3946a8d47a8 100644 --- a/samples/client/petstore/typescript-angularjs/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/StoreApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -81,7 +81,7 @@ export class StoreApi { * @summary Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { + public getOrderById (orderId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/store/order/{orderId}' .replace('{' + 'orderId' + '}', String(orderId)); @@ -109,11 +109,15 @@ export class StoreApi { * @summary Place an order for a pet * @param body order placed for purchasing the pet */ - public placeOrder (body?: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise { + public placeOrder (body: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/store/order'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling placeOrder.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, diff --git a/samples/client/petstore/typescript-angularjs/api/UserApi.ts b/samples/client/petstore/typescript-angularjs/api/UserApi.ts index 63cbd7c4dcf..74092f7541f 100644 --- a/samples/client/petstore/typescript-angularjs/api/UserApi.ts +++ b/samples/client/petstore/typescript-angularjs/api/UserApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -31,11 +31,15 @@ export class UserApi { * @summary Create user * @param body Created user object */ - public createUser (body?: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public createUser (body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/user'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUser.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, @@ -55,11 +59,15 @@ export class UserApi { * @summary Creates list of users with given input array * @param body List of user object */ - public createUsersWithArrayInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public createUsersWithArrayInput (body: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/user/createWithArray'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, @@ -79,11 +87,15 @@ export class UserApi { * @summary Creates list of users with given input array * @param body List of user object */ - public createUsersWithListInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public createUsersWithListInput (body: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/user/createWithList'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'POST', url: localVarPath, @@ -160,11 +172,19 @@ export class UserApi { * @param username The user name for login * @param password The password for login in clear text */ - public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { + public loginUser (username: string, password: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { const localVarPath = this.basePath + '/user/login'; let queryParameters: any = {}; let headerParams: any = (Object).assign({}, this.defaultHeaders); + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } if (username !== undefined) { queryParameters['username'] = username; } @@ -214,7 +234,7 @@ export class UserApi { * @param username name that need to be deleted * @param body Updated user object */ - public updateUser (username: string, body?: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + public updateUser (username: string, body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const localVarPath = this.basePath + '/user/{username}' .replace('{' + 'username' + '}', String(username)); @@ -224,6 +244,10 @@ export class UserApi { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateUser.'); + } let httpRequestParams: ng.IRequestConfig = { method: 'PUT', url: localVarPath, diff --git a/samples/client/petstore/typescript-angularjs/model/ApiResponse.ts b/samples/client/petstore/typescript-angularjs/model/ApiResponse.ts new file mode 100644 index 00000000000..8f4f41d19f5 --- /dev/null +++ b/samples/client/petstore/typescript-angularjs/model/ApiResponse.ts @@ -0,0 +1,23 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import * as models from './models'; + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + "code"?: number; + "type"?: string; + "message"?: string; +} + diff --git a/samples/client/petstore/typescript-angularjs/model/Category.ts b/samples/client/petstore/typescript-angularjs/model/Category.ts index 57ac55012d1..f69e3599035 100644 --- a/samples/client/petstore/typescript-angularjs/model/Category.ts +++ b/samples/client/petstore/typescript-angularjs/model/Category.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A category for a pet + */ export interface Category { "id"?: number; "name"?: string; diff --git a/samples/client/petstore/typescript-angularjs/model/Order.ts b/samples/client/petstore/typescript-angularjs/model/Order.ts index d559f06efe6..902e0bb2f49 100644 --- a/samples/client/petstore/typescript-angularjs/model/Order.ts +++ b/samples/client/petstore/typescript-angularjs/model/Order.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * An order for a pets from the pet store + */ export interface Order { "id"?: number; "petId"?: number; diff --git a/samples/client/petstore/typescript-angularjs/model/Pet.ts b/samples/client/petstore/typescript-angularjs/model/Pet.ts index ebf8cb345ab..d5429059c29 100644 --- a/samples/client/petstore/typescript-angularjs/model/Pet.ts +++ b/samples/client/petstore/typescript-angularjs/model/Pet.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A pet for sale in the pet store + */ export interface Pet { "id"?: number; "category"?: models.Category; diff --git a/samples/client/petstore/typescript-angularjs/model/Tag.ts b/samples/client/petstore/typescript-angularjs/model/Tag.ts index 3c6c7e14f8f..0876494f492 100644 --- a/samples/client/petstore/typescript-angularjs/model/Tag.ts +++ b/samples/client/petstore/typescript-angularjs/model/Tag.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A tag for a pet + */ export interface Tag { "id"?: number; "name"?: string; diff --git a/samples/client/petstore/typescript-angularjs/model/User.ts b/samples/client/petstore/typescript-angularjs/model/User.ts index b4671197abf..ce3107bd4aa 100644 --- a/samples/client/petstore/typescript-angularjs/model/User.ts +++ b/samples/client/petstore/typescript-angularjs/model/User.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A User who is purchasing from the pet store + */ export interface User { "id"?: number; "username"?: string; diff --git a/samples/client/petstore/typescript-angularjs/model/models.ts b/samples/client/petstore/typescript-angularjs/model/models.ts index 92dac02846c..f53c1dd42bd 100644 --- a/samples/client/petstore/typescript-angularjs/model/models.ts +++ b/samples/client/petstore/typescript-angularjs/model/models.ts @@ -1,3 +1,4 @@ +export * from './ApiResponse'; export * from './Category'; export * from './Order'; export * from './Pet';