Skip to content
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

v3: dumps indenting not coherent with v2 #647

Closed
sylr opened this issue Aug 7, 2020 · 3 comments
Closed

v3: dumps indenting not coherent with v2 #647

sylr opened this issue Aug 7, 2020 · 3 comments

Comments

@sylr
Copy link
Contributor

sylr commented Aug 7, 2020

The way v3 indents dumps by default is different from v2 and I think it shouldn't be:

  • default indenting is now 4 spaces instead of 2
  • list items are now shifted right instead of being vertically aligned with the key
a: Easy! v2
b:
  c: 2
  d:
  - 3
  - 4
a: Easy! v3
b:
    c: 2
    d:
        - 3
        - 4

I know it won't matter but I personally prefer the looks of the first dump.

Also I've seen this change break tests that rely on yaml string equality.

@laverya
Copy link
Contributor

laverya commented Aug 7, 2020

I've also seen this break unit tests.

@niemeyer
Copy link
Contributor

niemeyer commented Aug 7, 2020

Yes, in v3 we've fixed the indentation so that each level is coherently aligned across all elements and nesting levels. Note in your example how the second output is perfectly aligned according to its depth, while the first is not.

Tests expecting an exact format will indeed break. That's why this was done between v2 and v3 and not inside the release.

@bai
Copy link

bai commented Sep 3, 2020

Given how low level this lib is, this looks like a major breaking change for many people. If you really insist on having it in place, maybe it'd make sense to have it as part of v4? Do you think you could re-consider this change as part of v3? 🙏

For example, kustomize and kpt are all guaranteeing consistent formatting when managing kubernetes manifests for GitOps et al. This is going to cause a lot of changes in Kubernetes manifests ecosystem out of the blue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants