Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of alias as a map key requires a space between alias map key and the colon #85

Open
EnGamma opened this issue Feb 9, 2022 · 2 comments

Comments

@EnGamma
Copy link

EnGamma commented Feb 9, 2022

YAML code snippet:

stuff:
    key1: &k1 'map_key1'
    key2: &k2 'map_key2`
    *k1 : value1 # works, but requires space before colon
    *k2: value2  # fails with "could not find expected ':'"

PyYAML accepts no space between map key and colon, but ruyaml does not

@perlpunk
Copy link

k2: is a valid alias name in YAML (unfortunately).
PyYAML and libyaml implemented this wrong, although I can understand the decision to not support colons in alias names.

Therefor, a space is required if an alias is used as a key (so the title of this issue is right).
This is one of the things that might get removed in the next YAML version, and then the space wouldn't be required anymore, but until then, it's necessary.

@EnGamma
Copy link
Author

EnGamma commented Feb 11, 2022

Good to know. Thanks for the response.

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

No branches or pull requests

2 participants