Skip to content

[typescript-fetch] Document request-parameter interfaces and fix parameter isDeprecated - #24510

Merged
macjohnny merged 1 commit into
OpenAPITools:masterfrom
babariviere:fix-ts-fetch-param-deprecated
Jul 29, 2026
Merged

[typescript-fetch] Document request-parameter interfaces and fix parameter isDeprecated#24510
macjohnny merged 1 commit into
OpenAPITools:masterfrom
babariviere:fix-ts-fetch-param-deprecated

Conversation

@babariviere

@babariviere babariviere commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #24511

What is this PR about?

When useSingleRequestParameter is enabled, typescript-fetch bundles an operation's parameters into a generated XxxRequest interface. Those interfaces were emitted with bare properties: no JSDoc descriptions, and no @deprecated even when a parameter is marked deprecated: true in the spec.

#11522 / #11523 previously added @deprecated for operations and model properties, but operation parameters were never covered, and a copy-constructor bug made parameter deprecation impossible to detect regardless of template.

This PR does two things:

  1. Fixes isDeprecated always being false on parameters. DefaultCodegen.fromParameter correctly sets CodegenParameter.isDeprecated from the OpenAPI deprecated field, but TypeScriptFetchClientCodegen.ExtendedCodegenParameter's copy constructor wrapped the parameter and copied ~70 fields while omitting isDeprecated, silently resetting it to false. (The vendorExtensions field is copied, which is why only vendor-extension workarounds surfaced deprecation before.) The one-line fix copies isDeprecated through, matching what the operation and model wrappers already do.
  2. Documents request-parameter interfaces in apis.mustache with JSDoc (description and @deprecated when the parameter is deprecated), consistent with the model interface template.

Example

Given a query parameter marked deprecated: true:

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 }

Before:

export interface ListItemsRequest {
    q?: string;
    legacyId?: string;
}

After:

export interface ListItemsRequest {
    /**
     * Free-text search query.
     */
    q?: string;
    /**
     * Deprecated. Use id instead.
     * @deprecated
     */
    legacyId?: string;
}

PR checklist

cc typescript-fetch technical committee: @macjohnny @topce @amakhrov @davidgamero @joscha


Summary by cubic

Fixes missing deprecation flags and adds JSDoc to request-parameter interfaces in typescript-fetch when useSingleRequestParameter is enabled. Deprecated parameters now render @deprecated, and generated request interfaces include descriptions; samples were regenerated to reflect the changes.

  • Bug Fixes

    • Copy isDeprecated into ExtendedCodegenParameter so deprecated params in XxxRequest interfaces include @deprecated; adds TypeScriptFetchClientCodegenTest#testDeprecatedParameter.
  • New Features

    • Emit JSDoc for properties in XxxRequest interfaces via apis.mustache (description and @deprecated when applicable); regenerates typescript-fetch samples.

Written for commit 69e0630. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache Outdated
@babariviere
babariviere force-pushed the fix-ts-fetch-param-deprecated branch 2 times, most recently from ca29bc5 to c46e7d4 Compare July 28, 2026 14:00
Comment thread modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache Outdated
@babariviere
babariviere force-pushed the fix-ts-fetch-param-deprecated branch from c46e7d4 to 9e69677 Compare July 29, 2026 07:02
@babariviere
babariviere requested a review from macjohnny July 29, 2026 07:02
…Deprecated

The ExtendedCodegenParameter copy constructor omitted isDeprecated, so
'@deprecated' never rendered for operation parameters even when the spec
marks them deprecated. Copy the field through, and add JSDoc (description,
@type, @memberof, @deprecated) to the request-parameter interfaces that are
generated when useSingleRequestParameter is enabled.

Adds a TypeScriptFetchClientCodegenTest#testDeprecatedParameter test and
regenerates the typescript-fetch samples.

Fixes OpenAPITools#24511
@babariviere
babariviere force-pushed the fix-ts-fetch-param-deprecated branch from 9e69677 to 69e0630 Compare July 29, 2026 07:06

@macjohnny macjohnny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution

@macjohnny
macjohnny merged commit db04d2d into OpenAPITools:master Jul 29, 2026
20 checks passed
macjohnny pushed a commit that referenced this pull request Jul 29, 2026
Drop the @type and @memberof JSDoc annotations from the generated model
interfaces and regenerate the samples.

This is a follow-up of this comment:
#24510 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][typescript-fetch] @deprecated JSDoc missing on operation parameters (parameter isDeprecated always false)

2 participants