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

HttpSecurityScheme uses wrong bearerFormat attribute name #83

Open
DanielHabenicht opened this issue Jul 23, 2024 · 1 comment · May be fixed by #87
Open

HttpSecurityScheme uses wrong bearerFormat attribute name #83

DanielHabenicht opened this issue Jul 23, 2024 · 1 comment · May be fixed by #87

Comments

@DanielHabenicht
Copy link

The generated OpenAPI schema is invalid if the bearer_format option is specified:

QuartSchema(
    app,
    security=[{"bearerAuth": []}],
    security_schemes={"bearerAuth": {"type": "http", "bearer_format": "JWT", "scheme": "bearer"}},
)

# because of
@dataclass
class HttpSecurityScheme(SecuritySchemeBase):
    scheme: str
    bearer_format: Optional[str] = None
    type: Literal["http"] = "http"

Resulting Schema:

// ...
        "securitySchemes": {
            "bearerAuth": {
                "bearer_format": "JWT",
                "scheme": "bearer",
                "type": "http"
            }
        }

It should be bearerFormat as specified: https://spec.openapis.org/oas/v3.1.0#fixed-fields-22

@DanielHabenicht
Copy link
Author

DanielHabenicht commented Jul 23, 2024

Should I make a PR where the attribute is aliased?

@dataclass
class HttpSecurityScheme(SecuritySchemeBase):
    scheme: str
    bearer_format: Optional[str] = Field(None, alias='bearerFormat')
    type: Literal["http"] = "http"

Or do you want to handle it centrally for all attributes?

@DanielHabenicht DanielHabenicht linked a pull request Aug 2, 2024 that will close this issue
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 a pull request may close this issue.

1 participant