-
-
Notifications
You must be signed in to change notification settings - Fork 491
Open
Labels
EnhancementThis is a new feature or requestThis is a new feature or request
Description
Summary
In the docs, it shows how to configure the OpenAPI schema generation for individual routes. One of the things we can configure is the responses dictionary.
However, in my openapi_config, I have configured a custom 400 response which I would like to use for all routes:
components=[
Components(
responses={
"BadRequest": OpenAPIResponse(
description="Bad Request",
content={
"application/problem+json": OpenAPIMediaType(
schema=Schema(
type="object",
properties={
"type": Schema(type="string", format="uri"),
"title": Schema(type="string"),
"detail": Schema(type="string"),
"status": Schema(type="integer", format="int32"),
"instance": Schema(type="string", format="uri"),
},
required=["title", "detail", "status"],
)
)
},
)
}
)
]I'm using the ProblemDetailsPlugin which converts all HttpExceptions to an object, and would like my typescript code to reflect that format.
Is it possible to support configuring the responses object globally in the main app config?
responses={"400": {"ref": "#/components/responses/BadRequest"}}Thanks for your time
Basic Example
app = Litestar(responses={"400": {"ref": "#/components/responses/BadRequest"}})Drawbacks and Impact
No response
Unresolved questions
No response
Metadata
Metadata
Assignees
Labels
EnhancementThis is a new feature or requestThis is a new feature or request