Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

safeDump produces invalid YAML if there's an anchor in an array item #30

Open
olydis opened this issue Apr 6, 2018 · 0 comments
Open

Comments

@olydis
Copy link

olydis commented Apr 6, 2018

I assume you basically use safeDump from js-yaml, so the bug might originate there; but here is what happens:

Reproducing Object

const x = {};
x.a = [{ c: 345 }];
x.b = x.a[0];

[email protected] dumps

a:
  - &ref_0c: 345
b: *ref_0

[email protected] dumps

a:
  - &ref_0
    c: 345
b: *ref_0

Problem

Note that what yaml-ast-parser dumps is invalid YAML. The anchor is directly concatenated with key c.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant