-
-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: ResponseHeaders results in invalid OpenAPI schema #3416
Labels
area/openapi
This PR involves changes to the OpenAPI schema
Bug 🐛
This is something that is not working as expected
Comments
Thanks for reporting! We go to a lot of effort to document that these shouldn't be included also: litestar/litestar/openapi/spec/header.py Lines 18 to 36 in a31d1c6
|
peterschutt
added
the
area/openapi
This PR involves changes to the OpenAPI schema
label
Apr 23, 2024
peterschutt
added a commit
that referenced
this issue
Apr 23, 2024
Exclude the "name" and "in" fields from openapi schema generated for headers. Add ``BaseSchemaObject._iter_fields()`` method that allows schema types to define the fields that should be included in their openapi schema representation and override that method for ``OpenAPIHeader``. Closes #3416
peterschutt
added a commit
that referenced
this issue
Apr 23, 2024
Exclude the "name" and "in" fields from openapi schema generated for headers. Add ``BaseSchemaObject._iter_fields()`` method that allows schema types to define the fields that should be included in their openapi schema representation and override that method for ``OpenAPIHeader``. Closes #3416
peterschutt
added a commit
that referenced
this issue
Apr 23, 2024
Exclude the "name" and "in" fields from openapi schema generated for headers. Add ``BaseSchemaObject._iter_fields()`` method that allows schema types to define the fields that should be included in their openapi schema representation and override that method for ``OpenAPIHeader``. Closes #3416
This issue has been closed in #3417. The change will be included in the upcoming patch release. |
peterschutt
added a commit
that referenced
this issue
May 1, 2024
Exclude the "name" and "in" fields from openapi schema generated for headers. Add ``BaseSchemaObject._iter_fields()`` method that allows schema types to define the fields that should be included in their openapi schema representation and override that method for ``OpenAPIHeader``. Closes #3416 (cherry picked from commit c372633)
peterschutt
added a commit
that referenced
this issue
May 2, 2024
Exclude the "name" and "in" fields from openapi schema generated for headers. Add ``BaseSchemaObject._iter_fields()`` method that allows schema types to define the fields that should be included in their openapi schema representation and override that method for ``OpenAPIHeader``. Closes #3416 (cherry picked from commit c372633)
A fix for this issue has been released in v2.9.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/openapi
This PR involves changes to the OpenAPI schema
Bug 🐛
This is something that is not working as expected
Description
Use of
response_headers
on the Litestar object seems to result in invalid OpenAPI 3.1 schema generation.The Header object on the response is invalid aiui according to the spec (see https://spec.openapis.org/oas/v3.1.0#header-object) and fails validation when using
redocly lint
, as it includes thename
andin
fields.The schema is as follows,
URL to code causing the issue
No response
MCVE
This endpoint works, but the resulting schema fails validation.
Steps to reproduce
No response
Screenshots
No response
Logs
No response
Litestar Version
2.8.2, using Python 3.12.2
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: