parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectKind

func DetectKind(raw []byte) (v1beta1.Kind, error)

DetectKind extracts the kind from raw YAML bytes.

func ParseDocuments

func ParseDocuments(r io.Reader) ([][]byte, error)

ParseDocuments reads YAML from the given reader and splits it into multiple documents. Documents are separated by `---` at the start of a line (optionally preceded by whitespace), following the YAML specification. The separator must appear on its own line.

Types

type Document

type Document struct {
	Index        int
	Raw          []byte
	APIVersion   v1beta1.Version
	Kind         v1beta1.Kind
	RealmDoc     *v1beta1.RealmDoc
	SpaceDoc     *v1beta1.SpaceDoc
	StackDoc     *v1beta1.StackDoc
	CellDoc      *v1beta1.CellDoc
	ContainerDoc *v1beta1.ContainerDoc
}

Document represents a parsed YAML document with its type information.

func ParseDocument

func ParseDocument(index int, raw []byte) (*Document, error)

ParseDocument parses a single YAML document and returns a Document with the appropriate typed doc.

type ValidationError

type ValidationError struct {
	Index int
	Kind  v1beta1.Kind
	Name  string
	Err   error
}

ValidationError represents a validation error for a specific document.

func ValidateDocument

func ValidateDocument(doc *Document) *ValidationError

ValidateDocument validates a parsed document for required fields and constraints.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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