Closed endgame closed 1 year ago
It seems unlikely that aeson will gain the ability to do sorted Object
s any time soon, so I think that makes sorted fields a better way to go.
Please try it and let me know if you think this is better than the arbitrary "however HashMap.toList sorted them" that we used to have.
I did not try the branch. But determinism that does not depend on an implementation artifact (that in case of HashMap
should actually not be that stable, to avoid collision / DOS attacs!) is better.
Given we cannot (easily) retain the source field order ATM, I think sorting by field name is the best compromise.
Switch the generator from
HashMap
toMap
, which means that all thetoList
calls come out in sorted order. This will keep the ordering of fields predictable and should give us better diffs in future generator runs.While it might be nice to follow botocore's ordering for struct fields, I can't see a good way to do that: https://github.com/haskell/aeson/issues/984
A full regeneration is on the
endgame:gen-sorted-interfaces-gen
branch (#863). Please try it and let me know if you think this is better than the arbitrary "howeverHashMap.toList
sorted them" that we used to have.Closes #825 .