4f042f8133
See the test example: assuming a `pub struct Foo` which implements `Serialize` and `Deserialize`, we also expect it to provide a `pub const Foo::API_SCHEMA: &Schema` like so: #[derive(Deserialize, Serialize)] pub struct StrongString(String); impl StrongString { pub const API_SCHEMA: &'static Schema = &StringSchema::new("Some generic string") .format(&ApiStringFormat::Enum(&["a", "b"])) .schema(); } Then we can use: #[api( input: { properties: { arg: { type: StrongString }, } }, ... )] fn my_api_func(arg: StrongString) -> Result<...> { ... } Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |