You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When parsing a document like this:
foo: *bar
The errors array on the parsed document is empty, and toJS will throw ReferenceError: Unresolved alias
To Reproduce
> const yaml = await import("yaml")
undefined
> const docs = yaml.parseAllDocuments("foo: *bar")
undefined
> docs.length
1
> docs[0].errors
[]
> docs[0].toJS()
Uncaught ReferenceError: Unresolved alias (the anchor must be set before the alias): bar
at Alias.toJSON (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/Alias.js:42:19)
at Object.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/toJS.js:22:26)
at Object.addPairToJSMap (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/addPairToJSMap.js:32:34)
at YAMLMap.toJSON (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/YAMLMap.js:124:28)
at Object.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/toJS.js:22:26)
at Document.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/doc/Document.js:301:26)
>
Expected behaviour
I expect an error on the document after calling yaml.parseAllDocuments.
> docs[0].errors.length
1
Versions (please complete the following information):
Environment: Node.js v18.15.0
yaml: 2.3.2
The text was updated successfully, but these errors were encountered:
Pondering now whether something actually needs to be added, as this works, and provides an opportunity to take whatever locally appropriate action when encountering an unresolvable alias.
Describe the bug
When parsing a document like this:
The
errors
array on the parsed document is empty, andtoJS
will throwReferenceError: Unresolved alias
To Reproduce
Expected behaviour
I expect an error on the document after calling
yaml.parseAllDocuments
.Versions (please complete the following information):
yaml
: 2.3.2The text was updated successfully, but these errors were encountered: