Skip to content

feat(api-header): support custom OpenAPI extensions - #4047

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
kyungseopk1m:feat/api-header-extensions
Aug 17, 2026
Merged

feat(api-header): support custom OpenAPI extensions#4047
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
kyungseopk1m:feat/api-header-extensions

Conversation

@kyungseopk1m

Copy link
Copy Markdown
Contributor

Summary

@ApiParam and @ApiQuery both accept an extensions bag and flatten each entry into x-* keys on the emitted parameter object (@ApiQuery added in #3949). @ApiHeader does not, even though ApiHeaderOptions extends Omit<ParameterObject, 'in'> uses the same schema as the other two.

This PR mirrors that implementation in @ApiHeader:

  • adds an optional extensions field to ApiHeaderOptions,
  • merges each entry as an x--prefixed key on the parameter metadata (auto-prefixing keys that don't already start with x-),
  • works for both method-level and class-level usage.

No behaviour changes for callers that don't use extensions.

Test plan

Added unit tests in test/decorators/api-header.decorator.spec.ts:

  • merges extensions into parameter metadata (method level and class level),
  • auto-prefixes extension keys without x-,
  • asserts no raw extensions key remains on the emitted parameter,
  • asserts metadata is unchanged when extensions is not provided.

npm run test, npm run build and npm run lint pass.

@kamilmysliwiec
kamilmysliwiec merged commit 91e5917 into nestjs:master Aug 17, 2026
1 check passed
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.

2 participants