Debian Codegraph @

examples/main.rs

raw symbols SCIP
1 use schemars::{schema_for, JsonSchema};
2
3 #[derive(JsonSchema)]
4 pub struct MyStruct {
5 pub my_int: i32,
6 pub my_bool: bool,
7 pub my_nullable_enum: Option<MyEnum>,
8 }
9
10 #[derive(JsonSchema)]
11 pub enum MyEnum {
12 StringNewType(String),
13 StructVariant { floats: Vec<f32> },
14 }
15
16 fn main() {
17 let schema = schema_for!(MyStruct);
18 println!("{}", serde_json::to_string_pretty(&schema).unwrap());
19 }