YamlReaderOptions
OfficeIMO.Yaml
Settings for YamlReader. The defaults read YAML 1.2 as real files use it (see YamlReaderOptions.Strict) and bound resource use for untrusted input. An instance can be shared by readers on several threads as long as it is not modified while they run.
Inheritance
- object
- YamlReaderOptions
Usage
Explore 3 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 2
- Property YamlReaderOptions.UntrustedDefaults
- Property YamlSerializerOptions.ReaderOptions
Accepted by parameters 1
- Constructor YamlReader.YamlReader
Constructors
public YamlReaderOptions() #Inherited Methods
Properties
public static YamlReaderOptions UntrustedDefaults { get; } #Gets new options for input from outside, with the limits of YamlLoadOptions.UntrustedDefaults: input up to 16 MiB, nesting up to 64, alias expansion up to 10,000 nodes and scalars up to 1 MiB of characters. Each call returns a new instance.
public YamlSchema? Schema { get; set; } #Gets or sets the schema used by the typed accessors. When null (the default), each document uses YamlSchema.Core, or YamlSchema.Yaml11 when it declares %YAML 1.1. Set it to force one schema for ecosystems that assume YAML 1.1 without declaring it.
public bool Strict { get; set; } #Gets or sets whether the reader follows the YAML 1.2.2 specification exactly. Off by default, the reader also accepts the indentation that libyaml and SharpYaml accept and real files rely on: lines inside a flow collection (such as a closing ] under its key) and quoted-scalar continuation lines indented no deeper than the enclosing block collection. Each accepted occurrence is reported in YamlReader.Diagnostics. When on, both forms are syntax errors, as the specification requires.
public bool IncludeComments { get; set; } #Gets or sets whether the reader reports YamlTokenType.Comment events, in source order. Off by default; when off, comments cost nothing beyond skipping them.
public int MaxDepth { get; set; } #Gets or sets the maximum nesting of collections. Block and flow collections count the same, so a: {b: 1} and a block mapping inside a block mapping both nest two deep. Defaults to 256.
public int MaxNodes { get; set; } #Gets or sets the maximum number of nodes one document of a loaded model may hold. Defaults to 10,000,000; YamlReaderOptions.UntrustedDefaults lowers it to 200,000. The forward-only reader does not enforce it, so streaming consumers can read unbounded multi-document streams.
public int MaxAliasExpansion { get; set; } #Gets or sets the maximum number of nodes visited while resolving aliases, which stops "billion laughs" inputs in resolved views and deserialization. Defaults to 100,000. The reader reports aliases without expanding them.
public int MaxScalarLength { get; set; } #Gets or sets the maximum length of one scalar's source text in UTF-16 code units, including quotes and block scalar indentation. Defaults to 16 MiB of characters.
public long? MaxInputBytes { get; set; } #Gets or sets the maximum input size, or null (the default) for no limit. Stream input counts bytes; string, memory and TextReader input count UTF-16 code units.