Skip to content

Merge keys shouldn’t be supported by default #646

@remcohaszing

Description

@remcohaszing

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions