Open
Description
Describe the bug
When I use a merge key (<<:
) with an inline map rather than an anchor, yq
doesn't propagate keys to the parent map.
Version of yq: 4.45.4
Operating system: linux
Installed via: binary release
Input Yaml
data1.yml:
dummy: 42
<<:
foo: 123
Command
yq eval '.bar' data1.yml
yq eval 'explode(.)' data1.yml
Actual behavior
.bar
:
null
explode(.)
:
dummy: 42
Expected behavior
.bar
:
123
explode(.)
:
dummy: 42
foo: 123
Additional context
Other YAML parsers seem fine with this, e.g. PyYAML (and online tools: https://www.yamllint.com/, https://jsonformatter.org/yaml-to-json). See also the spec.
I encountered this problem when implementing a custom !include
tag using load(.)
, where exploding <<: !include "file.yml"
wouldn't work.