validation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionLookup

type ActionLookup interface {
	Has(name string) bool
}

ActionLookup checks whether a named action is registered. Satisfied by *actions.Registry (which has Has(string) bool).

type JSONSchemaValidator

type JSONSchemaValidator struct {
	// contains filtered or unexported fields
}

JSONSchemaValidator implements the Validator interface using JSON Schema Draft 2020-12. It is safe for concurrent use.

func NewJSONSchemaValidator

func NewJSONSchemaValidator() (*JSONSchemaValidator, error)

NewJSONSchemaValidator creates a new JSONSchemaValidator with the workflow schema pre-compiled.

func (*JSONSchemaValidator) ValidateDefinition

func (v *JSONSchemaValidator) ValidateDefinition(def *schema.WorkflowDefinition) error

ValidateDefinition validates a WorkflowDefinition against the workflow JSON Schema.

func (*JSONSchemaValidator) ValidateInput

func (v *JSONSchemaValidator) ValidateInput(input map[string]any, inputSchema []byte) error

ValidateInput validates input data against a JSON Schema provided as raw bytes. The schema is compiled and cached for subsequent calls with the same schema.

type Validator

type Validator interface {
	ValidateDefinition(def *schema.WorkflowDefinition) error
	ValidateInput(input map[string]any, inputSchema []byte) error
}

Validator checks workflow definitions for correctness before execution. Uses JSON Schema Draft 2020-12 for input/output validation.

type WorkflowValidator

type WorkflowValidator struct {
	// contains filtered or unexported fields
}

WorkflowValidator orchestrates the three-stage validation pipeline: 1. Structural (JSON Schema) 2. Semantic (action refs, step refs, nested sub-steps) 3. DAG (cycles, reachability)

func NewWorkflowValidator

func NewWorkflowValidator(lookup ActionLookup) (*WorkflowValidator, error)

NewWorkflowValidator creates a WorkflowValidator. lookup may be nil to skip action existence checks.

func (*WorkflowValidator) Validate

Validate runs the full 3-stage pipeline and returns an aggregated result. Structural errors short-circuit: semantic and DAG stages are skipped.

func (*WorkflowValidator) ValidateDefinition

func (wv *WorkflowValidator) ValidateDefinition(def *schema.WorkflowDefinition) error

ValidateDefinition satisfies the Validator interface.

func (*WorkflowValidator) ValidateInput

func (wv *WorkflowValidator) ValidateInput(input map[string]any, inputSchema []byte) error

ValidateInput delegates to the underlying JSONSchemaValidator.

Jump to

Keyboard shortcuts

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