quart-schema
quart-schema copied to clipboard
`HttpSecurityScheme` uses wrong bearerFormat attribute name
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
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?
Thanks, this was a bug fixed in 04d5a27b969977db529dd6d68539bff4750017f6