Further reduce memory footprint of SchemaObject.
More fields are now wrapped in Option<Box<_>>, reducing size of JsonSchema (depending on system) from 424 to 240 bytes.
This commit is contained in:
parent
72629a3c37
commit
c78d721fc5
6 changed files with 87 additions and 59 deletions
|
@ -159,7 +159,10 @@ fn schema_for_external_tagged_enum<'a>(
|
|||
}));
|
||||
|
||||
wrap_schema_fields(quote! {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
subschemas: Some(Box::new(schemars::schema::SubschemaValidation {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
..Default::default()
|
||||
})),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -208,7 +211,10 @@ fn schema_for_internal_tagged_enum<'a>(
|
|||
});
|
||||
|
||||
wrap_schema_fields(quote! {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
subschemas: Some(Box::new(schemars::schema::SubschemaValidation {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
..Default::default()
|
||||
})),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -219,7 +225,10 @@ fn schema_for_untagged_enum<'a>(
|
|||
let schemas = variants.map(|v| schema_for_untagged_enum_variant(v, cattrs));
|
||||
|
||||
wrap_schema_fields(quote! {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
subschemas: Some(Box::new(schemars::schema::SubschemaValidation {
|
||||
any_of: Some(vec![#(#schemas),*]),
|
||||
..Default::default()
|
||||
})),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue