yaml: Anchors and merge keys strangeness

YAML supports sharing data between multiple parts of the document using "anchors", marked with &label, and "merges", written as *label. Unfortunately, different tools seem to interpret the spec slightly differently so it's necessary to check how each of these scenarios behave:

%YAML 1.2
---
definitions:
  sharedBranch: &sharedBranch
      branch: shared
  def2: &def2
      foo: bar

shouldNotOverwriteExistingKeyButMight:
  branch: specific
  <<: *sharedBranch

canOverrideMergedWithLaterKey:
  <<: *sharedBranch
  branch: specific

shouldSupportMultipleMergesButMightNot:
  <<: *sharedBranch
  <<: *def2

preferred:
  <<: [ *sharedBranch, *def2 ]
  branch: specific
Published on: 26 Jun 2023