YamlSpecVersion Enum
Definition
Identifies the version of the YAML specification whose implicit type resolution the reader applies. The version controls how unquoted (plain) scalars are interpreted as booleans, null, and numbers.
public enum YamlSpecVersion
- Extension Methods
Fields
V1_2 = 0The YAML 1.2 core schema. Only
trueandfalseresolve to booleans, and an explicit tag is required to type tokens such asyesoroff.V1_1 = 1The YAML 1.1 schema. Additionally resolves
yes/no,on/off, andy/nas booleans, and accepts leading-zero octal integers, binary integers, and underscore digit grouping. Base-60 ("sexagesimal") numbers are deliberately not resolved; a colon-separated scalar such as22:22stays a string.
Remarks
The default is V1_2, whose core schema resolves only true/false as booleans and
null/~/the empty scalar as null. This avoids the well-known "Norway problem" in which YAML 1.1
silently converts unquoted tokens such as no, yes, on, and off to booleans.
Selecting V1_1 opts in to the broader YAML 1.1 implicit typing rules, including the additional
boolean spellings (yes/no, on/off, y/n), leading-zero octal integers (0NNN),
binary integers (0bNNN), and underscore digit grouping. The base-60 ("sexagesimal") numeric form of the
historical 1.1 schema is deliberately not resolved under either version: a colon-separated plain scalar such as
22:22 remains a string, avoiding the well-known footgun in which time-, port-, or address-like values were
silently reinterpreted as large numbers. The version affects only how plain scalars are typed; structural parsing of
anchors, aliases, tags, and collections is identical for both versions.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |