walk

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClearNode *yaml.RNode

ClearNode is returned if GrepFilter should do nothing after calling Set

Functions

func CommentValue

func CommentValue(line string) string

Types

type ListKind

type ListKind int32
const (
	AssociativeList ListKind = 1 + iota
	NonAssociateList
)

type Visitor

type Visitor interface {
	VisitMap(*yaml.RNode, *openapi.ResourceSchema) (*yaml.RNode, error)

	VisitScalar(*yaml.RNode, *openapi.ResourceSchema) (*yaml.RNode, error)

	VisitList(*yaml.RNode, *openapi.ResourceSchema, ListKind) (*yaml.RNode, error)

	VisitLeaf(*yaml.RNode, *yaml.RNode, string, *openapi.ResourceSchema) (*yaml.RNode, error)
}

Visitor is invoked by walk with source and destination node pairs

type Walker

type Walker struct {
	// Visitor is invoked by GrepFilter
	Visitor

	Schema *openapi.ResourceSchema

	// Source is the RNode to walk.  All Source fields and associative list elements
	// will be visited.
	Source *yaml.RNode

	// Path is the field path to the current Source Node.
	Path []string

	// InferAssociativeLists if set to true will infer merge strategies for
	// fields which it doesn't have the schema based on the fields in the
	// list elements.
	InferAssociativeLists bool

	// VisitKeysAsScalars if true will call VisitScalar on map entry keys,
	// providing nil as the OpenAPI schema.
	VisitKeysAsScalars bool
}

Walker walks the Source RNode and modifies the RNode provided to GrepFilter.

func (Walker) GetSchema

func (l Walker) GetSchema() *openapi.ResourceSchema

func (Walker) Kind

func (l Walker) Kind() yaml.Kind

func (Walker) Walk

func (l Walker) Walk() (*yaml.RNode, error)

GrepFilter implements yaml.GrepFilter

Jump to

Keyboard shortcuts

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