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

Fix errors in sequence deserialization #380

Closed
wants to merge 0 commits into from
Closed

Conversation

Mingun
Copy link
Collaborator

@Mingun Mingun commented Apr 3, 2022

This PR adds a bunch of tests to ensure, that deserialization of sequences is correct in all situations.

This PR is based on #374 and #376, because they make a huge refactoring in files, that this PR touches.

For now all this works:

1. Interleaved sequence fields with non-sequence fields

XML

<any-tag>
  <item/>
  <item/>
  <before/>
  <item/>
  <after/>
  <item/>
</any-tag>

can be deserialized into

struct AnyName {
  before: (),
  item: Vec<()>,
  after: (),
}

2. List of choices

<any-tag>
  <one/>
  <two/>
  <three/>
</any-tag>

can be deserialized into

enum AnyNameChoice {
  one,
  two,
  #[serde(other)]
  other,
}
struct AnyName {
  #[serde(rename = "$value")]
  any_name: Vec<AnyNameChoice>,
}

3. Combination of above

@Mingun
Copy link
Collaborator Author

Mingun commented May 14, 2022

Replaced by Mingun/fast-xml#12

@Mingun Mingun closed this May 14, 2022
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.

None yet

1 participant