media-io / yaserde

Yet Another Serializer/Deserializer
MIT License
175 stars 57 forks source link

Failed to deserialize flatten fields of UML models #125

Open rohel01 opened 2 years ago

rohel01 commented 2 years ago

Hello,

I am trying to parse simple UML models using yaserde 0.7.1.

The associated xml files strongly rely on element inheritance to avoid duplication. For example, most elements have xmi:type, xmi:id and name attributes, but it cannot be modeled out of the box in Rust.

My first quick and dirty prototype duplicated all such attributes in every structure definition. This worked, but I felt it would quickly become a problem as I progressed further.

This lead me to yaserde flatten feature, which seemed very promizing. Sadly, my current tests show it is working as intended when serializing, but the flattened attributes are ignored when deserializing.

Maybe there is something I do not understand?

I have attached a complete test case demonstrating the issue.

github-sample.zip

Just unzip this archive somewhere and run cargo test in the crate root