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

Order of map is nondeterministic, making read+write randomize the file #55

Closed
rakudrama opened this issue Jun 19, 2019 · 4 comments · Fixed by #57
Closed

Order of map is nondeterministic, making read+write randomize the file #55

rakudrama opened this issue Jun 19, 2019 · 4 comments · Fixed by #57

Comments

@rakudrama
Copy link
Member

The use of a HashMap here https://github.com/dart-lang/yaml/blob/master/lib/src/equality.dart#L13
ensures that when the elements of a map are added here https://github.com/dart-lang/yaml/blob/master/lib/src/loader.dart#L156
the order is nondeterministic.

This shows itself in tools that read then write yaml - the output is needlessly reorganized.

The default behaviour should keep the input order (change HashMap to LinkedHashMap)

Sorting would be a nice option, but keeping the original order would

@shyndman
Copy link

shyndman commented Aug 6, 2019

Hello yaml maintainers,

Would you consider accepting a pull for this?

@shyndman
Copy link

Ping @rakudrama

@2dxgujun
Copy link

+1 Same problem here

@rakudrama
Copy link
Member Author

  • @vsmenon could we find an owner for this issue?

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.

3 participants