From 99b5fe9f9c6b54f6ac4ebf5d4a4eb875186366b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Even=20Andr=C3=A9=20Fiskvik?= Date: Mon, 22 Apr 2024 15:24:24 +0200 Subject: [PATCH] [typescript-angular] Add support for marking model properties with @deprecated (#18417) * [typescript-angular] Add support for marking model properties with @deprecated * Add generated samples * Only add comment if description or deprecated is set. And split description/deprecated on two lines if both are set. * Update samples with generated output * Fix indention * Update samples * Remove whitespace * Update samples --- .../resources/typescript-angular/modelGeneric.mustache | 10 +++++++++- .../builds/default/model/pet.ts | 1 + .../builds/with-npm/model/pet.ts | 1 + .../builds/default/model/pet.ts | 1 + .../model/pet.ts | 1 + .../builds/default/model/pet.ts | 1 + .../builds/default/model/pet.ts | 1 + .../builds/default/model/pet.ts | 1 + 8 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache index 43207b65e30..232acaf3ea4 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache @@ -2,9 +2,17 @@ export interface {{classname}}{{#allParents}}{{#-first}} extends {{/-first}}{{{. {{#vars}} {{#description}} /** - * {{{.}}} + * {{{description}}} + {{#deprecated}} + * @deprecated + {{/deprecated}} */ {{/description}} + {{^description}} + {{#deprecated}} + /** @deprecated */ + {{/deprecated}} + {{/description}} {{#isReadOnly}}readonly {{/isReadOnly}}{{{name}}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; {{/vars}} }{{>modelGenericEnums}} diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/model/pet.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/model/pet.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; } diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/model/pet.ts index e0404395f91..c6c02b01f16 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/model/pet.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/model/pet.ts @@ -24,6 +24,7 @@ export interface Pet { tags?: Array; /** * pet status in the store + * @deprecated */ status?: Pet.StatusEnum; }