Skip to content

Commit

Permalink
[Typescript-Angular2] add @summary JSDoc tag (#6028)
Browse files Browse the repository at this point in the history
* add @summary JSDoc tag

* updatee sample and create windows script for typescript-angular2

* Fix for Review
  • Loading branch information
isman-usoh authored and wing328 committed Jul 13, 2017
1 parent 2a5913c commit fdaf8ea
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 61 deletions.
18 changes: 18 additions & 0 deletions bin/windows/typescript-angular2-all.bat
Original file line number Diff line number Diff line change
@@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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}}> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<{}> {
Expand All @@ -58,8 +58,8 @@ export class PetApi {
}

/**
* Deletes a pet
*
* @summary Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
Expand All @@ -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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
Expand All @@ -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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
Expand All @@ -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<models.Pet> {
Expand All @@ -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<{}> {
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class StoreApi {
}

/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 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<{}> {
Expand All @@ -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)
Expand All @@ -73,8 +73,8 @@ export class StoreApi {
}

/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 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<models.Order> {
Expand All @@ -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<models.Order> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<{}> {
Expand All @@ -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<models.User>, extraHttpRequestParams?: any): Observable<{}> {
Expand All @@ -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<models.User>, extraHttpRequestParams?: any): Observable<{}> {
Expand All @@ -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<{}> {
Expand All @@ -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<models.User> {
Expand All @@ -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
*/
Expand All @@ -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)
Expand All @@ -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
*/
Expand Down
16 changes: 8 additions & 8 deletions samples/client/petstore/typescript-angular2/npm/api/PetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{}> {
Expand All @@ -58,8 +58,8 @@ export class PetApi {
}

/**
* Deletes a pet
*
* @summary Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
Expand All @@ -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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
Expand All @@ -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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
Expand All @@ -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<models.Pet> {
Expand All @@ -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<{}> {
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class StoreApi {
}

/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 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<{}> {
Expand All @@ -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)
Expand All @@ -73,8 +73,8 @@ export class StoreApi {
}

/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 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<models.Order> {
Expand All @@ -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<models.Order> {
Expand Down
Loading

0 comments on commit fdaf8ea

Please sign in to comment.