From fdaf8ea65f0c4b0c6030fb4262d1b4656fbcd116 Mon Sep 17 00:00:00 2001 From: Isman Usoh Date: Thu, 13 Jul 2017 22:33:08 +0700 Subject: [PATCH] [Typescript-Angular2] add @summary JSDoc tag (#6028) * add @summary JSDoc tag * updatee sample and create windows script for typescript-angular2 * Fix for Review --- bin/windows/typescript-angular2-all.bat | 18 ++++++++++++++++++ .../resources/typescript-angular2/api.mustache | 4 +++- .../typescript-angular2/default/api/PetApi.ts | 16 ++++++++-------- .../default/api/StoreApi.ts | 8 ++++---- .../typescript-angular2/default/api/UserApi.ts | 16 ++++++++-------- .../typescript-angular2/npm/api/PetApi.ts | 16 ++++++++-------- .../typescript-angular2/npm/api/StoreApi.ts | 8 ++++---- .../typescript-angular2/npm/api/UserApi.ts | 16 ++++++++-------- .../with-interfaces/api/PetApi.ts | 16 ++++++++-------- .../with-interfaces/api/StoreApi.ts | 8 ++++---- .../with-interfaces/api/UserApi.ts | 16 ++++++++-------- 11 files changed, 81 insertions(+), 61 deletions(-) create mode 100644 bin/windows/typescript-angular2-all.bat diff --git a/bin/windows/typescript-angular2-all.bat b/bin/windows/typescript-angular2-all.bat new file mode 100644 index 00000000000..119de7e7bcc --- /dev/null +++ b/bin/windows/typescript-angular2-all.bat @@ -0,0 +1,18 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M +echo "Typescript Petstore API client (default)" +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular2 -o samples\client\petstore\typescript-angular2\default +java %JAVA_OPTS% -jar %executable% %ags% + +echo "Typescript Petstore API client (with interfaces generated)" +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular2 -o samples\client\petstore\typescript-angular2\with-interfaces -D withInterfaces=true +java %JAVA_OPTS% -jar %executable% %ags% + +echo "Typescript Petstore API client (npm setting)" +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular2 -c bin\typescript-petstore-npm.json -o samples\client\petstore\typescript-angular2\npm +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index eac59ada743..08ab7e5bd51 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -46,8 +46,10 @@ export class {{classname}} { {{#operation}} /** - * {{summary}} * {{notes}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} {{#allParams}}* @param {{paramName}} {{description}} {{/allParams}}*/ public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index e5238eda30d..2d53ef4fcd2 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -42,8 +42,8 @@ export class PetApi { } /** - * Add a new pet to the store * + * @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): Observable<{}> { @@ -58,8 +58,8 @@ export class PetApi { } /** - * Deletes a pet * + * @summary Deletes a pet * @param petId Pet id to delete * @param apiKey */ @@ -75,8 +75,8 @@ export class PetApi { } /** - * Finds Pets by status * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { @@ -91,8 +91,8 @@ export class PetApi { } /** - * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags * @param tags Tags to filter by */ public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { @@ -107,8 +107,8 @@ export class PetApi { } /** - * Find pet by ID * Returns a single pet + * @summary Find pet by ID * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { @@ -123,8 +123,8 @@ export class PetApi { } /** - * Update an existing pet * + * @summary Update an existing pet * @param body Pet object that needs to be added to the store */ public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { @@ -139,8 +139,8 @@ export class PetApi { } /** - * Updates a pet in the store with form data * + * @summary Updates a pet in the store with form data * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet @@ -157,8 +157,8 @@ export class PetApi { } /** - * uploads an image * + * @summary uploads an image * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload diff --git a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts index a4257efc440..d98c2c2047c 100644 --- a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts @@ -42,8 +42,8 @@ export class StoreApi { } /** - * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> { @@ -58,8 +58,8 @@ export class StoreApi { } /** - * Returns pet inventories by status * Returns a map of status codes to quantities + * @summary Returns pet inventories by status */ public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> { return this.getInventoryWithHttpInfo(extraHttpRequestParams) @@ -73,8 +73,8 @@ export class StoreApi { } /** - * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { @@ -89,8 +89,8 @@ export class StoreApi { } /** - * Place an order for a pet * + * @summary Place an order for a pet * @param body order placed for purchasing the pet */ public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { diff --git a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts index 681d5849424..4e7bcfbaf09 100644 --- a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts @@ -42,8 +42,8 @@ export class UserApi { } /** - * Create user * This can only be done by the logged in user. + * @summary Create user * @param body Created user object */ public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { @@ -58,8 +58,8 @@ export class UserApi { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -74,8 +74,8 @@ export class UserApi { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -90,8 +90,8 @@ export class UserApi { } /** - * Delete user * This can only be done by the logged in user. + * @summary Delete user * @param username The name that needs to be deleted */ public deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}> { @@ -106,8 +106,8 @@ export class UserApi { } /** - * Get user by user name * + * @summary Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ public getUserByName(username: string, extraHttpRequestParams?: any): Observable { @@ -122,8 +122,8 @@ export class UserApi { } /** - * Logs user into the system * + * @summary Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ @@ -139,8 +139,8 @@ export class UserApi { } /** - * Logs out current logged in user session * + * @summary Logs out current logged in user session */ public logoutUser(extraHttpRequestParams?: any): Observable<{}> { return this.logoutUserWithHttpInfo(extraHttpRequestParams) @@ -154,8 +154,8 @@ export class UserApi { } /** - * Updated user * This can only be done by the logged in user. + * @summary Updated user * @param username name that need to be deleted * @param body Updated user object */ diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index e5238eda30d..2d53ef4fcd2 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -42,8 +42,8 @@ export class PetApi { } /** - * Add a new pet to the store * + * @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): Observable<{}> { @@ -58,8 +58,8 @@ export class PetApi { } /** - * Deletes a pet * + * @summary Deletes a pet * @param petId Pet id to delete * @param apiKey */ @@ -75,8 +75,8 @@ export class PetApi { } /** - * Finds Pets by status * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { @@ -91,8 +91,8 @@ export class PetApi { } /** - * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags * @param tags Tags to filter by */ public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { @@ -107,8 +107,8 @@ export class PetApi { } /** - * Find pet by ID * Returns a single pet + * @summary Find pet by ID * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { @@ -123,8 +123,8 @@ export class PetApi { } /** - * Update an existing pet * + * @summary Update an existing pet * @param body Pet object that needs to be added to the store */ public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { @@ -139,8 +139,8 @@ export class PetApi { } /** - * Updates a pet in the store with form data * + * @summary Updates a pet in the store with form data * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet @@ -157,8 +157,8 @@ export class PetApi { } /** - * uploads an image * + * @summary uploads an image * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload diff --git a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts index a4257efc440..d98c2c2047c 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts @@ -42,8 +42,8 @@ export class StoreApi { } /** - * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> { @@ -58,8 +58,8 @@ export class StoreApi { } /** - * Returns pet inventories by status * Returns a map of status codes to quantities + * @summary Returns pet inventories by status */ public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> { return this.getInventoryWithHttpInfo(extraHttpRequestParams) @@ -73,8 +73,8 @@ export class StoreApi { } /** - * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { @@ -89,8 +89,8 @@ export class StoreApi { } /** - * Place an order for a pet * + * @summary Place an order for a pet * @param body order placed for purchasing the pet */ public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { diff --git a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts index 681d5849424..4e7bcfbaf09 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts @@ -42,8 +42,8 @@ export class UserApi { } /** - * Create user * This can only be done by the logged in user. + * @summary Create user * @param body Created user object */ public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { @@ -58,8 +58,8 @@ export class UserApi { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -74,8 +74,8 @@ export class UserApi { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -90,8 +90,8 @@ export class UserApi { } /** - * Delete user * This can only be done by the logged in user. + * @summary Delete user * @param username The name that needs to be deleted */ public deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}> { @@ -106,8 +106,8 @@ export class UserApi { } /** - * Get user by user name * + * @summary Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ public getUserByName(username: string, extraHttpRequestParams?: any): Observable { @@ -122,8 +122,8 @@ export class UserApi { } /** - * Logs user into the system * + * @summary Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ @@ -139,8 +139,8 @@ export class UserApi { } /** - * Logs out current logged in user session * + * @summary Logs out current logged in user session */ public logoutUser(extraHttpRequestParams?: any): Observable<{}> { return this.logoutUserWithHttpInfo(extraHttpRequestParams) @@ -154,8 +154,8 @@ export class UserApi { } /** - * Updated user * This can only be done by the logged in user. + * @summary Updated user * @param username name that need to be deleted * @param body Updated user object */ diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts index a87a3ba3edb..47593a22a8a 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts @@ -43,8 +43,8 @@ export class PetApi implements PetApiInterface { } /** - * Add a new pet to the store * + * @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): Observable<{}> { @@ -59,8 +59,8 @@ export class PetApi implements PetApiInterface { } /** - * Deletes a pet * + * @summary Deletes a pet * @param petId Pet id to delete * @param apiKey */ @@ -76,8 +76,8 @@ export class PetApi implements PetApiInterface { } /** - * Finds Pets by status * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status * @param status Status values that need to be considered for filter */ public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { @@ -92,8 +92,8 @@ export class PetApi implements PetApiInterface { } /** - * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags * @param tags Tags to filter by */ public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { @@ -108,8 +108,8 @@ export class PetApi implements PetApiInterface { } /** - * Find pet by ID * Returns a single pet + * @summary Find pet by ID * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { @@ -124,8 +124,8 @@ export class PetApi implements PetApiInterface { } /** - * Update an existing pet * + * @summary Update an existing pet * @param body Pet object that needs to be added to the store */ public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { @@ -140,8 +140,8 @@ export class PetApi implements PetApiInterface { } /** - * Updates a pet in the store with form data * + * @summary Updates a pet in the store with form data * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet @@ -158,8 +158,8 @@ export class PetApi implements PetApiInterface { } /** - * uploads an image * + * @summary uploads an image * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts index 4de8fdc315a..11ae6b687a6 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts @@ -43,8 +43,8 @@ export class StoreApi implements StoreApiInterface { } /** - * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> { @@ -59,8 +59,8 @@ export class StoreApi implements StoreApiInterface { } /** - * Returns pet inventories by status * Returns a map of status codes to quantities + * @summary Returns pet inventories by status */ public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> { return this.getInventoryWithHttpInfo(extraHttpRequestParams) @@ -74,8 +74,8 @@ export class StoreApi implements StoreApiInterface { } /** - * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { @@ -90,8 +90,8 @@ export class StoreApi implements StoreApiInterface { } /** - * Place an order for a pet * + * @summary Place an order for a pet * @param body order placed for purchasing the pet */ public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts index 318c7ba6094..4fddd4c0902 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts @@ -43,8 +43,8 @@ export class UserApi implements UserApiInterface { } /** - * Create user * This can only be done by the logged in user. + * @summary Create user * @param body Created user object */ public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { @@ -59,8 +59,8 @@ export class UserApi implements UserApiInterface { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -75,8 +75,8 @@ export class UserApi implements UserApiInterface { } /** - * Creates list of users with given input array * + * @summary Creates list of users with given input array * @param body List of user object */ public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { @@ -91,8 +91,8 @@ export class UserApi implements UserApiInterface { } /** - * Delete user * This can only be done by the logged in user. + * @summary Delete user * @param username The name that needs to be deleted */ public deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}> { @@ -107,8 +107,8 @@ export class UserApi implements UserApiInterface { } /** - * Get user by user name * + * @summary Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ public getUserByName(username: string, extraHttpRequestParams?: any): Observable { @@ -123,8 +123,8 @@ export class UserApi implements UserApiInterface { } /** - * Logs user into the system * + * @summary Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ @@ -140,8 +140,8 @@ export class UserApi implements UserApiInterface { } /** - * Logs out current logged in user session * + * @summary Logs out current logged in user session */ public logoutUser(extraHttpRequestParams?: any): Observable<{}> { return this.logoutUserWithHttpInfo(extraHttpRequestParams) @@ -155,8 +155,8 @@ export class UserApi implements UserApiInterface { } /** - * Updated user * This can only be done by the logged in user. + * @summary Updated user * @param username name that need to be deleted * @param body Updated user object */