-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Event::End(...)
or missing field '...'
#567
Comments
I forgot to add the xml files I was using for tests: xml.zip |
This is duplicate of #510 and the error is generated by this (and the others This is already fixed in master and I plan to release soon (I think in week or two). You can also change the definition to |
Thank you very much for your quick answer Here are the branches where I put the modifications you suggested
Is there something I missed ? 🤔 |
Yeah, forgot to mention that you should also tweak your mappings, because quick-xml expect that attributes are named starting from |
Indeed, I didn't paid pattention to the fact that quick-xml wasn't implicitely using attributes instead of fields when they were missing. Sorry for that. |
Probably that attribute is really missed? Check the all |
Unfortunately it is not missing 🤔 |
Maybe it will be easier to reproduce the issue using the unit tests rather than using my xml files. |
Ok, there is a bug when you have a list in the enum variant: #[test]
fn issue567() {
#[derive(Debug, Deserialize, PartialEq)]
struct Device {
#[serde(rename = "$value")]
items: Vec<DeviceProperty>,
}
#[derive(Debug, Deserialize, PartialEq)]
enum DeviceProperty {
Sm(Vec<()>),
}
assert_eq!(// currently failed with Unexpected::End
Device {
items: vec![
DeviceProperty::Sm(vec![]),
]
},
// Currently failed at unwrap() with UnexpectedEnd(b"Device")
from_str("<Device><Sm/></Device>").unwrap()
);
} |
Hum, like for |
The error probably in the line 2723: Lines 2715 to 2725 in 642de0a
We should pass the deserializer with another implementation of deserialize_seq method here. The implementation should be similar toLines 708 to 715 in 642de0a
but with de: &Deserializer instead of map: &MapAccess .
|
failures (2): serde-de-seq (1): seq::variable_name::fixed_size::list_of_enum serde-issues (1): issue567
…type variant The implementation of `VariantAccess::newtype_variant` should be the same as `Deserializer::visit_newtype_struct`
Hello dear maintainers
I'm trying to alter
ethercat-esi
to usequick_xml
instead ofserde-xml-rs
. This is pretty straight forward asethercat-esi
crate is only using theserde
macros and calling the xml parser at one place.Running this code (in lib or in a test file of that crate) gives me the following output on both xml files
These fields and the Groups markups are good in the xml files. And it doesn't seems to come from the serde declarations of the xml data (in
ethercat-esi/src/mod.rs
), so I suggest there is an issue with the way thequick_xml
functions are calling or checking results of the serde deserialization functions. (especially since the error is not the same depending on the version ofquick_xml
)How do you think I could solve this problem ?
The text was updated successfully, but these errors were encountered: