Skip to content

Commit fdaf8ea

Browse files
isman-usohwing328
authored andcommitted
[Typescript-Angular2] add @summary JSDoc tag (#6028)
* add @summary JSDoc tag * updatee sample and create windows script for typescript-angular2 * Fix for Review
1 parent 2a5913c commit fdaf8ea

File tree

11 files changed

+81
-61
lines changed

11 files changed

+81
-61
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
8+
echo "Typescript Petstore API client (default)"
9+
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-angular2 -o samples\client\petstore\typescript-angular2\default
10+
java %JAVA_OPTS% -jar %executable% %ags%
11+
12+
echo "Typescript Petstore API client (with interfaces generated)"
13+
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
14+
java %JAVA_OPTS% -jar %executable% %ags%
15+
16+
echo "Typescript Petstore API client (npm setting)"
17+
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
18+
java %JAVA_OPTS% -jar %executable% %ags%

modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ export class {{classname}} {
4646

4747
{{#operation}}
4848
/**
49-
* {{summary}}
5049
* {{notes}}
50+
{{#summary}}
51+
* @summary {{&summary}}
52+
{{/summary}}
5153
{{#allParams}}* @param {{paramName}} {{description}}
5254
{{/allParams}}*/
5355
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {

samples/client/petstore/typescript-angular2/default/api/PetApi.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class PetApi {
4242
}
4343

4444
/**
45-
* Add a new pet to the store
4645
*
46+
* @summary Add a new pet to the store
4747
* @param body Pet object that needs to be added to the store
4848
*/
4949
public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
@@ -58,8 +58,8 @@ export class PetApi {
5858
}
5959

6060
/**
61-
* Deletes a pet
6261
*
62+
* @summary Deletes a pet
6363
* @param petId Pet id to delete
6464
* @param apiKey
6565
*/
@@ -75,8 +75,8 @@ export class PetApi {
7575
}
7676

7777
/**
78-
* Finds Pets by status
7978
* Multiple status values can be provided with comma separated strings
79+
* @summary Finds Pets by status
8080
* @param status Status values that need to be considered for filter
8181
*/
8282
public findPetsByStatus(status: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
@@ -91,8 +91,8 @@ export class PetApi {
9191
}
9292

9393
/**
94-
* Finds Pets by tags
9594
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
95+
* @summary Finds Pets by tags
9696
* @param tags Tags to filter by
9797
*/
9898
public findPetsByTags(tags: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
@@ -107,8 +107,8 @@ export class PetApi {
107107
}
108108

109109
/**
110-
* Find pet by ID
111110
* Returns a single pet
111+
* @summary Find pet by ID
112112
* @param petId ID of pet to return
113113
*/
114114
public getPetById(petId: number, extraHttpRequestParams?: any): Observable<models.Pet> {
@@ -123,8 +123,8 @@ export class PetApi {
123123
}
124124

125125
/**
126-
* Update an existing pet
127126
*
127+
* @summary Update an existing pet
128128
* @param body Pet object that needs to be added to the store
129129
*/
130130
public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
@@ -139,8 +139,8 @@ export class PetApi {
139139
}
140140

141141
/**
142-
* Updates a pet in the store with form data
143142
*
143+
* @summary Updates a pet in the store with form data
144144
* @param petId ID of pet that needs to be updated
145145
* @param name Updated name of the pet
146146
* @param status Updated status of the pet
@@ -157,8 +157,8 @@ export class PetApi {
157157
}
158158

159159
/**
160-
* uploads an image
161160
*
161+
* @summary uploads an image
162162
* @param petId ID of pet to update
163163
* @param additionalMetadata Additional data to pass to server
164164
* @param file file to upload

samples/client/petstore/typescript-angular2/default/api/StoreApi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class StoreApi {
4242
}
4343

4444
/**
45-
* Delete purchase order by ID
4645
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
46+
* @summary Delete purchase order by ID
4747
* @param orderId ID of the order that needs to be deleted
4848
*/
4949
public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> {
@@ -58,8 +58,8 @@ export class StoreApi {
5858
}
5959

6060
/**
61-
* Returns pet inventories by status
6261
* Returns a map of status codes to quantities
62+
* @summary Returns pet inventories by status
6363
*/
6464
public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> {
6565
return this.getInventoryWithHttpInfo(extraHttpRequestParams)
@@ -73,8 +73,8 @@ export class StoreApi {
7373
}
7474

7575
/**
76-
* Find purchase order by ID
7776
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
77+
* @summary Find purchase order by ID
7878
* @param orderId ID of pet that needs to be fetched
7979
*/
8080
public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable<models.Order> {
@@ -89,8 +89,8 @@ export class StoreApi {
8989
}
9090

9191
/**
92-
* Place an order for a pet
9392
*
93+
* @summary Place an order for a pet
9494
* @param body order placed for purchasing the pet
9595
*/
9696
public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {

samples/client/petstore/typescript-angular2/default/api/UserApi.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class UserApi {
4242
}
4343

4444
/**
45-
* Create user
4645
* This can only be done by the logged in user.
46+
* @summary Create user
4747
* @param body Created user object
4848
*/
4949
public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
@@ -58,8 +58,8 @@ export class UserApi {
5858
}
5959

6060
/**
61-
* Creates list of users with given input array
6261
*
62+
* @summary Creates list of users with given input array
6363
* @param body List of user object
6464
*/
6565
public createUsersWithArrayInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
@@ -74,8 +74,8 @@ export class UserApi {
7474
}
7575

7676
/**
77-
* Creates list of users with given input array
7877
*
78+
* @summary Creates list of users with given input array
7979
* @param body List of user object
8080
*/
8181
public createUsersWithListInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
@@ -90,8 +90,8 @@ export class UserApi {
9090
}
9191

9292
/**
93-
* Delete user
9493
* This can only be done by the logged in user.
94+
* @summary Delete user
9595
* @param username The name that needs to be deleted
9696
*/
9797
public deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}> {
@@ -106,8 +106,8 @@ export class UserApi {
106106
}
107107

108108
/**
109-
* Get user by user name
110109
*
110+
* @summary Get user by user name
111111
* @param username The name that needs to be fetched. Use user1 for testing.
112112
*/
113113
public getUserByName(username: string, extraHttpRequestParams?: any): Observable<models.User> {
@@ -122,8 +122,8 @@ export class UserApi {
122122
}
123123

124124
/**
125-
* Logs user into the system
126125
*
126+
* @summary Logs user into the system
127127
* @param username The user name for login
128128
* @param password The password for login in clear text
129129
*/
@@ -139,8 +139,8 @@ export class UserApi {
139139
}
140140

141141
/**
142-
* Logs out current logged in user session
143142
*
143+
* @summary Logs out current logged in user session
144144
*/
145145
public logoutUser(extraHttpRequestParams?: any): Observable<{}> {
146146
return this.logoutUserWithHttpInfo(extraHttpRequestParams)
@@ -154,8 +154,8 @@ export class UserApi {
154154
}
155155

156156
/**
157-
* Updated user
158157
* This can only be done by the logged in user.
158+
* @summary Updated user
159159
* @param username name that need to be deleted
160160
* @param body Updated user object
161161
*/

samples/client/petstore/typescript-angular2/npm/api/PetApi.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class PetApi {
4242
}
4343

4444
/**
45-
* Add a new pet to the store
4645
*
46+
* @summary Add a new pet to the store
4747
* @param body Pet object that needs to be added to the store
4848
*/
4949
public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
@@ -58,8 +58,8 @@ export class PetApi {
5858
}
5959

6060
/**
61-
* Deletes a pet
6261
*
62+
* @summary Deletes a pet
6363
* @param petId Pet id to delete
6464
* @param apiKey
6565
*/
@@ -75,8 +75,8 @@ export class PetApi {
7575
}
7676

7777
/**
78-
* Finds Pets by status
7978
* Multiple status values can be provided with comma separated strings
79+
* @summary Finds Pets by status
8080
* @param status Status values that need to be considered for filter
8181
*/
8282
public findPetsByStatus(status: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
@@ -91,8 +91,8 @@ export class PetApi {
9191
}
9292

9393
/**
94-
* Finds Pets by tags
9594
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
95+
* @summary Finds Pets by tags
9696
* @param tags Tags to filter by
9797
*/
9898
public findPetsByTags(tags: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
@@ -107,8 +107,8 @@ export class PetApi {
107107
}
108108

109109
/**
110-
* Find pet by ID
111110
* Returns a single pet
111+
* @summary Find pet by ID
112112
* @param petId ID of pet to return
113113
*/
114114
public getPetById(petId: number, extraHttpRequestParams?: any): Observable<models.Pet> {
@@ -123,8 +123,8 @@ export class PetApi {
123123
}
124124

125125
/**
126-
* Update an existing pet
127126
*
127+
* @summary Update an existing pet
128128
* @param body Pet object that needs to be added to the store
129129
*/
130130
public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
@@ -139,8 +139,8 @@ export class PetApi {
139139
}
140140

141141
/**
142-
* Updates a pet in the store with form data
143142
*
143+
* @summary Updates a pet in the store with form data
144144
* @param petId ID of pet that needs to be updated
145145
* @param name Updated name of the pet
146146
* @param status Updated status of the pet
@@ -157,8 +157,8 @@ export class PetApi {
157157
}
158158

159159
/**
160-
* uploads an image
161160
*
161+
* @summary uploads an image
162162
* @param petId ID of pet to update
163163
* @param additionalMetadata Additional data to pass to server
164164
* @param file file to upload

samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class StoreApi {
4242
}
4343

4444
/**
45-
* Delete purchase order by ID
4645
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
46+
* @summary Delete purchase order by ID
4747
* @param orderId ID of the order that needs to be deleted
4848
*/
4949
public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> {
@@ -58,8 +58,8 @@ export class StoreApi {
5858
}
5959

6060
/**
61-
* Returns pet inventories by status
6261
* Returns a map of status codes to quantities
62+
* @summary Returns pet inventories by status
6363
*/
6464
public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> {
6565
return this.getInventoryWithHttpInfo(extraHttpRequestParams)
@@ -73,8 +73,8 @@ export class StoreApi {
7373
}
7474

7575
/**
76-
* Find purchase order by ID
7776
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
77+
* @summary Find purchase order by ID
7878
* @param orderId ID of pet that needs to be fetched
7979
*/
8080
public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable<models.Order> {
@@ -89,8 +89,8 @@ export class StoreApi {
8989
}
9090

9191
/**
92-
* Place an order for a pet
9392
*
93+
* @summary Place an order for a pet
9494
* @param body order placed for purchasing the pet
9595
*/
9696
public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {

0 commit comments

Comments
 (0)