every time i re-generate a symbol graph, the ordering of the JSON keys changes, and because symbolgraphs are minified, this means the entire file (often many megabytes in size) gets overwritten in git. this also makes it hard to detect actual changes in the symbolgraph output, since every regenerated symbolgraph shows up as a modification.
that would involve adding another stage of postprocessing whose only purpose is to stabilize source control. the compiler really should just emit the JSON with keys sorted by default (or is there already a setting for this?)
i will add that i tried implementing this as part of the swift-documentation-extract SPM plugin using swift-json, but that’s tricky because swift-json itself depends on the plugin, which makes a circular dependency…
I filed an issue on this a while back because it also affects how the symbol graph code is tested in the compiler. It needs to define a deterministic ordering for symbols and relationships and then perform this sorting before rendering the JSON. There could be an issue about performance for larger symbol graphs, so we may want to measure that impact before landing a change like that.