diff --git a/CHANGELOG.md b/CHANGELOG.md index 6886f578..5ddd9fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.8.16] - 2023-11-11 + +### Fixed: + +- Reduce size of MIR output (and improve release-mode compile time) when deriving `JsonSchema` + ## [0.8.15] - 2023-09-17 ### Added: diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 3b54513d..fb6b06e5 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -3,7 +3,7 @@ name = "schemars" description = "Generate JSON Schemas from Rust code" homepage = "https://graham.cool/schemars/" repository = "https://github.com/GREsau/schemars" -version = "0.8.15" +version = "0.8.16" authors = ["Graham Esau "] edition = "2021" license = "MIT" @@ -14,7 +14,7 @@ build = "build.rs" rust-version = "1.60" [dependencies] -schemars_derive = { version = "=0.8.15", optional = true, path = "../schemars_derive" } +schemars_derive = { version = "=0.8.16", optional = true, path = "../schemars_derive" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.25" dyn-clone = "1.0" diff --git a/schemars_derive/Cargo.toml b/schemars_derive/Cargo.toml index f09fc04d..4535814b 100644 --- a/schemars_derive/Cargo.toml +++ b/schemars_derive/Cargo.toml @@ -3,7 +3,7 @@ name = "schemars_derive" description = "Macros for #[derive(JsonSchema)], for use with schemars" homepage = "https://graham.cool/schemars/" repository = "https://github.com/GREsau/schemars" -version = "0.8.15" +version = "0.8.16" authors = ["Graham Esau "] edition = "2021" license = "MIT" diff --git a/schemars_derive/src/metadata.rs b/schemars_derive/src/metadata.rs index 32dbf671..e9637044 100644 --- a/schemars_derive/src/metadata.rs +++ b/schemars_derive/src/metadata.rs @@ -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() }) - } + }} } }