Skip to content

Commit 590f7f3

Browse files
author
Dirk Niemeier
committed
feat(typescript-rxjs): Add @deprecated tag to generated API operations
This commit introduces the JSDoc @deprecated tag to API operations in the typescript-rxjs generator when the operation is marked as deprecated in the OpenAPI specification. This ensures that IDEs (like VS Code or WebStorm) correctly flag the method as deprecated, providing better developer experience and warning consumers about upcoming removals or changes.
1 parent 2c7efda commit 590f7f3

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export class {{classname}} extends BaseAPI {
3939
{{#summary}}
4040
* {{&summary}}
4141
{{/summary}}
42+
{{#isDeprecated}}
43+
* @deprecated
44+
{{/isDeprecated}}
4245
*/
46+
{{#isDeprecated}}
47+
/** @deprecated */
48+
{{/isDeprecated}}
4349
{{nickname}}({{#allParams.0}}{ {{#allParams}}{{paramName}}{{#vendorExtensions.x-param-name-alternative}}: {{vendorExtensions.x-param-name-alternative}}{{/vendorExtensions.x-param-name-alternative}}{{^-last}}, {{/-last}}{{/allParams}} }: {{operationIdCamelCase}}Request{{/allParams.0}}): Observable<{{{returnType}}}{{^returnType}}void{{/returnType}}>
4450
{{#withProgressSubscriber}}
4551
{{nickname}}({{#allParams.0}}{ {{#allParams}}{{paramName}}{{#vendorExtensions.x-param-name-alternative}}: {{vendorExtensions.x-param-name-alternative}}{{/vendorExtensions.x-param-name-alternative}}{{^-last}}, {{/-last}}{{/allParams}} }: {{operationIdCamelCase}}Request, {{/allParams.0}}opts?: Pick<OperationOpts, 'progressSubscriber'>): Observable<{{{returnType}}}{{^returnType}}void{{/returnType}}>
@@ -244,4 +250,4 @@ export enum {{operationIdCamelCase}}{{enumName}} {
244250
{{/allParams}}
245251
{{/operation}}
246252
{{/operations}}
247-
{{/hasEnums}}
253+
{{/hasEnums}}

modules/openapi-generator/src/main/resources/typescript-rxjs/modelAllOf.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ import type {
1010
* @type {{classname}}{{#description}}
1111
* {{{.}}}{{/description}}
1212
* @export
13+
{{#deprecated}}
14+
* @deprecated
15+
{{/deprecated}}
1316
*/
1417
export type {{classname}} = {{#allOf}}{{{.}}}{{^-last}} & {{/-last}}{{/allOf}};

modules/openapi-generator/src/main/resources/typescript-rxjs/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* {{{description}}}
33
* @export
44
* @enum {string}
5+
{{#deprecated}}
6+
* @deprecated
7+
{{/deprecated}}
58
*/
69
export enum {{classname}} {
710
{{#allowableValues}}

modules/openapi-generator/src/main/resources/typescript-rxjs/modelGeneric.mustache

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import type {
1010
* {{{.}}}{{/description}}
1111
* @export
1212
* @interface {{classname}}
13+
{{#deprecated}}
14+
* @deprecated
15+
{{/deprecated}}
1316
*/
1417
export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
1518
{{#additionalPropertiesType}}
@@ -18,6 +21,9 @@ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
1821
{{#vars}}
1922
/**{{#description}}
2023
* {{{.}}}{{/description}}
24+
{{#deprecated}}
25+
* @deprecated
26+
{{/deprecated}}
2127
* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>
2228
* @memberof {{classname}}
2329
*/
@@ -30,6 +36,9 @@ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
3036
/**
3137
* @export
3238
* @enum {string}
39+
{{#deprecated}}
40+
* @deprecated
41+
{{/deprecated}}
3342
*/
3443
export enum {{classname}}{{enumName}} {
3544
{{#allowableValues}}

modules/openapi-generator/src/main/resources/typescript-rxjs/modelOneOf.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ import type {
1010
* @type {{classname}}{{#description}}
1111
* {{{.}}}{{/description}}
1212
* @export
13+
{{#deprecated}}
14+
* @deprecated
15+
{{/deprecated}}
1316
*/
1417
export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}};

0 commit comments

Comments
 (0)