You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using .git as repository for a structurizr lite project even the smallest changes reshuffles the content of workspace.json making the git history unusable
Thanks ... this helps, but doesn't solve the bigger problem, which is that the many of the JSON lists get mapped to Java sets (mostly LinkedHashSet) and the ordering of items is not guaranteed. I need to switch all of the LinkedHashSet references to TreeSet, and then ensure that everything being added to them implements Comparable. I did a quick test of this recently, repeatedly going to/from JSON several hundred times, and I did see the same JSON each time. It does potentially require a few other code changes too. This has been on my todo list for a while now, so leave it with me. 👍
Thanks - that would be wonderfull for my git history, looking forward to it 👏
simonbrowndotje
changed the title
use MapperFeature.SORT_PROPERTIES_ALPHABETICALLY flag when writing workspace.json
Serialization to JSON is not deterministic
Mar 1, 2024
Description
Using .git as repository for a structurizr lite project even the smallest changes reshuffles the content of workspace.json making the git history unusable
My best guess is that this could be mitigated by using the objectmapper setting objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) in the AbstractJsonWriteClass
See: https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-annotations/latest/com/fasterxml/jackson/annotation/JsonPropertyOrder.html
Priority
I'm willing to add this feature myself and raise a PR (please confirm approach first)
More information
No response
The text was updated successfully, but these errors were encountered: