You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to #252 (fixed by #490), None values for attributes that are Option<String> now serialize to Some(""), whereas the old behaviour was to not serialize at all. I have several XML specs where the attribute must have a value if present or not be present at all. Is this no longer possible?
In my case I get lots of optional_attr="" that no longer validate and create an excessive amount of (useless) data. Do I have to write my own serialization for this from now on?
I have ensured the attributes really do deserialize to None, before serializing back.
Sorry I guess there's always that someone who needs the opposite...
I'm using:
serde = { version = "1.0.152", features = [ "derive" ] }
quick-xml = { version = "0.27.1", features = [ "serialize" ] }
The text was updated successfully, but these errors were encountered:
According to #252 (fixed by #490), None values for attributes that are Option<String> now serialize to Some("")
You mean, that Option<String>::None is serialized as some_attribute="". Yes, this is now the behaviour by default, which mathes the behaviour of serde_json and serde_yaml. To not write empty attributes annotate your fields with #[serde(skip_serializing_if = "Option::is_none")] as written in the serde examples.
According to #252 (fixed by #490),
None
values for attributes that areOption<String>
now serialize toSome("")
, whereas the old behaviour was to not serialize at all. I have several XML specs where the attribute must have a value if present or not be present at all. Is this no longer possible?In my case I get lots of
optional_attr=""
that no longer validate and create an excessive amount of (useless) data. Do I have to write my own serialization for this from now on?I have ensured the attributes really do deserialize to
None
, before serializing back.Sorry I guess there's always that someone who needs the opposite...
I'm using:
The text was updated successfully, but these errors were encountered: