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

Strange formatting when the key size is greater than 128 characters #1192

Closed
shoelzle opened this issue Apr 22, 2022 · 2 comments
Closed

Strange formatting when the key size is greater than 128 characters #1192

shoelzle opened this issue Apr 22, 2022 · 2 comments
Labels

Comments

@shoelzle
Copy link

Describe the bug
The key size in dicts seems to be limited to 128 characters.

Version of yq: 4.24.5
Operating system: mac
Installed via: homebrew

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
values.yaml:

# this is ok
THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS: "egal"
# too long
TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO: "egal"

Command
The command you ran:

yq . values.yaml

Actual behavior

# this is ok
THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS: "egal"
# too long
? TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO
: "egal"

Expected behavior

# this is ok
THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS_OK_THIS_IS: "egal"
# too long
TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO_LONG_TOO: "egal"
@mikefarah
Copy link
Owner

I can replicate this. This is caused by the underlying yaml parser go-yaml.

For what it's worth - it's still valid yaml, it's just a formatting choice by the library. I'm guessing to split the entry so that they key is on one line 🤷🏼

See https://stackoverflow.com/questions/33987316/what-is-a-complex-mapping-key-in-yaml for more details. Feel free to raise an issue against go-yaml v3.

@mikefarah mikefarah changed the title The key size in dicts seems to be limited to 128 characters Strange formatting when the key size is greater than 128 characters Apr 26, 2022
@shoelzle
Copy link
Author

shoelzle commented May 9, 2022

Thanks for taking care @mikefarah.
I raised an issue against go-yaml: go-yaml/yaml#849

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

No branches or pull requests

2 participants