Closed sharky98 closed 1 month ago
TIL, this is by design for YAML 1.1 that the keys are parsed like anything else. Damn YAML is complex!
https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell#non-string-keys
Yeah, this seems to be an uncomfortably common stumbling block. It might make sense to add an option like stringKeys
to enforce their parsing as such.
Describe the bug When parsing a Unity YAML file, one object is defined with key-value pairs, including one with a
y
in it (like in X,Y coordinates). When parsed, the key is transformed to a booleantrue
.To Reproduce
Using the Playground, parse the following YAML
gives the following result:
Expected behaviour The key of a key-value pair, should not be transformed according to the boolean rule.
Versions (please complete the following information):
yaml
: 2.5.1Additional context
I found the schema used, but I have no clues where it get used when parsing the key.
https://github.com/eemeli/yaml/blob/5adbb605b64094b57bc95cbc24587e6f36b3f9a8/src/schema/yaml-1.1/bool.ts