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
":" is a valid character when defining anchors and using aliases.
It is valid to use aliases as keys.
":" is also used to denote a node.
This seems to cause a bug where you are unable to use aliases as keys unless you separate the alias from the ":" with whitespace.
Trailing ":"'s look like they're being included in the alias token by the while loop in loader.readAlias().
I don't know the code very well, but a fix might need some extra logic in loader.composeNode().
I would generally add a space after an alias key to make sure it's portable. It should also be noted that libyaml and pyyaml do not support : anywhere in aliases/anchors.
When playing with that, it seems I found a bug in libyaml, pyyaml and snakeyaml: foo: &a:b bar is parsed the same as foo: &a :b bar
@perlpunk
In personal experience, I have not seen other usage in which people add spaces after their aliases to mitigate this problem, but it's good advice for compat /w this version of js-yaml.
I agree about disallowing : in aliases in the tokenizer.
Since the spec is so lax on this point, it's probably a source of implementation specific divergences like you discovered.
js-yaml: @3.7.0
Node v7.2.1
Windows 10 Pro
disclaimer: I'm not an expert on the YAML spec
the bug
"
:
" is a valid character when defining anchors and using aliases.It is valid to use aliases as keys.
"
:
" is also used to denote a node.This seems to cause a bug where you are unable to use aliases as keys unless you separate the alias from the "
:
" with whitespace.Trailing "
:
"'s look like they're being included in the alias token by the while loop inloader.readAlias()
.I don't know the code very well, but a fix might need some extra logic in
loader.composeNode()
.some tests
output
The text was updated successfully, but these errors were encountered: