fastapi-config
This crate provides global configuration capabilities for fastapi.
Config options
- Define rust type aliases for
fastapiwith.alias_for(...)method. - Define schema collect mode for
fastapiwith.schema_collect(...)method.SchemaCollect:Allwill collect all schemas from usages including inlined withinline(T)SchemaCollect::NonInlinedwill only collect non inlined schemas from usages.
[!WARNING] The build config will be stored to projects
OUTPUTdirectory. It is then read from there viaOUTPUTenvironment variable which will return any instance rust compiler might find at that time (Whatever theOUTPUTenvironment 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.
Install
Add dependency declaration to Cargo.toml.
[]
= "0.1"
Examples
Create build.rs file with following content, then in your code you can just use MyType as
alternative for i32.
use Config;
See full example for fastapi-config.
License
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.