Skip to content

Commit ba704e3

Browse files
authored
add @summary tag to ts client (#6052)
1 parent fdaf8ea commit ba704e3

File tree

15 files changed

+740
-718
lines changed

15 files changed

+740
-718
lines changed

modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ export type {{{enumName}}} = {{#allowableValues}}{{#values}}"{{{.}}}"{{^-last}}
7272
*/
7373
export const {{classname}}FetchParamCreator = {
7474
{{#operation}}
75-
/** {{#summary}}
76-
* {{summary}}{{/summary}}{{#notes}}
77-
* {{notes}}{{/notes}}{{#allParams}}
78-
* @param {{paramName}} {{description}}{{/allParams}}
75+
/**
76+
* {{&notes}}
77+
{{#summary}}
78+
* @summary {{&summary}}
79+
{{/summary}}
80+
{{#allParams}}
81+
* @param {{paramName}} {{description}}
82+
{{/allParams}}
7983
*/
8084
{{nickname}}({{#hasParams}}params: { {{#allParams}} "{{paramName}}"{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}options?: any): FetchArgs {
8185
{{#allParams}}
@@ -137,10 +141,14 @@ export const {{classname}}FetchParamCreator = {
137141
*/
138142
export const {{classname}}Fp = {
139143
{{#operation}}
140-
/** {{#summary}}
141-
* {{summary}}{{/summary}}{{#notes}}
142-
* {{notes}}{{/notes}}{{#allParams}}
143-
* @param {{paramName}} {{description}}{{/allParams}}
144+
/**
145+
* {{&notes}}
146+
{{#summary}}
147+
* @summary {{&summary}}
148+
{{/summary}}
149+
{{#allParams}}
150+
* @param {{paramName}} {{description}}
151+
{{/allParams}}
144152
*/
145153
{{nickname}}({{#hasParams}}params: { {{#allParams}}"{{paramName}}"{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} }, {{/hasParams}}options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> {
146154
const fetchArgs = {{classname}}FetchParamCreator.{{nickname}}({{#hasParams}}params, {{/hasParams}}options);
@@ -163,10 +171,14 @@ export const {{classname}}Fp = {
163171
*/
164172
export class {{classname}} extends BaseAPI {
165173
{{#operation}}
166-
/** {{#summary}}
167-
* {{summary}}{{/summary}}{{#notes}}
168-
* {{notes}}{{/notes}}{{#allParams}}
169-
* @param {{paramName}} {{description}}{{/allParams}}
174+
/**
175+
* {{&notes}}
176+
{{#summary}}
177+
* @summary {{&summary}}
178+
{{/summary}}
179+
{{#allParams}}
180+
* @param {{paramName}} {{description}}
181+
{{/allParams}}
170182
*/
171183
{{nickname}}({{#hasParams}}params: { {{#allParams}} "{{paramName}}"{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}options?: any) {
172184
return {{classname}}Fp.{{nickname}}({{#hasParams}}params, {{/hasParams}}options)(this.fetch, this.basePath);
@@ -181,10 +193,14 @@ export class {{classname}} extends BaseAPI {
181193
export const {{classname}}Factory = function (fetch?: FetchAPI, basePath?: string) {
182194
return {
183195
{{#operation}}
184-
/** {{#summary}}
185-
* {{summary}}{{/summary}}{{#notes}}
186-
* {{notes}}{{/notes}}{{#allParams}}
187-
* @param {{paramName}} {{description}}{{/allParams}}
196+
/**
197+
* {{&notes}}
198+
{{#summary}}
199+
* @summary {{&summary}}
200+
{{/summary}}
201+
{{#allParams}}
202+
* @param {{paramName}} {{description}}
203+
{{/allParams}}
188204
*/
189205
{{nickname}}({{#hasParams}}params: { {{#allParams}} "{{paramName}}"{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}options?: any) {
190206
return {{classname}}Fp.{{nickname}}({{#hasParams}}params, {{/hasParams}}options)(fetch, basePath);

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ export class {{classname}} {
2323

2424
{{#operation}}
2525
/**
26-
* {{summary}}
27-
* {{notes}}
28-
{{#allParams}}* @param {{paramName}} {{description}}
29-
{{/allParams}}*/
26+
* {{&notes}}
27+
{{#summary}}
28+
* @summary {{&summary}}
29+
{{/summary}}
30+
{{#allParams}}* @param {{paramName}} {{description}}
31+
{{/allParams}}*/
3032
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
3133
const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
3234
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class {{classname}} {
4646

4747
{{#operation}}
4848
/**
49-
* {{notes}}
49+
* {{&notes}}
5050
{{#summary}}
5151
* @summary {{&summary}}
5252
{{/summary}}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ export class {{classname}} {
178178

179179
{{#operation}}
180180
/**
181-
* {{summary}}
182-
* {{notes}}
181+
* {{&notes}}
182+
{{#summary}}
183+
* @summary {{&summary}}
184+
{{/summary}}
183185
{{#allParams}}* @param {{paramName}} {{description}}
184186
{{/allParams}}*/
185187
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ export class {{classname}} {
197197
{{/authMethods}}
198198
{{#operation}}
199199
/**
200-
* {{summary}}
201-
* {{notes}}
200+
* {{&notes}}
201+
{{#summary}}
202+
* @summary {{&summary}}
203+
{{/summary}}
202204
{{#allParams}}* @param {{paramName}} {{description}}
203205
{{/allParams}}*/
204206
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {

samples/client/petstore/typescript-angular/api/PetApi.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export class PetApi {
2727
}
2828

2929
/**
30-
* Add a new pet to the store
31-
*
32-
* @param body Pet object that needs to be added to the store
33-
*/
30+
*
31+
* @summary Add a new pet to the store
32+
* @param body Pet object that needs to be added to the store
33+
*/
3434
public addPet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
3535
const localVarPath = this.basePath + '/pet';
3636

@@ -51,11 +51,11 @@ export class PetApi {
5151
return this.$http(httpRequestParams);
5252
}
5353
/**
54-
* Deletes a pet
55-
*
56-
* @param petId Pet id to delete
57-
* @param apiKey
58-
*/
54+
*
55+
* @summary Deletes a pet
56+
* @param petId Pet id to delete
57+
* @param apiKey
58+
*/
5959
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
6060
const localVarPath = this.basePath + '/pet/{petId}'
6161
.replace('{' + 'petId' + '}', String(petId));
@@ -82,10 +82,10 @@ export class PetApi {
8282
return this.$http(httpRequestParams);
8383
}
8484
/**
85-
* Finds Pets by status
86-
* Multiple status values can be provided with comma separated strings
87-
* @param status Status values that need to be considered for filter
88-
*/
85+
* Multiple status values can be provided with comma separated strings
86+
* @summary Finds Pets by status
87+
* @param status Status values that need to be considered for filter
88+
*/
8989
public findPetsByStatus (status?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
9090
const localVarPath = this.basePath + '/pet/findByStatus';
9191

@@ -109,10 +109,10 @@ export class PetApi {
109109
return this.$http(httpRequestParams);
110110
}
111111
/**
112-
* Finds Pets by tags
113-
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
114-
* @param tags Tags to filter by
115-
*/
112+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
113+
* @summary Finds Pets by tags
114+
* @param tags Tags to filter by
115+
*/
116116
public findPetsByTags (tags?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
117117
const localVarPath = this.basePath + '/pet/findByTags';
118118

@@ -136,10 +136,10 @@ export class PetApi {
136136
return this.$http(httpRequestParams);
137137
}
138138
/**
139-
* Find pet by ID
140-
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
141-
* @param petId ID of pet that needs to be fetched
142-
*/
139+
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
140+
* @summary Find pet by ID
141+
* @param petId ID of pet that needs to be fetched
142+
*/
143143
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Pet> {
144144
const localVarPath = this.basePath + '/pet/{petId}'
145145
.replace('{' + 'petId' + '}', String(petId));
@@ -164,10 +164,10 @@ export class PetApi {
164164
return this.$http(httpRequestParams);
165165
}
166166
/**
167-
* Update an existing pet
168-
*
169-
* @param body Pet object that needs to be added to the store
170-
*/
167+
*
168+
* @summary Update an existing pet
169+
* @param body Pet object that needs to be added to the store
170+
*/
171171
public updatePet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
172172
const localVarPath = this.basePath + '/pet';
173173

@@ -188,12 +188,12 @@ export class PetApi {
188188
return this.$http(httpRequestParams);
189189
}
190190
/**
191-
* Updates a pet in the store with form data
192-
*
193-
* @param petId ID of pet that needs to be updated
194-
* @param name Updated name of the pet
195-
* @param status Updated status of the pet
196-
*/
191+
*
192+
* @summary Updates a pet in the store with form data
193+
* @param petId ID of pet that needs to be updated
194+
* @param name Updated name of the pet
195+
* @param status Updated status of the pet
196+
*/
197197
public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
198198
const localVarPath = this.basePath + '/pet/{petId}'
199199
.replace('{' + 'petId' + '}', String(petId));
@@ -227,12 +227,12 @@ export class PetApi {
227227
return this.$http(httpRequestParams);
228228
}
229229
/**
230-
* uploads an image
231-
*
232-
* @param petId ID of pet to update
233-
* @param additionalMetadata Additional data to pass to server
234-
* @param file file to upload
235-
*/
230+
*
231+
* @summary uploads an image
232+
* @param petId ID of pet to update
233+
* @param additionalMetadata Additional data to pass to server
234+
* @param file file to upload
235+
*/
236236
public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
237237
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
238238
.replace('{' + 'petId' + '}', String(petId));

samples/client/petstore/typescript-angular/api/StoreApi.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export class StoreApi {
2727
}
2828

2929
/**
30-
* Delete purchase order by ID
31-
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
32-
* @param orderId ID of the order that needs to be deleted
33-
*/
30+
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
31+
* @summary Delete purchase order by ID
32+
* @param orderId ID of the order that needs to be deleted
33+
*/
3434
public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
3535
const localVarPath = this.basePath + '/store/order/{orderId}'
3636
.replace('{' + 'orderId' + '}', String(orderId));
@@ -55,9 +55,9 @@ export class StoreApi {
5555
return this.$http(httpRequestParams);
5656
}
5757
/**
58-
* Returns pet inventories by status
59-
* Returns a map of status codes to quantities
60-
*/
58+
* Returns a map of status codes to quantities
59+
* @summary Returns pet inventories by status
60+
*/
6161
public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> {
6262
const localVarPath = this.basePath + '/store/inventory';
6363

@@ -77,10 +77,10 @@ export class StoreApi {
7777
return this.$http(httpRequestParams);
7878
}
7979
/**
80-
* Find purchase order by ID
81-
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
82-
* @param orderId ID of pet that needs to be fetched
83-
*/
80+
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
81+
* @summary Find purchase order by ID
82+
* @param orderId ID of pet that needs to be fetched
83+
*/
8484
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
8585
const localVarPath = this.basePath + '/store/order/{orderId}'
8686
.replace('{' + 'orderId' + '}', String(orderId));
@@ -105,10 +105,10 @@ export class StoreApi {
105105
return this.$http(httpRequestParams);
106106
}
107107
/**
108-
* Place an order for a pet
109-
*
110-
* @param body order placed for purchasing the pet
111-
*/
108+
*
109+
* @summary Place an order for a pet
110+
* @param body order placed for purchasing the pet
111+
*/
112112
public placeOrder (body?: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
113113
const localVarPath = this.basePath + '/store/order';
114114

0 commit comments

Comments
 (0)