Small refactor
This commit is contained in:
parent
0198ede4b6
commit
1605a8a34d
2 changed files with 20 additions and 26 deletions
|
@ -8,19 +8,16 @@ pub struct MyStruct {
|
|||
}
|
||||
|
||||
#[derive(JsonSchema)]
|
||||
pub enum MyEnum {
|
||||
pub enum MyEnum {
|
||||
StringNewType(String),
|
||||
StructVariant {
|
||||
floats: Vec<f32>,
|
||||
}
|
||||
StructVariant { floats: Vec<f32> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let settings = SchemaSettings {
|
||||
option_nullable: true,
|
||||
option_add_null_type: false,
|
||||
..SchemaSettings::draft07()
|
||||
};
|
||||
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::<MyStruct>();
|
||||
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue