-
Notifications
You must be signed in to change notification settings - Fork 303
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Currently all schemas need to be manually listed to the OpenApi
via #[openapi(components(schemas(...)))]
or manually by adding them directly to the OpenApi
. While this is fine, it gets burdensome for large projects and is prone to errors and in reality is not feasible in long run.
Solution
Allow utoipa
to automatically collect schemas recursively within types that implement ToSchema
trait (by derive) and all usages e.g. when type implementing ToSchema
is defined as a request body or response body.
This does not change the fact that still handlers need to manually added to the schema either via #[openapi(paths(...))]
or by other means.
Tasks
- Refactor request body parsing
- Implement support for recursively generating schema references for types implementing
ToSchema
trait (via derive). - Implement support for recognizing recursive schemas from request body usage e.g. via
#[utoipa::path(request_body = ...)]
or from handler function argument for frameworks that supports request body auto recognition. These areactix_web
axum
and mayberocket
- Refactor response body parsing, and unify it with the request body parsing.
- Implement support for recognizing recursive schemas from responses (tuples)
maybeIntoResponses
andToResponse
as well? - Implement automatic recursive schema addition to
utoipa-axum
(request_body and responses).
Fixes #692
nik-here and leebenson
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Projects
Status
Released