Documentation
¶
Overview ¶
Package arazzo parses and executes Arazzo workflow documents (OpenAPI Initiative).
Index ¶
- type Components
- type Criterion
- type Doc
- type Info
- type Parameter
- type RuntimeContext
- func (c *RuntimeContext) EvalCriterion(crit Criterion) (bool, error)
- func (c *RuntimeContext) EvalSimpleCondition(condition string) (bool, error)
- func (c *RuntimeContext) EvalSuccessCriteria(criteria []Criterion) (bool, error)
- func (c *RuntimeContext) Resolve(value any) (any, error)
- func (c *RuntimeContext) ResolveString(value any) (string, error)
- type SourceDescription
- type Step
- type StepOutputs
- type StepResponse
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct {
Inputs map[string]any `yaml:"inputs,omitempty" json:"inputs,omitempty"`
Parameters map[string]any `yaml:"parameters,omitempty" json:"parameters,omitempty"`
SuccessActions map[string]any `yaml:"successActions,omitempty" json:"successActions,omitempty"`
FailureActions map[string]any `yaml:"failureActions,omitempty" json:"failureActions,omitempty"`
}
Components holds reusable objects.
type Criterion ¶
type Criterion struct {
Context string `yaml:"context,omitempty" json:"context,omitempty"` // runtime expression for context
Condition string `yaml:"condition" json:"condition"`
Type string `yaml:"type,omitempty" json:"type,omitempty"` // "simple", "regex", "jsonpath", "xpath"
}
Criterion is a success/failure assertion (simple, regex, jsonpath).
type Doc ¶
type Doc struct {
Arazzo string `yaml:"arazzo" json:"arazzo"`
Info Info `yaml:"info" json:"info"`
SourceDescriptions []SourceDescription `yaml:"sourceDescriptions" json:"sourceDescriptions"`
Workflows []Workflow `yaml:"workflows" json:"workflows"`
Components *Components `yaml:"components,omitempty" json:"components,omitempty"`
}
Doc is the root Arazzo Description (spec 1.0.x).
type Info ¶
type Info struct {
Title string `yaml:"title" json:"title"`
Summary string `yaml:"summary,omitempty" json:"summary,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Version string `yaml:"version" json:"version"`
}
Info is metadata about the Arazzo document.
type Parameter ¶
type Parameter struct {
Name string `yaml:"name" json:"name"`
In string `yaml:"in,omitempty" json:"in,omitempty"`
Value any `yaml:"value" json:"value"` // literal or expression string
}
Parameter is a step parameter (query, header, path, cookie).
type RuntimeContext ¶
type RuntimeContext struct {
Inputs map[string]any // workflow inputs
Steps map[string]StepOutputs // stepId -> outputs
Response *StepResponse // current step response (statusCode, header, body)
SourceDescriptions map[string]any // name -> e.g. { url: "..." }
}
RuntimeContext holds values available during workflow execution ($inputs, $steps, $response, $sourceDescriptions).
func (*RuntimeContext) EvalCriterion ¶
func (c *RuntimeContext) EvalCriterion(crit Criterion) (bool, error)
EvalCriterion evaluates a single criterion (simple, regex, or jsonpath) and returns true if it passes.
func (*RuntimeContext) EvalSimpleCondition ¶
func (c *RuntimeContext) EvalSimpleCondition(condition string) (bool, error)
EvalSimpleCondition evaluates a simple condition like "$statusCode == 200". String comparison is case-insensitive per spec.
func (*RuntimeContext) EvalSuccessCriteria ¶
func (c *RuntimeContext) EvalSuccessCriteria(criteria []Criterion) (bool, error)
EvalSuccessCriteria evaluates all successCriteria; all must pass.
func (*RuntimeContext) Resolve ¶
func (c *RuntimeContext) Resolve(value any) (any, error)
Resolve evaluates an expression (e.g. $inputs.username, $response.body) and returns the value. If value is not a string starting with $, it is returned as-is.
func (*RuntimeContext) ResolveString ¶
func (c *RuntimeContext) ResolveString(value any) (string, error)
ResolveString returns a string value for the expression (for headers, query params).
type SourceDescription ¶
type SourceDescription struct {
Name string `yaml:"name" json:"name"`
URL string `yaml:"url" json:"url"`
Type string `yaml:"type,omitempty" json:"type,omitempty"` // "openapi" or "arazzo"
}
SourceDescription references an OpenAPI or Arazzo document.
type Step ¶
type Step struct {
StepID string `yaml:"stepId" json:"stepId"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
OperationID string `yaml:"operationId,omitempty" json:"operationId,omitempty"`
OperationPath string `yaml:"operationPath,omitempty" json:"operationPath,omitempty"`
WorkflowID string `yaml:"workflowId,omitempty" json:"workflowId,omitempty"`
Parameters []Parameter `yaml:"parameters,omitempty" json:"parameters,omitempty"`
RequestBody any `yaml:"requestBody,omitempty" json:"requestBody,omitempty"`
SuccessCriteria []Criterion `yaml:"successCriteria,omitempty" json:"successCriteria,omitempty"`
OnSuccess []any `yaml:"onSuccess,omitempty" json:"onSuccess,omitempty"`
OnFailure []any `yaml:"onFailure,omitempty" json:"onFailure,omitempty"`
Outputs map[string]any `yaml:"outputs,omitempty" json:"outputs,omitempty"` // map[name]expression
}
Step is a single workflow step (operation or sub-workflow).
type StepResponse ¶
StepResponse is the HTTP response for the current step.
type Workflow ¶
type Workflow struct {
WorkflowID string `yaml:"workflowId" json:"workflowId"`
Summary string `yaml:"summary,omitempty" json:"summary,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Inputs any `yaml:"inputs,omitempty" json:"inputs,omitempty"` // JSON Schema
DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"`
Steps []Step `yaml:"steps" json:"steps"`
Outputs map[string]any `yaml:"outputs,omitempty" json:"outputs,omitempty"` // map[name]expression
Parameters []Parameter `yaml:"parameters,omitempty" json:"parameters,omitempty"`
SuccessActions []any `yaml:"successActions,omitempty" json:"successActions,omitempty"`
FailureActions []any `yaml:"failureActions,omitempty" json:"failureActions,omitempty"`
}
Workflow defines a sequence of steps.