-
Notifications
You must be signed in to change notification settings - Fork 158
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
kas dump yaml file structure order #118
Comments
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 ([email protected]), as we have a broader audience there. |
@fmoessbauer I agree that the semantic and usage are identical even the order has changed. |
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 ? |
If the kas-example.yml at the beginning is configured in dictionary order, then the layout of kas-example-fixed.yml will not be so different. lol |
@gowufang I re-checked the code and actually found the inconsistency. When doing |
The yaml and json formatter differed w.r.t sorting the keys during serialization (json kept the order, yaml sorted). As pointed out in siemens#118 the users expect to maintain the order of the keys. By that, we make this the new default and add an CLI option "--sort" to sort the output. Closes: siemens#118 Signed-off-by: Felix Moessbauer <[email protected]>
The yaml and json formatter differed w.r.t sorting the keys during serialization (json kept the order, yaml sorted). As pointed out in siemens#118 the users expect to maintain the order of the keys. By that, we make this the new default and add an CLI option "--sort" to sort the output. Closes: siemens#118 Signed-off-by: Felix Moessbauer <[email protected]>
The yaml and json formatter differed w.r.t sorting the keys during serialization (json kept the order, yaml sorted). As pointed out in siemens#118 the users expect to maintain the order of the keys. By that, we make this the new default and add an CLI option "--sort" to sort the output. Closes: siemens#118 Signed-off-by: Felix Moessbauer <[email protected]>
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?:
The text was updated successfully, but these errors were encountered: