Skip to content

[BUG][Typescript-Angular] Mark properties as deprecated #17867

@puhbooh

Description

@puhbooh

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

If a property is marked as deprecated in openapi spec, it has no effect on the generated typescript sdk. The generate model has no deprecation marker on the deprecated property. The generate model looks like:

export interface GameDto { 
    nationalLeague: boolean;
    results: boolean;
    id: number;
}
openapi-generator version

7.4.0-SNAPSHOT

OpenAPI declaration file content or url
{
  "openapi": "3.0.0",
  "info": {
    "title": "Test API",
    "version": "0.1"
  },
  "servers": [
    {
      "url": "http://test.local/api"
    }
  ],
  "paths": {
  },
  "components": {
    "schemas": {
      "GameDto": {
        "required": [
          "id",
          "results",
          "nationalLeague"
        ],
        "properties": {
          "nationalLeague": {
            "type": "boolean",
            "deprecated": true
          },
          "results": {
            "type": "boolean"
          },
          "id": {
            "type": "integer"
          }
        },
        "type": "object"
      }
    }
  }
}
Generation Details

using docker image openapitools/openapi-generator-cli

Steps to reproduce

run docker run --rm -v openapi.json:/app/openapi.json openapitools/openapi-generator-cli generate -i /app/openapi.json -g typescript-angular -o /app/ui/sdk

Related issues/PRs

#15470

Suggest a fix

The generated model should look like this

export interface GameDto { 
    /** @deprecated */
    nationalLeague: boolean;
    results: boolean;
    id: number;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions