-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto collect tuple responses schema references (#1071)
Refactor Tuple responses parsing unifying it with request body parsing. This allows reusing same components when serialized to tokens making it less error prone and removing duplication. This also removes the `content_type = [...]` array format from `ToResponse` and `IntoResponses` derive types as well as from tuple style responses. Same as with request bodies the multiple content types need to defined with `content(...)` attribute. Implement auto collect response schema references from tuple style responses within `#[utoipa::path(...)]` attribute macro. Schema references will be collected recursively in same manner as for request bodies. Example of supported syntax. The `User` will be automatically collected to OpenApi when `get_user` path is registered to the `OpenApi`. ```rust #[derive(utoipa::ToSchema)] struct User { name: String, } #[utoipa::path( get, path = "/user", responses( (status = 200, body = User) ) )] fn get_user() {} ```
- Loading branch information
Showing
11 changed files
with
783 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.