Open fresh2dev opened 2 weeks ago
Describe the bug
Nested anchors of mappings do not retain order.
Version of yq: 4.44.3 Operating system: mac Installed via: binary release
Input Yaml data1.yml:
.global-config: &global-config first: foo second: bar third: baz .local-config: &local-config <<: *global-config first: FOO final-config: <<: *local-config
Command The command you ran:
yq 'explode(.)' data1.yml
Actual behavior
--- .global-config: first: foo second: bar third: baz .local-config: second: bar third: baz first: FOO final-config: second: bar third: baz first: FOO
Expected behavior
--- .global-config: first: foo second: bar third: baz .local-config: first: FOO second: bar third: baz final-config: first: FOO second: bar third: baz
Additional context I tested with Helm using a values.yaml, Python's pyyaml, the Python yq, and each of them do retain order of nested anchors. E.g.,
pyyaml
yq
spec: template: metadata: labels: app.kubernetes.io/managed-by: Helm first: FOO second: bar third: baz
Describe the bug
Nested anchors of mappings do not retain order.
Version of yq: 4.44.3 Operating system: mac Installed via: binary release
Input Yaml data1.yml:
Command The command you ran:
Actual behavior
Expected behavior
Additional context I tested with Helm using a values.yaml, Python's
pyyaml
, the Pythonyq
, and each of them do retain order of nested anchors. E.g.,