Skip to content
uencoder

YAML Tags

YAML tags explicitly specify a node's type with !name, resolving the node to a custom class or a particular scalar type.

Purpose

To explicitly annotate node data types in YAML, supporting custom type resolution and schema validation.

Mechanism

!type placed before a node sets its tag, and the parser converts the node to the corresponding type. Built-in tags include !!str, !!int, and !!map; custom tags such as !include trigger file inclusion.

Use cases

  • Custom YAML types
  • File include directives
  • Strict type annotation

Related tools

References