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

The order of the attributes changes randomly #108

Closed
acecilia opened this issue Jun 26, 2019 · 2 comments · Fixed by #110
Closed

The order of the attributes changes randomly #108

acecilia opened this issue Jun 26, 2019 · 2 comments · Fixed by #110
Assignees

Comments

@acecilia
Copy link
Contributor

acecilia commented Jun 26, 2019

I noticed that when there are multiple attributes, every time I encode the model they are ordered in a different way in the resulting xml. This is a huge problem during unit tests, where it becomes impossible to validate the encoded Data (or String) against a reference one.

Is this a known issue?

Thanks,
Andres

@MaxDesiatov MaxDesiatov self-assigned this Jun 26, 2019
@MaxDesiatov
Copy link
Collaborator

Hi @acecilia, thank you for reporting this. I thought this was fixed in 0.6.0 with #102 being merged, but interesting to see this still being reproduced. Do you have any specific unit tests you'd be able to share? If so, would you mind if I add them to XMLCoder's test suite?

acecilia added a commit to acecilia/XMLCoder that referenced this issue Jun 30, 2019
@acecilia
Copy link
Contributor Author

Sure. Find in #109 some tests that showcase the problem and a small explanation of why this happens. Find in #110 a fix for it :)

MaxDesiatov pushed a commit that referenced this issue Jun 30, 2019
This PR fixes #108 by replacing the unordered data structure used for storing the attributes (a Swift `Dictionary`) with an ordered data structure: an array of `Attribute` structs.

* Added tests to validate attribute order when encoding
* Fix #108
* Improved encapsulation of XMLCoderElement's properties
arjungupta0107 pushed a commit to salido/XMLCoder that referenced this issue Jun 26, 2020
…ce#110)

This PR fixes CoreOffice#108 by replacing the unordered data structure used for storing the attributes (a Swift `Dictionary`) with an ordered data structure: an array of `Attribute` structs.

* Added tests to validate attribute order when encoding
* Fix CoreOffice#108
* Improved encapsulation of XMLCoderElement's properties
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 a pull request may close this issue.

2 participants