schemars

Macro schema_for

Source
macro_rules! schema_for {
    ($type:ty) => { ... };
}
Expand description

Generates a RootSchema for the given type using default settings.

The type must implement JsonSchema.

ยงExample

use schemars::{schema_for, JsonSchema};

#[derive(JsonSchema)]
struct MyStruct {
    foo: i32,
}

let my_schema = schema_for!(MyStruct);