plane icon indicating copy to clipboard operation
plane copied to clipboard

Support for merge keys was removed in YAML 1.2. However, this is still supported in `js-yaml`.

Open nxqh65qsgg-cpu opened this issue 1 week ago • 1 comments

Support for merge keys was removed in YAML 1.2. However, this is still supported in js-yaml.

See changes in version 1.2

Since js-yaml aims to be YAML 1.2 compatible, it should treat << as a regular key.

Given the following script:

const yaml = require('js-yaml');

console.dir(yaml.load(`
foo: &foo
  f: oo

bar:
 <<: *foo
`))

Expected output:

{ foo: { f: 'oo' }, bar: { '<<': { f: 'oo' } } }

Actual output:

{ foo: { f: 'oo' }, bar: { f: 'oo' } }

I realize many people expect this to work the way as it does now, so a fix should be considered carefully, possibly in a major version release.

Originally posted by @remcohaszing in https://github.com/nodeca/js-yaml/issues/646

nxqh65qsgg-cpu avatar Jan 08 '26 03:01 nxqh65qsgg-cpu