media-io / yaserde

Yet Another Serializer/Deserializer
MIT License
179 stars 60 forks source link

Fix bug where nested structs with the same element names don't deserialize properly. #112

Closed ephraimkunz closed 3 years ago

ephraimkunz commented 3 years ago

Fixes #110.

Nested structs with the same field names don't deserialize correctly. #76 gives a more detailed description of the problem and provides a more comprehensive proposal for fixing it that involves a larger change to the internal workings of yaserde.

However, I needed a fix sooner than that large refactoring. This fix passes all tests including the test that checks this specific nested case.

It moves the check for the root attribute above the checks for the child attributes, so we avoid matching on a child attribute with the same name as the root attribute when what we have actually pulled from the reader is the root attribute.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 277


Totals Coverage Status
Change from base Build 272: 0.02%
Covered Lines: 1125
Relevant Lines: 1886

💛 - Coveralls
scottlamb commented 3 years ago

FYI, I'm not intending to work on #76 any time soon. I didn't hear any interest from the project owner so I found other things to work on.

ephraimkunz commented 3 years ago

Any ideas if / when someone could take a look at this PR? No huge rush, but I'm working on a library that depends on these changes and I'd like to avoid having to publish a fork of yaserde if possible.