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
Ability to rename variants of #[serde(untagged)] enums is a serde's fault, because they mean nothing. This code actually should not compile instead of putting user in confusion:
Because variant names does nothing in untagged enums, using the same type in different variants doesn't make any sense. Untagged enums is just a way to try one variant and if deserialization failed, try the next one. If the deserialization of PartyDetails failed in the first attempt, it also will fail in the second.
So in the ideal world the following types should work:
Unfortunately any bufferisation breaks XML deserializer in many cases because it have to use dirty tricks to deserialize things correctly (due to lack of suitable API in serde), and #[serde(untagged)] modifier places bufferisation step between the deserializer and the real types. To avoid that you could implement deserialization of Party manually or try to use serde-untagged. It was developed to avoid bufferisation.
I'm trying to parse ISO Camt053 XML, it used to have such a XML element
This chould be represented as
Now there's a format change, and I need to support 2 formats. It could be just as-is, or
So it may have an extra
<Pty>
element. I tried following, but it doesn't work.Unfortunately this doesn't work for either input. How can I fix the issue?
The text was updated successfully, but these errors were encountered: