expressionvalidation

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpressionUsesOrderArtifacts

func ExpressionUsesOrderArtifacts(expression string) (bool, error)

ExpressionUsesOrderArtifacts reports whether the expression accesses order().artifacts or task().artifacts (dot or bracket), including nested uses like none(order().artifacts, …). Used to lazy-load artifacts only when needed.

func ExpressionUsesOrderAssignees

func ExpressionUsesOrderAssignees(expression string) (bool, error)

func ExpressionUsesOrderComments

func ExpressionUsesOrderComments(expression string) (bool, error)

ExpressionUsesOrderComments reports whether the expression accesses order().comments or task().comments (dot or bracket), including nested uses like len(order().comments). Used to lazy-load comments only when needed.

func ExpressionUsesOrderKey

func ExpressionUsesOrderKey(expression string) (bool, error)

ExpressionUsesOrderKey reports whether the expression accesses order().key or task().key (dot or bracket). Used to resolve the work order display key (e.g. "SUPER-70") only when needed, since it costs an extra lookup of the factory that owns the order.

func ExpressionUsesOrderPullRequests

func ExpressionUsesOrderPullRequests(expression string) (bool, error)

func ExpressionUsesOrderSpec

func ExpressionUsesOrderSpec(expression string) (bool, error)

ExpressionUsesOrderSpec reports whether the expression accesses order().spec or task().spec (dot or bracket). Used to load the refinement spec only when the implement prompt asks for it.

func ExpressionUsesOrderURL

func ExpressionUsesOrderURL(expression string) (bool, error)

ExpressionUsesOrderURL reports whether the expression accesses order().url or task().url (dot or bracket). Used to resolve the work order permalink only when needed, since it costs an extra lookup of the factory that owns the order.

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 []models.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.

func ValidateExpressionWithExtraEnv added in v0.23.0

func ValidateExpressionWithExtraEnv(raw string, knownNodeNames map[string]struct{}, extraEnv map[string]any) error

ValidateExpressionWithExtraEnv validates an expression body using the default stub environment plus additional top-level variables provided in extraEnv.

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