Bug Report Checklist
Description
typescript-fetch does not emit @deprecated for operation parameters marked deprecated: true in the spec. #11522 / #11523 added @deprecated for operations and model properties, but individual parameters are still undocumented, and when useSingleRequestParameter is enabled the generated XxxRequest parameter interfaces have no JSDoc at all.
Root cause: DefaultCodegen.fromParameter correctly sets CodegenParameter.isDeprecated from the spec, but TypeScriptFetchClientCodegen.ExtendedCodegenParameter's copy constructor copies ~70 fields and omits isDeprecated, resetting it to false. As a result {{#isDeprecated}} is always false for parameters. The operation and model wrappers copy their own isDeprecated, which is why those cases work.
openapi-generator version
master (7.25.0-SNAPSHOT). Present since the Extended* wrappers were introduced in typescript-fetch.
OpenAPI declaration file content to reproduce
openapi: 3.0.3
info: { title: Example API, version: '1.0' }
paths:
/items:
get:
operationId: listItems
parameters:
- name: q
in: query
description: Free-text search query.
schema: { type: string }
- name: legacyId
in: query
deprecated: true
description: Deprecated. Use id instead.
schema: { type: string }
responses:
'200': { description: OK }
Steps to reproduce
java -jar openapi-generator-cli.jar generate -i spec.yaml -g typescript-fetch -o out \
--additional-properties=useSingleRequestParameter=true
Current output
export interface ListItemsRequest {
q?: string;
legacyId?: string;
}
Expected output
export interface ListItemsRequest {
/**
* Free-text search query.
* @type {string}
* @memberof ListItemsRequest
*/
q?: string;
/**
* Deprecated. Use id instead.
* @type {string}
* @memberof ListItemsRequest
* @deprecated
*/
legacyId?: string;
}
Related
Suggested fix
Copy isDeprecated in the ExtendedCodegenParameter(CodegenParameter) constructor (as the operation and model wrappers already do), and document the request-parameter interfaces in apis.mustache. PR: #24510
Bug Report Checklist
Description
typescript-fetchdoes not emit@deprecatedfor operation parameters markeddeprecated: truein the spec. #11522 / #11523 added@deprecatedfor operations and model properties, but individual parameters are still undocumented, and whenuseSingleRequestParameteris enabled the generatedXxxRequestparameter interfaces have no JSDoc at all.Root cause:
DefaultCodegen.fromParametercorrectly setsCodegenParameter.isDeprecatedfrom the spec, butTypeScriptFetchClientCodegen.ExtendedCodegenParameter's copy constructor copies ~70 fields and omitsisDeprecated, resetting it tofalse. As a result{{#isDeprecated}}is always false for parameters. The operation and model wrappers copy their ownisDeprecated, which is why those cases work.openapi-generator version
master(7.25.0-SNAPSHOT). Present since theExtended*wrappers were introduced in typescript-fetch.OpenAPI declaration file content to reproduce
Steps to reproduce
Current output
Expected output
Related
@deprecatedfor operations and model properties only)Suggested fix
Copy
isDeprecatedin theExtendedCodegenParameter(CodegenParameter)constructor (as the operation and model wrappers already do), and document the request-parameter interfaces inapis.mustache. PR: #24510