IYamlSchema Interface

Provides schema information for tag resolution.

public interface IYamlSchema

Methods

NameDescription
ExpandTag(string)Expands the tag. Example, transforms a short tag '!!str' to its long version 'tag:yaml.org,2002:str'
GetDefaultTag(NodeEvent)Gets the default tag for the specified NodeEvent. The default tag can be different from a actual tag of this NodeEvent.
GetDefaultTag(Type)Gets the default tag for the specified Type. This is only valid for scalar, return null if no default tag found.
GetTypeForDefaultTag(string?)Gets the type for a default tag.
IsTagImplicit(string?)Determines whether the short tag implicit (e.g. !!int).
RegisterTag(string, string)Registers a long/short tag association.
ShortenTag(string)Shortens the tag. Example, transforms a long tag 'tag:yaml.org,2002:str' to its short version '!!str'
TryParse(Scalar, bool, string?, object?)Gets the default tag and value for the specified Scalar. The default tag can be different from a actual tag of this NodeEvent.
TryParse(Scalar, Type, object?)Gets the default tag and value for the specified Scalar. The default tag can be different from a actual tag of this NodeEvent.

ExpandTag(string)

Expands the tag. Example, transforms a short tag '!!str' to its long version 'tag:yaml.org,2002:str'

string? ExpandTag(string shortTag)

Parameters

shortTag string
The tag.

Returns

string? Expanded version of the tag.

GetDefaultTag overloads

GetDefaultTag(NodeEvent)

Gets the default tag for the specified NodeEvent. The default tag can be different from a actual tag of this NodeEvent.

string? GetDefaultTag(NodeEvent nodeEvent)
Parameters
nodeEvent NodeEvent
The node event.
Returns

string? A short tag.

GetDefaultTag(Type)

Gets the default tag for the specified Type. This is only valid for scalar, return null if no default tag found.

string? GetDefaultTag(Type type)
Parameters
type Type
Returns

string? A short tag.

GetTypeForDefaultTag(string?)

Gets the type for a default tag.

Type? GetTypeForDefaultTag(string? tag)

Parameters

tag string?
The tag in short form.

Returns

Type? The type for a default tag or null if no default tag associated

IsTagImplicit(string?)

Determines whether the short tag implicit (e.g. !!int).

bool IsTagImplicit(string? tag)

Parameters

tag string?
The tag.

Returns

bool true if [is tag implicit] [the specified tag]; otherwise, false.

RegisterTag(string, string)

Registers a long/short tag association.

void RegisterTag(string shortTag, string longTag)

Parameters

shortTag string
The short tag.
longTag string
The long tag.

Exceptions

ArgumentNullException
shortTag or shortTag

ShortenTag(string)

Shortens the tag. Example, transforms a long tag 'tag:yaml.org,2002:str' to its short version '!!str'

string? ShortenTag(string tag)

Parameters

tag string
The tag.

Returns

string? Expanded version of the tag.

TryParse overloads

TryParse(Scalar, bool, string?, object?)

Gets the default tag and value for the specified Scalar. The default tag can be different from a actual tag of this NodeEvent.

bool TryParse(Scalar scalar, bool decodeValue, out string? defaultTag, out object? value)
Parameters
scalar Scalar
The scalar event.
decodeValue bool
if set to true [decode value].
defaultTag string?
The default tag decoded from the scalar.
value object?
The value extracted from a scalar.
Returns

bool System.String.

TryParse(Scalar, Type, object?)

Gets the default tag and value for the specified Scalar. The default tag can be different from a actual tag of this NodeEvent.

bool TryParse(Scalar scalar, Type type, out object? value)
Parameters
scalar Scalar
The scalar event.
type Type
The type.
value object?
The value extracted from a scalar.
Returns

bool System.String.