extern crate apistos_schemars as schemars; use schemars::{gen::SchemaSettings, JsonSchema}; #[derive(JsonSchema)] pub struct MyStruct { pub my_int: i32, pub my_bool: bool, pub my_nullable_enum: Option, } #[derive(JsonSchema)] pub enum MyEnum { StringNewType(String), StructVariant { floats: Vec }, } fn main() { let settings = SchemaSettings::draft07().with(|s| { s.option_nullable = true; s.option_add_null_type = false; }); let gen = settings.into_generator(); let schema = gen.into_root_schema_for::(); println!("{}", serde_json::to_string_pretty(&schema).unwrap()); }