Skip to content

Fix #60: resolve $ref in response headers pointing to #/components/he…#72

Merged
RobertoPrevato merged 1 commit intomainfrom
fix/60
Mar 7, 2026
Merged

Fix #60: resolve $ref in response headers pointing to #/components/he…#72
RobertoPrevato merged 1 commit intomainfrom
fix/60

Conversation

@RobertoPrevato
Copy link
Member

…aders/

Response header definitions using $ref (e.g. $ref: '#/components/headers/foo') were passed to Jinja templates unresolved, causing an UndefinedError when the template accessed .schema or .description.

Added get_response_headers() method to OpenAPIV3DocumentationHandler that calls _resolve_opt_ref() on each header value before returning the dict. Updated both mkdocs and markdown request-responses templates to call this method instead of iterating definition.headers directly.

Added regression test with a fixture (example9-openapi.yaml) covering both $ref headers and inline headers in the same response.

…aders/

Response header definitions using $ref (e.g. $ref: '#/components/headers/foo')
were passed to Jinja templates unresolved, causing an UndefinedError when the
template accessed .schema or .description.

Added get_response_headers() method to OpenAPIV3DocumentationHandler that
calls _resolve_opt_ref() on each header value before returning the dict.
Updated both mkdocs and markdown request-responses templates to call this
method instead of iterating definition.headers directly.

Added regression test with a fixture (example9-openapi.yaml) covering
both $ref headers and inline headers in the same response.

Co-authored-by: Copilot <[email protected]>
@RobertoPrevato RobertoPrevato merged commit 75108ce into main Mar 7, 2026
6 checks passed
@RobertoPrevato RobertoPrevato deleted the fix/60 branch March 7, 2026 07:01
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.

1 participant