Describe the bug
I'm trying to work with anchors and alias operators but I'm getting an error merge anchor only supports maps, got !!seq instead while I'm exploding the yaml.
It seems the line - <<: *my-anchor is the problem since I can work without that line but if it exists then throw the error.
Docs say
yq supports merge aliases (like <<: *blah) ...
So I didn't expected the error.
Version of yq: 4.44.3
Operating system: linux
Installed via: binary release
Input Yaml
level_1:
- name: one
level_2: &my-anchor
- name: one_v1
level_3:
- name: foo
- name: two
level_2:
- <<: *my-anchor # uses my-anchor configuration
- name: one_v1
level_3: # add level_3.name: bar to my-anchor
- name: bar
Command
yq 'explode(.)' data1.yml
Actual behavior
It throws an error:
Error: merge anchor only supports maps, got !!seq instead
Expected behavior
Just expand yaml and generate something like this:
---
level_1:
- name: one
level_2:
- name: one_v1
level_3:
- name: foo
- name: two
level_2:
- name: one_v1 # this is the anchor property
level_3:
- name: foo
- name: one_v1
level_3:
- name: bar
I've tried using other linters but format seems ok and could be possible to expand.
Also I've tried to expand without - <<: *my-anchor line and not throw an error and I've run yq '.level_1[0] | explode(.)' data1.yml and also works fine. So problem seems to be the definition - <<: *my-anchor.
Describe the bug I'm trying to work with anchors and alias operators but I'm getting an error
merge anchor only supports maps, got !!seq instead
while I'm exploding the yaml.It seems the line
- <<: *my-anchor
is the problem since I can work without that line but if it exists then throw the error.Docs say
So I didn't expected the error.
Version of yq: 4.44.3 Operating system: linux Installed via: binary release
Input Yaml
Command
Actual behavior
It throws an error:
Expected behavior
Just expand yaml and generate something like this:
I've tried using other linters but format seems ok and could be possible to expand.
Also I've tried to expand without
- <<: *my-anchor
line and not throw an error and I've runyq '.level_1[0] | explode(.)' data1.yml
and also works fine. So problem seems to be the definition- <<: *my-anchor
.