Open williamjoy opened 2 years ago
Oh I see - the anchors need to go on the top. I guess it could order keys that are anchors first, then regular keys.
this same problem is when you merge multiple files - anchors are kept and when everything sorted - reading the output yaml in a different parser throws exceptions on missing anchors. In other words - the output yaml is invalid.
@mikefarah - Can this be prioritized? I think when you do eval, you should be removing anchors as they are local to each file.
Describe the bug yq sortKeys() may output yaml with
unknown anchor 'c' referenced
Note that any how to questions should be posted in the discussion board and not raised as an issue.
Version of yq: 4.13.2 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) test.yaml:
Command The command you ran:
Actual behavior
Expected behavior
It should output valid yaml anchor order
Additional context Debug