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

no support for duplicate keys #14

Closed
clux opened this issue Sep 16, 2023 · 2 comments
Closed

no support for duplicate keys #14

clux opened this issue Sep 16, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@clux
Copy link
Owner

clux commented Sep 16, 2023

it is not possible to pass stuff like:

foo:
  bar: 1
  bar: 2

through yq. you'll get: Error: foo: duplicate entry with key "bar" at line 2 column 3, which tbh is correct, and it's (i think) what serde_yaml enforces.

unfortunately... tools like helm allow you doing this, and there are some charts that rely on the second set of key overriding the first (taking precedence)... so leaving this issue here as a link from caveats.

EDIT: not even sure if the above helm use case works anymore; ci systems such as flux's kustomize-controller just flat out reject duplicate keys now

don't really want to support this because it is bad, and i don't even think this is practically possible with serde_yaml. probably wontfix.

@clux clux added the wontfix This will not be worked on label Sep 16, 2023
@clux
Copy link
Owner Author

clux commented Sep 16, 2023

NB: jq does also support this type of awkward key precedence:

$ echo '{"foo": 1, "foo": 2}' > duplicate.json
$ jq .foo duplicate.json
2

@clux
Copy link
Owner Author

clux commented Sep 16, 2023

toml parser also chokes on this in rust:

Error: TOML parse error at line 8, column 1
  |
8 | version = "0.6.0"
  | ^
duplicate key `version` in table `package`

when inserting a duplicate key in Cargo.toml.

probably best to stay consistent and have this crate be strict about things.

@clux clux closed this as completed Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant