Skip to content
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

bugfix for is_map_value stays true after vec of struct in enum #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mike-kfed
Copy link

I ran into this head-scratcher today, history:

  1. upgraded software that used serde-xml-rs v0.3.0 to use v0.6.0.
  2. It compiled fine but parsing broke.
  3. found out that parsing still works on 0.4.1
  4. investigated what happens and built a minimal test case
  5. the self.is_map_value is true after parsing the <enumerationDefinition> which when continuing, inside read_inner_value (), skips the StartElement of the next xml item (<messageDefinition>) and then is confused because the enum Definition has no variant for <field> items.
  6. changing the order of the XML elements actually makes it parseable again 🤔

point 6. made me believe this is a bug and self.is_map_value should be reset when a new StartElement is coming up for an enum - since I don't fully grok the description what this struct field really does for read_inner_value(), please double verify this is all good. All tests succeed, so I guess my fix is fine and has no side-effects?

I'll adapt this patch however needed, I do realise this is more of a bug report including a potential fix than a PR. I'd like to advocate though to keep the test case of this PR at least please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant