Skip to content

Commit

Permalink
Add skip_serializing_if none to all patchstate fields
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasKoch committed Jul 31, 2024
1 parent 37469e4 commit 9e88969
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shadow_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fn create_optional_fields(fields: &Vec<Field>) -> Vec<proc_macro2::TokenStream>
Some(if type_name_string.starts_with("Option<") {
quote! { #(#attrs)* pub #field_name: Option<rustot::shadows::Patch<<#type_name as rustot::shadows::ShadowPatch>::PatchState>> }
} else {
quote! { #(#attrs)* pub #field_name: Option<<#type_name as rustot::shadows::ShadowPatch>::PatchState> }
quote! { #(#attrs)* #[serde(skip_serializing_if = "Option::is_none")] pub #field_name: Option<<#type_name as rustot::shadows::ShadowPatch>::PatchState> }
})
}
})
Expand Down

0 comments on commit 9e88969

Please sign in to comment.