ynode

package
v0.0.0-...-3d40d98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ynode spells yaml.v3 nodes: the tag a resolved `<<` merge key carries, the constructors for the node kinds a parse produces, and the merge chain the compiler's depth bounds are measured against.

It sits below nodeview, which reads MergeTag back for its merge-key predicate, rather than beside it. Both the view and the cycle scan build these nodes from their own internal test files, and an internal test file cannot import a package that imports its own — so a home above nodeview would be one the view's tests could not reach. Holding the tag here is what lets a single definition of Merge serve both.

Index

Constants

View Source
const MergeTag = "!!merge"

MergeTag is the tag yaml.v3 resolves every `<<` merge key to, and the exact tag speakeasy's yml.IsMergeKey requires before treating one as a merge.

Variables

This section is empty.

Functions

func Alias

func Alias(target *yaml.Node) *yaml.Node

Alias builds an alias resolved to target, as yaml.v3 resolves one to the node its anchor names.

func Map

func Map(pairs ...*yaml.Node) *yaml.Node

Map builds a mapping from pairs, given as alternating key and value nodes — the layout yaml.v3 gives a mapping's Content.

func Merge

func Merge() *yaml.Node

Merge builds the `<<` merge key a parse produces, tag included: the same scalar without MergeTag is an ordinary key.

func MergeChain

func MergeChain(levels int) *yaml.Node

MergeChain builds levels mappings, each merging the next through `<<` and an alias, over a leaf mapping of one pair. Expanding the whole chain re-materializes every pair beneath each level, which is the cost the merge-depth bound exists to cap.

func MergeChainSpec

func MergeChainSpec(levels int) string

MergeChainSpec is MergeChain in source form: an OpenAPI document whose x-anchors nest levels `<<` merges, with one schema per level naming a different point on the chain, so a reader that re-expands the chain at every reference pays the depth once per schema.

func Scalar

func Scalar(v string) *yaml.Node

Scalar builds an untagged plain scalar holding v.

func Seq

func Seq(items ...*yaml.Node) *yaml.Node

Seq builds a sequence holding items.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL