Documentation
¶
Index ¶
- Variables
- func ClearCriterionCaches()deprecated
- func EvaluateCriterion(criterion *high.Criterion, exprCtx *expression.Context) (bool, error)
- type ArazzoDocumentFactory
- type Engine
- type EngineConfig
- type ExecutionRequest
- type ExecutionResponse
- type Executor
- type OpenAPIDocumentFactory
- type ResolveConfig
- type ResolvedSource
- type RunResult
- type StepFailureError
- type StepResult
- type ValidationError
- type ValidationResult
- type Warning
- type WorkflowResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidArazzo = errors.New("invalid arazzo document") ErrMissingArazzoField = errors.New("missing required 'arazzo' field") ErrMissingInfo = errors.New("missing required 'info' field") ErrMissingSourceDescriptions = errors.New("missing required 'sourceDescriptions' field") ErrEmptySourceDescriptions = errors.New("sourceDescriptions must have at least one entry") ErrMissingWorkflows = errors.New("missing required 'workflows' field") ErrEmptyWorkflows = errors.New("workflows must have at least one entry") )
Document errors
var ( ErrMissingWorkflowId = errors.New("missing required 'workflowId'") ErrMissingSteps = errors.New("missing required 'steps'") ErrEmptySteps = errors.New("steps must have at least one entry") ErrDuplicateWorkflowId = errors.New("duplicate workflowId") )
Workflow errors
var ( ErrMissingStepId = errors.New("missing required 'stepId'") ErrDuplicateStepId = errors.New("duplicate stepId within workflow") ErrStepMutualExclusion = errors.New("step must have exactly one of operationId, operationPath, or workflowId") ErrExecutorNotConfigured = errors.New("executor is not configured") )
Step errors
var ( ErrMissingParameterName = errors.New("missing required 'name'") ErrMissingParameterIn = errors.New("missing required 'in' for operation parameter") ErrInvalidParameterIn = errors.New("'in' must be path, query, header, or cookie") ErrMissingParameterValue = errors.New("missing required 'value'") )
Parameter errors
var ( ErrMissingActionName = errors.New("missing required 'name'") ErrMissingActionType = errors.New("missing required 'type'") ErrInvalidSuccessType = errors.New("success action type must be 'end' or 'goto'") ErrInvalidFailureType = errors.New("failure action type must be 'end', 'retry', or 'goto'") ErrActionMutualExclusion = errors.New("action cannot have both workflowId and stepId") ErrGotoRequiresTarget = errors.New("goto action requires workflowId or stepId") ErrStepIdNotInWorkflow = errors.New("stepId must reference a step in the current workflow") )
Action errors
var ( ErrInvalidExpression = errors.New("invalid runtime expression") ErrUnknownExpressionPrefix = errors.New("unknown expression prefix") )
Expression errors
var ( ErrUnresolvedWorkflowRef = errors.New("workflowId references unknown workflow") ErrUnresolvedSourceDesc = errors.New("sourceDescription reference not found") ErrUnresolvedOperationRef = errors.New("operation reference not found") ErrOperationSourceMapping = errors.New("operation source mapping failed") ErrUnresolvedComponent = errors.New("component reference not found") ErrCircularDependency = errors.New("circular workflow dependency detected") )
Reference errors
var (
ErrMissingCondition = errors.New("missing required 'condition'")
)
Criterion errors
var (
ErrSourceDescLoadFailed = errors.New("failed to load source description")
)
Source description errors
Functions ¶
func ClearCriterionCaches
deprecated
func ClearCriterionCaches()
ClearCriterionCaches is a no-op retained for backward compatibility. Criterion caches are now scoped per-Engine instance and cleared via Engine.ClearCaches().
Deprecated: Use Engine.ClearCaches() instead.
func EvaluateCriterion ¶
EvaluateCriterion evaluates a single criterion against an expression context. This standalone function does not use caching. For cached evaluation, use an Engine.
Types ¶
type ArazzoDocumentFactory ¶
ArazzoDocumentFactory creates a parsed Arazzo document from raw bytes. The sourceURL provides location context for relative reference resolution.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates the execution of Arazzo workflows. An Engine is NOT safe for concurrent use from multiple goroutines.
func NewEngine ¶
func NewEngine(doc *high.Arazzo, executor Executor, sources []*ResolvedSource) *Engine
NewEngine creates a new Engine for executing Arazzo workflows.
func NewEngineWithConfig ¶
func NewEngineWithConfig(doc *high.Arazzo, executor Executor, sources []*ResolvedSource, config *EngineConfig) *Engine
NewEngineWithConfig creates a new Engine with custom configuration.
func (*Engine) ClearCaches ¶
func (e *Engine) ClearCaches()
ClearCaches resets all per-engine caches (expressions, regex, JSONPath).
func (*Engine) RunWorkflow ¶
func (e *Engine) RunWorkflow(ctx context.Context, workflowId string, inputs map[string]any) (*WorkflowResult, error)
RunWorkflow executes a single workflow by its ID.
type EngineConfig ¶
type EngineConfig struct {
RetainResponseBodies bool // If false, nil out response bodies after extracting outputs
}
EngineConfig configures engine behavior.
type ExecutionRequest ¶
type ExecutionRequest struct {
Source *ResolvedSource
OperationID string
OperationPath string
Method string
Parameters map[string]any
RequestBody any
ContentType string
}
ExecutionRequest represents a request to execute an API operation.
type ExecutionResponse ¶
type ExecutionResponse struct {
StatusCode int
Headers map[string][]string
Body any
URL string // Actual request URL (populated by Executor)
Method string // HTTP method used (populated by Executor)
}
ExecutionResponse represents the response from an API operation execution.
type Executor ¶
type Executor interface {
Execute(ctx context.Context, req *ExecutionRequest) (*ExecutionResponse, error)
}
Executor defines the interface for executing API calls.
type OpenAPIDocumentFactory ¶
OpenAPIDocumentFactory creates a parsed OpenAPI document from raw bytes. The sourceURL provides location context for relative reference resolution.
type ResolveConfig ¶
type ResolveConfig struct {
OpenAPIFactory OpenAPIDocumentFactory // Creates *v3high.Document from bytes
ArazzoFactory ArazzoDocumentFactory // Creates *high.Arazzo from bytes
BaseURL string
HTTPHandler func(url string) ([]byte, error)
HTTPClient *http.Client
FSRoots []string
Timeout time.Duration // Per-source fetch timeout (default: 30s)
MaxBodySize int64 // Max response body in bytes (default: 10MB)
AllowedSchemes []string // URL scheme allowlist (default: ["https", "http", "file"])
AllowedHosts []string // Host allowlist (nil = allow all)
MaxSources int // Max source descriptions to resolve (default: 50)
}
ResolveConfig configures how source descriptions are resolved.
type ResolvedSource ¶
type ResolvedSource struct {
Name string // SourceDescription name
URL string // Resolved URL
Type string // "openapi" or "arazzo"
OpenAPIDocument *v3high.Document // Non-nil when Type == "openapi"
ArazzoDocument *high.Arazzo // Non-nil when Type == "arazzo"
}
ResolvedSource represents a successfully resolved source description.
func ResolveSources ¶
func ResolveSources(doc *high.Arazzo, config *ResolveConfig) ([]*ResolvedSource, error)
ResolveSources resolves all source descriptions in an Arazzo document.
type RunResult ¶
type RunResult struct {
Workflows []*WorkflowResult
Success bool
Duration time.Duration
}
RunResult represents the result of executing all workflows.
type StepFailureError ¶
type StepFailureError struct {
StepId string
CriterionIndex int // -1 if not criterion-related
Message string
Cause error
}
StepFailureError represents a step execution failure with structured context.
func (*StepFailureError) Error ¶
func (e *StepFailureError) Error() string
func (*StepFailureError) Unwrap ¶
func (e *StepFailureError) Unwrap() error
type StepResult ¶
type StepResult struct {
StepId string
Success bool
StatusCode int
Outputs map[string]any
Error error
Duration time.Duration
Retries int
}
StepResult represents the result of executing a single step.
type ValidationError ¶
type ValidationError struct {
Path string // e.g. "workflows[0].steps[2].parameters[1]"
Line int
Column int
Cause error
}
ValidationError represents a structured validation error with source location.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
type ValidationResult ¶
type ValidationResult struct {
Errors []*ValidationError
Warnings []*Warning
}
ValidationResult holds all validation errors and warnings.
func Validate ¶
func Validate(doc *high.Arazzo) *ValidationResult
Validate performs structural validation of an Arazzo document. Returns nil if the document is valid; callers should nil-check the result before accessing Errors or Warnings.
func (*ValidationResult) Error ¶
func (r *ValidationResult) Error() string
Error implements the error interface, returning all errors as a combined string.
func (*ValidationResult) HasErrors ¶
func (r *ValidationResult) HasErrors() bool
HasErrors returns true if there are any validation errors.
func (*ValidationResult) HasWarnings ¶
func (r *ValidationResult) HasWarnings() bool
HasWarnings returns true if there are any validation warnings.
func (*ValidationResult) Unwrap ¶
func (r *ValidationResult) Unwrap() []error
Unwrap returns the individual validation errors for use with errors.Is/As (Go 1.20+).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package expression implements the Arazzo runtime expression parser and evaluator.
|
Package expression implements the Arazzo runtime expression parser and evaluator. |