pantoniou / libfyaml

Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite.
MIT License
241 stars 74 forks source link

Attempting to dump unresolved aliases to JSON should yield a failure / nonzero exit #9

Closed cemerick closed 4 years ago

cemerick commented 4 years ago

Given

foo: &foo 5
bar: *foo

libfyaml/src/fy-tool -m json foo.yaml yields:

{
  "foo": 5,
  "bar": "foo"
}

I would expect an error message and nonzero exit code when attempting to emit JSON corresponding to any input YAML that contains unresolved aliases.

(Note that alias resolution when emitting JSON appears to work just fine.)

pantoniou commented 4 years ago

You will now get an error, so closing.

foo.yaml:2:7: error: aliases not allowed in JSON emit mode bar: *foo ^~~