expressionvalidation

package
v0.19.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseReferencedNodes

func ParseReferencedNodes(expression string) ([]string, error)

ParseReferencedNodes returns the names referenced via $['Name'] inside the given expression body, in source order.

func ValidateBareExpression

func ValidateBareExpression(raw string, knownNodeNames map[string]struct{}) error

ValidateBareExpression checks the same expression body but skips the strict compile-time identifier resolution. Use it for FieldTypeExpression values without {{ }} framing: at runtime those flow through as literal strings unless a component explicitly evaluates them, so identifiers like "default" or "ok" are valid literal payloads, while obvious syntax errors and unknown node references still need to be caught.

func ValidateCanvasExpressions

func ValidateCanvasExpressions(reg *registry.Registry, nodes []*componentpb.Node) map[string][]ExpressionError

ValidateCanvasExpressions runs static expression validation across every node's configuration. Errors are returned per node ID; an empty result means nothing failed.

func ValidateExpression

func ValidateExpression(raw string, knownNodeNames map[string]struct{}) error

ValidateExpression checks a {{ ... }} placeholder body for syntax errors, unknown node references, function arity mistakes, and unresolved identifiers. Returns nil for a valid expression.

Types

type ExpressionError

type ExpressionError struct {
	NodeID     string
	NodeName   string
	FieldPath  string
	Expression string
	Err        error
}

ExpressionError describes a single static validation failure for one expression inside a node's configuration.

func (*ExpressionError) Error

func (e *ExpressionError) Error() string

Jump to

Keyboard shortcuts

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