Crates.io | utoipa-config |
lib.rs | utoipa-config |
version | 0.1.2 |
source | src |
created_at | 2024-10-02 17:29:25.129067 |
updated_at | 2024-10-23 12:45:33.980109 |
description | Config for controlling utoipa's various aspects |
homepage | |
repository | https://github.com/juhaku/utoipa |
max_upload_size | |
id | 1394427 |
size | 26,274 |
This crate provides global configuration capabilities for utoipa
.
utoipa
with .alias_for(...)
method.utoipa
with .schema_collect(...)
method.
SchemaCollect:All
will collect all schemas from usages including inlined with inline(T)
SchemaCollect::NonInlined
will only collect non inlined schemas from usages.[!WARNING] The build config will be stored to projects
OUTPUT
directory. It is then read from there viaOUTPUT
environment variable which will return any instance rust compiler might find at that time (Whatever theOUTPUT
environment variable points to). Be aware that sometimes you might face a situation where the config is not aligned with your Rust aliases. This might need you to change something on your code before changed config might apply.
Add dependency declaration to Cargo.toml
.
[build-dependencies]
utoipa-config = "0.1"
Create build.rs
file with following content, then in your code you can just use MyType
as
alternative for i32
.
use utoipa_config::Config;
fn main() {
Config::new()
.alias_for("MyType", "i32")
.write_to_file();
}
See full example for utoipa-config.
Licensed under either of Apache 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be dual licensed, without any additional terms or conditions.