Skip to content

Commit

Permalink
add serde(default) to attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Jan 1, 2024
1 parent 5c7f71f commit 7707289
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libninja/src/rust/lower_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7707289

Please sign in to comment.