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

Exported YAML may be ambiguous #1222

Open
vkleen opened this issue Apr 4, 2023 · 0 comments
Open

Exported YAML may be ambiguous #1222

vkleen opened this issue Apr 4, 2023 · 0 comments

Comments

@vkleen
Copy link
Contributor

vkleen commented Apr 4, 2023

Describe the bug
When exporting string valued fields to YAML, the exporter optimistically omits quoting, e.g. { foo = "bar" } exports to

foo: bar

When such a string could be interpreted as a sexagesimal number in YAML 1.1, i.e. { foo = "00:00" }, this produces the export

foo: 00:00

which, according to YAML 1.1, is parsed as a record with a single field foo with value the integer 0. This becomes an issue when interacting with, for example, libyaml based parsers, as other people have observed already.

For maximum interoperability it might be best to unconditionally quote strings. A workaround in the meantime is to use that YAML is supposed to be a superset of JSON and to use the JSON exporter instead. But this leads to less idiomatic configuration outputs in places.

Additional context
Since nickel really just piggy backs on serde_yaml as its exporter, this might be something that can only be addresses upstream.

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

No branches or pull requests

1 participant