-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
schema_with
custon fn reference
Add support for `schema_with` custom fn reference that can be used alternatively via builders to alter the compile time schema if schema attributes are not enough nor does not fit to the purpose. Implement `schema_with` for `ToSchema` and `IntoParams` named struct fields. Supported syntax: ```rust fn custom_type() -> Object { ObjectBuilder::new() .schema_type(utoipa::openapi::SchemaType::String) .format(Some(utoipa::openapi::SchemaFormat::Custom( "email".to_string(), ))) .description(Some("this is email")) .build() } struct Value { #[schema(with_schema = custom_type)] email: String, } struct Value { #[param(with_schema = custom_type)] email: String, } ```
- Loading branch information
Showing
6 changed files
with
202 additions
and
48 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
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.