xyaml

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package xyaml contains utility functions for parsing YAML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNullElements added in v0.8.8

func CheckNullElements(t any, node *yaml.Node) error

CheckNullElements finds if the node has any null values in positions which decode into a nil pointer.

Such positions are elements of a sequence decoded into a slice of pointers, and values of a mapping decoded into a map with pointer values, e.g. `[]*T` and `map[string]*T`:

list:
  - null
  - field: value

Code iterating over such a slice or map rarely expects nil entries, so it is safer to reject them while decoding than to panic later on.

A null value for a struct field is allowed, as it is a conventional way to unset the field.

All offending positions are reported, joined into a single error.

func CheckUnknownKeys added in v0.8.3

func CheckUnknownKeys(t any, node *yaml.Node) error

CheckUnknownKeys finds if the node has any extra keys which do not exist in t.

func UnmarshalStrict

func UnmarshalStrict[T any](data []byte, t T) error

UnmarshalStrict decodes YAML document validating that there are no extra fields found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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