From 770728971af11e4ce100ef279129381392fa5497 Mon Sep 17 00:00:00 2001 From: Kurt Wolf Date: Mon, 1 Jan 2024 14:44:18 -0500 Subject: [PATCH] add serde(default) to attributes --- libninja/src/rust/lower_mir.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libninja/src/rust/lower_mir.rs b/libninja/src/rust/lower_mir.rs index a2b1b4e..b4944b2 100644 --- a/libninja/src/rust/lower_mir.rs +++ b/libninja/src/rust/lower_mir.rs @@ -40,15 +40,15 @@ impl FieldExt for HirField { } if self.optional { decorators.push(quote! { - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] }); } else if self.ty.is_iterable() { decorators.push(quote! { - #[serde(skip_serializing_if = "Vec::is_empty")] + #[serde(default, skip_serializing_if = "Vec::is_empty")] }); } else if matches!(self.ty, Ty::Any) { decorators.push(quote! { - #[serde(skip_serializing_if = "serde_json::Value::is_null")] + #[serde(default, skip_serializing_if = "serde_json::Value::is_null")] }); } if self.ty.inner_model().is_some() && config.ormlite {