openapi-generator
openapi-generator copied to clipboard
[BUG][Typescript-Angular] Mark properties as deprecated
Bug Report Checklist
- [x] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [x] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] 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
https://github.com/OpenAPITools/openapi-generator/issues/15470
Suggest a fix
The generated model should look like this
export interface GameDto {
/** @deprecated */
nationalLeague: boolean;
results: boolean;
id: number;
}