Open embetrix opened 1 month ago
Hi @embetrix , despite the changed order, both the input and the combined output should be semantically identical. If not, this is a bug. As kas internally represents the configuration as a python dict, the order is currently not preserved.
Do you have a use-case where preserving the order is required (or desired)? Ideally, you could also bring this topic up on the mailing list (kas-devel@googlegroups.com), as we have a broader audience there.
@fmoessbauer I agree that the semantic and usage are identical even the order has changed. My use case is that I would like that for release branches using a fixed dump of the kas yaml file and track the changes easily in Git, with a changed order it's hard to comprehend.
I think that kas dump is sorting the yaml keys alphabetically, I believe it can be turned off.
I think that kas dump is sorting the yaml keys alphabetically, I believe it can be turned off.
By that I expect to get a rather stable ordering. Without sorting, the keys are likely at nondeterministic positions, which makes thinks even more unstable.
At least for json there is a "canonical" format that is stable (keys are sorted, no whitespacing). I don't know if a similar standard also exists for yaml. This however, is likely not the solution you are looking for.
maybe as an option parameter for kas dump : do not sort ?
kas-example.yml:
kas dump --resolve-refs kas-example.yml > kas-example-fixed.yml
kas-example-fixed.yml:
would be possible to keep the same original structure for kas-example-fixed.yml?: