Put schema value into a variable before calling apply_metadata
This reduces size of MIR output, which should somewhat mitigate #246
This commit is contained in:
parent
9415fcb57b
commit
ae9544aaf9
1 changed files with 4 additions and 3 deletions
|
@ -15,12 +15,13 @@ impl<'a> SchemaMetadata<'a> {
|
|||
pub fn apply_to_schema(&self, schema_expr: &mut TokenStream) {
|
||||
let setters = self.make_setters();
|
||||
if !setters.is_empty() {
|
||||
*schema_expr = quote! {
|
||||
schemars::_private::apply_metadata(#schema_expr, schemars::schema::Metadata {
|
||||
*schema_expr = quote! {{
|
||||
let schema = #schema_expr;
|
||||
schemars::_private::apply_metadata(schema, schemars::schema::Metadata {
|
||||
#(#setters)*
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue