Skip to content

Commit 1d07128

Browse files
authored
use path from spec in ts angular documentation (#22194)
1 parent 816befc commit 1d07128

File tree

54 files changed

+158
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+158
-155
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap operations, L
461461
}
462462
}
463463

464+
// backup path in extensions
465+
op.vendorExtensions.put("x-path-from-spec", op.path);
466+
464467
// Overwrite path to TypeScript template string, after applying everything we just did.
465468
op.path = pathBuffer.toString();
466469
}

modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class {{classname}} extends BaseService {
7474
{{#notes}}
7575
* {{.}}
7676
{{/notes}}
77-
* @endpoint {{httpMethod}} {{{path}}}
77+
* @endpoint {{httpMethod}} {{{vendorExtensions.x-path-from-spec}}}
7878
{{^useSingleRequestParameter}}
7979
{{#allParams}}
8080
* @param {{paramName}} {{description}}

modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface {{classname}}Interface {
3838
/**
3939
* {{summary}}
4040
* {{notes}}
41-
* @endpoint {{httpMethod}} {{{path}}}
41+
* @endpoint {{httpMethod}} {{{vendorExtensions.x-path-from-spec}}}
4242
{{^useSingleRequestParameter}}
4343
{{#allParams}}* @param {{paramName}} {{description}}
4444
{{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}* @param requestParameters

samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/pet.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class PetService extends BaseService {
104104

105105
/**
106106
* Deletes a pet
107-
* @endpoint delete /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
107+
* @endpoint delete /pet/{petId}
108108
* @param petId Pet id to delete
109109
* @param apiKey
110110
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
@@ -292,7 +292,7 @@ export class PetService extends BaseService {
292292
/**
293293
* Find pet by ID
294294
* Returns a single pet
295-
* @endpoint get /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
295+
* @endpoint get /pet/{petId}
296296
* @param petId ID of pet to return
297297
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
298298
* @param reportProgress flag to report request and response progress.
@@ -413,7 +413,7 @@ export class PetService extends BaseService {
413413

414414
/**
415415
* Updates a pet in the store with form data
416-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
416+
* @endpoint post /pet/{petId}
417417
* @param petId ID of pet that needs to be updated
418418
* @param name Updated name of the pet
419419
* @param status Updated status of the pet
@@ -492,7 +492,7 @@ export class PetService extends BaseService {
492492

493493
/**
494494
* uploads an image
495-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage
495+
* @endpoint post /pet/{petId}/uploadImage
496496
* @param petId ID of pet to update
497497
* @param additionalMetadata Additional data to pass to server
498498
* @param file file to upload

samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/store.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class StoreService extends BaseService {
3838
/**
3939
* Delete purchase order by ID
4040
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
41-
* @endpoint delete /store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
41+
* @endpoint delete /store/order/{orderId}
4242
* @param orderId ID of the order that needs to be deleted
4343
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
4444
* @param reportProgress flag to report request and response progress.
@@ -142,7 +142,7 @@ export class StoreService extends BaseService {
142142
/**
143143
* Find purchase order by ID
144144
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
145-
* @endpoint get /store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
145+
* @endpoint get /store/order/{orderId}
146146
* @param orderId ID of pet that needs to be fetched
147147
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
148148
* @param reportProgress flag to report request and response progress.

samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/user.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class UserService extends BaseService {
219219
/**
220220
* Delete user
221221
* This can only be done by the logged in user.
222-
* @endpoint delete /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
222+
* @endpoint delete /user/{username}
223223
* @param username The name that needs to be deleted
224224
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
225225
* @param reportProgress flag to report request and response progress.
@@ -270,7 +270,7 @@ export class UserService extends BaseService {
270270

271271
/**
272272
* Get user by user name
273-
* @endpoint get /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
273+
* @endpoint get /user/{username}
274274
* @param username The name that needs to be fetched. Use user1 for testing.
275275
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
276276
* @param reportProgress flag to report request and response progress.
@@ -435,7 +435,7 @@ export class UserService extends BaseService {
435435
/**
436436
* Updated user
437437
* This can only be done by the logged in user.
438-
* @endpoint put /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
438+
* @endpoint put /user/{username}
439439
* @param username name that need to be deleted
440440
* @param body Updated user object
441441
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.

samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class PetService extends BaseService {
104104

105105
/**
106106
* Deletes a pet
107-
* @endpoint delete /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
107+
* @endpoint delete /pet/{petId}
108108
* @param petId Pet id to delete
109109
* @param apiKey
110110
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
@@ -292,7 +292,7 @@ export class PetService extends BaseService {
292292
/**
293293
* Find pet by ID
294294
* Returns a single pet
295-
* @endpoint get /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
295+
* @endpoint get /pet/{petId}
296296
* @param petId ID of pet to return
297297
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
298298
* @param reportProgress flag to report request and response progress.
@@ -413,7 +413,7 @@ export class PetService extends BaseService {
413413

414414
/**
415415
* Updates a pet in the store with form data
416-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
416+
* @endpoint post /pet/{petId}
417417
* @param petId ID of pet that needs to be updated
418418
* @param name Updated name of the pet
419419
* @param status Updated status of the pet
@@ -492,7 +492,7 @@ export class PetService extends BaseService {
492492

493493
/**
494494
* uploads an image
495-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage
495+
* @endpoint post /pet/{petId}/uploadImage
496496
* @param petId ID of pet to update
497497
* @param additionalMetadata Additional data to pass to server
498498
* @param file file to upload

samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class StoreService extends BaseService {
3838
/**
3939
* Delete purchase order by ID
4040
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
41-
* @endpoint delete /store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
41+
* @endpoint delete /store/order/{orderId}
4242
* @param orderId ID of the order that needs to be deleted
4343
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
4444
* @param reportProgress flag to report request and response progress.
@@ -142,7 +142,7 @@ export class StoreService extends BaseService {
142142
/**
143143
* Find purchase order by ID
144144
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
145-
* @endpoint get /store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
145+
* @endpoint get /store/order/{orderId}
146146
* @param orderId ID of pet that needs to be fetched
147147
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
148148
* @param reportProgress flag to report request and response progress.

samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class UserService extends BaseService {
219219
/**
220220
* Delete user
221221
* This can only be done by the logged in user.
222-
* @endpoint delete /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
222+
* @endpoint delete /user/{username}
223223
* @param username The name that needs to be deleted
224224
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
225225
* @param reportProgress flag to report request and response progress.
@@ -270,7 +270,7 @@ export class UserService extends BaseService {
270270

271271
/**
272272
* Get user by user name
273-
* @endpoint get /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
273+
* @endpoint get /user/{username}
274274
* @param username The name that needs to be fetched. Use user1 for testing.
275275
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
276276
* @param reportProgress flag to report request and response progress.
@@ -435,7 +435,7 @@ export class UserService extends BaseService {
435435
/**
436436
* Updated user
437437
* This can only be done by the logged in user.
438-
* @endpoint put /user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}
438+
* @endpoint put /user/{username}
439439
* @param username name that need to be deleted
440440
* @param body Updated user object
441441
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.

samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class PetService extends BaseService {
104104

105105
/**
106106
* Deletes a pet
107-
* @endpoint delete /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
107+
* @endpoint delete /pet/{petId}
108108
* @param petId Pet id to delete
109109
* @param apiKey
110110
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
@@ -292,7 +292,7 @@ export class PetService extends BaseService {
292292
/**
293293
* Find pet by ID
294294
* Returns a single pet
295-
* @endpoint get /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
295+
* @endpoint get /pet/{petId}
296296
* @param petId ID of pet to return
297297
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
298298
* @param reportProgress flag to report request and response progress.
@@ -413,7 +413,7 @@ export class PetService extends BaseService {
413413

414414
/**
415415
* Updates a pet in the store with form data
416-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}
416+
* @endpoint post /pet/{petId}
417417
* @param petId ID of pet that needs to be updated
418418
* @param name Updated name of the pet
419419
* @param status Updated status of the pet
@@ -492,7 +492,7 @@ export class PetService extends BaseService {
492492

493493
/**
494494
* uploads an image
495-
* @endpoint post /pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage
495+
* @endpoint post /pet/{petId}/uploadImage
496496
* @param petId ID of pet to update
497497
* @param additionalMetadata Additional data to pass to server
498498
* @param file file to upload

0 commit comments

Comments
 (0)