Replies: 1 comment 1 reply
-
It's not valid yaml to have duplicate key names in a map |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all
Apologies for yet another question.
I'm looking to output all the leaf keys in a yaml file such that I can flag if there are any duplicates present.
For a yaml file like:
I want to get yq to output:
This would let me do something like
yq '<some command>' myFile.yaml | uniq -cd
and see
Something like
yq '(keys)[]'
will only handle the top level things:
Looking at another discussion question, I can get close with
yq '.. | select((tag == "!!map" or tag == "!!seq") | not) | (path | join("."))'
which will give me all the keys but not the dupes:
and
yq '... | select((tag == "!!map" or tag == "!!seq") | not) | (path | join("."))'
which shows the dupes but is showing too much
Is this possible with yq to get all keys, regardless of duplication, to output?
Beta Was this translation helpful? Give feedback.
All reactions