We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When an object using merge alias is copied, the anchor value is modified and explode operator is used, the copied object contains old unmodified data.
Version of yq: 4.28.1 (windows) 4.30.6 (linux) Operating system: linux and windows Installed via: choco on windows, snap on linux
Input Yaml data1.yml:
a: &a x: "OriginalValue" b: <<: *a
Command The command you ran:
yq ' .c = .b | .a.x = "ModifiedValue" | explode(.) ' input.yml
Actual behavior
a: x: "ModifiedValue" b: x: "ModifiedValue" c: x: "OriginalValue"
Expected behavior
a: x: "ModifiedValue" b: x: "ModifiedValue" c: x: "ModifiedValue"
Additional context I believe result from expected behavior should be correct, since if the explode operator is omitted, the resulting yaml is:
a: &a x: "ModifiedValue" b: !!merge <<: *a c: !!merge <<: *a
which is correctly exploded to the yaml in expected behavior.
Furthermore, correct result can be achieved by splitting the script into two calls of yq by runing:
yq ' .c = .b | .a.x = "ModifiedValue" ' input.yml | yq ' explode(.) ' -
The text was updated successfully, but these errors were encountered:
Fixed merged anchor reference problem #1482
3f1f66a
Thanks for the detailed bug description - will release the fix in the next release
Sorry, something went wrong.
Fixed in v4.31.2
No branches or pull requests
When an object using merge alias is copied, the anchor value is modified and explode operator is used, the copied object contains old unmodified data.
Version of yq: 4.28.1 (windows) 4.30.6 (linux)
Operating system: linux and windows
Installed via: choco on windows, snap on linux
Input Yaml
data1.yml:
Command
The command you ran:
Actual behavior
Expected behavior
Additional context
I believe result from expected behavior should be correct, since if the explode operator is omitted, the resulting yaml is:
which is correctly exploded to the yaml in expected behavior.
Furthermore, correct result can be achieved by splitting the script into two calls of yq by runing:
The text was updated successfully, but these errors were encountered: