macro_rules! schema_for {
($type:ty) => { ... };
}
Expand description
Generates a Schema
for the given type using default settings.
The default settings currently conform to JSON Schema 2020-12, but this is liable to change in a future version of Schemars if support for other JSON Schema versions is added.
The type must implement JsonSchema
.
ยงExample
use schemars::{schema_for, JsonSchema};
#[derive(JsonSchema)]
struct MyStruct {
foo: i32,
}
let my_schema = schema_for!(MyStruct);