Skip to content

fix(standard-schema): promote schema description to parameter object - #4140

Open
tjsousa wants to merge 1 commit into
nestjs:masterfrom
tjsousa:fix/standard-schema-parameter-description
Open

tjsousa wants to merge 1 commit into
nestjs:masterfrom
tjsousa:fix/standard-schema-parameter-description

Conversation

@tjsousa

@tjsousa tjsousa commented Sep 21, 2026

Copy link
Copy Markdown

@query({schema}) / @PARAM({schema}) built from a Standard Schema (Zod, Valibot, ArkType) only ever set parameter.schema.description, never parameter.description. Swagger UI's parameter table reads the latter, so descriptions silently fail to render for any Standard Schema param, while decorator-based params (@apiquery({description})) work fine because Nest keeps description at the parameter level.

Promote schema.description onto the parameter in both places a Standard Schema becomes a parameter (the unnamed-object expansion and the single named-param override), keeping the schema-level copy intact. An explicit @ApiParam/@apiquery description still wins, since it is merged onto the parameter before this runs.

Closes #4139

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@query({schema}) / @PARAM({schema}) built from a Standard Schema (Zod,
Valibot, ArkType) only ever set parameter.schema.description, never
parameter.description. Swagger UI's parameter table reads the latter,
so descriptions silently fail to render for any Standard Schema
param, while decorator-based params (@apiquery({description})) work
fine because Nest keeps description at the parameter level.

Promote schema.description onto the parameter in both places a
Standard Schema becomes a parameter (the unnamed-object expansion and
the single named-param override), keeping the schema-level copy
intact. An explicit @ApiParam/@apiquery description still wins, since
it is merged onto the parameter before this runs.

Closes nestjs#4139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard Schema params never promote schema.description to parameter.description (blank in Swagger UI)

1 participant