Skip to content

docs(openapi): clarify response headers schema format and support object properties - #960

Open
lx3133584 wants to merge 1 commit into
fastify:mainfrom
lx3133584:docs/openapi-response-headers-clarification
Open

lx3133584 wants to merge 1 commit into
fastify:mainfrom
lx3133584:docs/openapi-response-headers-clarification

Conversation

@lx3133584

Copy link
Copy Markdown

Fixes #959

Description

When response headers are defined using standard JSON Schema or TypeBox object definitions (e.g. headers: { type: 'object', properties: { 'X-Total-Count': { type: 'integer' } } }), the generator previously mapped type and properties directly as header keys.

This PR updates both the OpenAPI and Swagger response resolvers to unwrap properties when response headers is provided as a schema object, ensuring header definitions are correctly transformed into OpenAPI Header Objects. It also clarifies the recommended schema patterns in README.md.

Changes

  • In lib/spec/openapi/utils.js and lib/spec/swagger/utils.js, unwrap rawJsonSchema.headers.properties when present.
  • Add test coverage in test/spec/openapi/schema.test.js and test/spec/swagger/schema.test.js.
  • Update README.md response headers documentation with TypeBox / JSON Schema object examples.

🤖 Generated with Claude Code

…ect properties

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

docs(openapi): clarify response headers schema format for OpenAPI 3 specifications

1 participant