dtolnay/serde-yaml

Strings that are commonly interpreted as booleans by other YAML parsers are not escaped

Opened this issue · 0 comments

Serde-yaml creates ambiguous YAML during the serialization of keys with string values that could be considered boolean in YAML 1.1. For instance, serializing foo with the string value no results in foo: no. Many YAML 1.2 parsers would still interpret no as boolean due to continued support for 1.1 booleans. I ran into this issue using Python's yaml module:

>>> import yaml
>>> data = yaml.safe_load("foo: no")
>>> print(data)
{'foo': False}

To avoid YAML created from serde-yaml being misinterpreted by many YAML parsers, string values that may be seen as booleans should be quoted or otherwise disambiguated from YAML 1.1 boolean values.