Skip to content

True and False boolean literals seem to be parsed as strings #196

@reivilibre

Description

@reivilibre

yaml-rust/src/yaml.rs

Lines 307 to 308 in da52a68

"true" => Yaml::Boolean(true),
"false" => Yaml::Boolean(false),

I am actually really struggling to understand the YAML 1.2 spec here, but I think it's saying that a parser can be in one of two modes: JSON schema tag resolution, or core schema tag resolution (with core seemingly being recommended as a default).
https://yaml.org/spec/1.2.2/#1022-tag-resolution

From my reading:

  • In the JSON schema tag resolution, True indeed should be interpreted as "True"; but
  • in the core schema tag resolution, True should be interpreted as true.

In any case, my colleagues used to YAML 1.1 were taken by surprise when True wasn't working for them. I am not sure what the right answer is here, but I suspect these boolean literals should still be treated as valid booleans.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions