tafia / quick-xml

Rust high performance xml reader and writer
MIT License
1.18k stars 235 forks source link

Error: data did not match any variant of untagged enum #798

Closed EmekaLiberas closed 1 month ago

EmekaLiberas commented 1 month ago

Hi, so I am working on a project using your library and I get this error when trying to deserialize an enum. If I get the underlying struct and try to deserialize it, it works fine. I have replicated this issue in a git hub repo that you can download and see for yourself. Any help on this would be appreciated. Thank you.

https://github.com/EmekaLiberas/quick-xml-enum-deserialize-issue/tree/main/enum-deserialization/src

Mingun commented 1 month ago

Untagged enums uses bufferisation which defeat ability of quick-xml serializer return anything that is not String or Map. This is essentially a serde-rs/serde#1183, we cannot fix it from quick-xml side. You can find many problems related to this issue. Try to use serde-untagged.