Skip to content
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: OpenAPI - query parameter only properties used in other parameters #3908

Closed
4 tasks
provinzkraut opened this issue Dec 22, 2024 · 2 comments · Fixed by #3909
Closed
4 tasks

Bug: OpenAPI - query parameter only properties used in other parameters #3908

provinzkraut opened this issue Dec 22, 2024 · 2 comments · Fixed by #3909
Labels
Bug 🐛 This is something that is not working as expected

Comments

@provinzkraut
Copy link
Member

Description

The query-only parameters allowEmptyValue and allowReserved are being rendered (although never used) for path, header and cookie parameters as well.

See https://spec.openapis.org/oas/v3.1.0#fixed-fields-9

URL to code causing the issue

No response

MCVE

@get("/{path_param:str}")
def handler(
    path_param: str,
    query_param: str,
    header_param: Annotated[str, Parameter(header="header_param")],
    cookie_param: Annotated[str, Parameter(cookie="cookie_param")],
) -> None:
    pass
app = Litestar([handler])
params = {p.name: p for p in app.openapi_schema.paths["/{path_param}"].get.parameters}

for key in ["path_param", "header_param", "cookie_param"]:
    schema = params[key].to_schema()
    assert "allowEmptyValue" not in schema
    assert "allowReserved" not in schema

Steps to reproduce

No response

Screenshots

No response

Logs

No response

Litestar Version

all

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)
Copy link

This issue has been closed in #3909. The change will be included in upcoming releases.

Copy link

github-actions bot commented Jan 8, 2025

A fix for this issue has been released in v2.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected
Projects
Status: Closed
1 participant