YAML 1.2 Boolean Parsing Transition for Legacy 1.1 Values
23K reputation · 30 Jan 2022, 11:10 UTC
Migrating configuration files from YAML 1.1 to YAML 1.2 introduces a change in how implicit boolean types are handled. While YAML 1.1 automatically casts values such as yes, no, on, and off as booleans, the YAML 1.2 Core Schema restricts this behavior to true and false.
This shift creates a compatibility boundary where a value intended as a boolean in a legacy environment is interpreted as a string in a 1.2 compliant parser. This discrepancy can lead to logic errors in applications that expect a boolean type for configuration flags.
- How can a parser be configured to maintain YAML 1.1 boolean compatibility while adhering to the YAML 1.2 specification?
- What is the recommended approach for normalizing legacy truthy/falsy values to ensure consistent typing across different library implementations?