definition

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 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 Action

type Action struct {
	// Type is the action registry key (for example "stub" or "http").
	Type string `json:"type" yaml:"type"`
	// ID is a stable identifier for tracing.
	ID string `json:"id" yaml:"id"`
	// Params is the action-specific JSON object.
	Params RawJSON `json:"params,omitempty" yaml:"params,omitempty"`
}

type RawJSON

type RawJSON []byte

func (RawJSON) MarshalJSON

func (r RawJSON) MarshalJSON() ([]byte, error)

func (*RawJSON) UnmarshalJSON

func (r *RawJSON) UnmarshalJSON(data []byte) error

func (*RawJSON) UnmarshalYAML

func (r *RawJSON) UnmarshalYAML(n *yaml.Node) error

type Step

type Step struct {
	// ID is the unique step identifier within the workflow.
	ID string `json:"id" yaml:"id"`
	// Kind is human, action, or end.
	Kind StepKind `json:"kind" yaml:"kind"`
	// Description is optional documentation for operators.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Labels are optional searchable tags.
	Labels []string `json:"labels,omitempty" yaml:"labels,omitempty"`
	// Annotations are optional key/value metadata.
	Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	// PresentationRef is an optional UI hint for human steps.
	PresentationRef string `json:"presentationRef,omitempty" yaml:"presentationRef,omitempty"`
	// InputSchema is optional JSON Schema for human-step SubmitInput payloads.
	InputSchema RawJSON `json:"inputSchema,omitempty" yaml:"inputSchema,omitempty"`
	// OnEnter actions run when the step is entered.
	OnEnter []Action `json:"onEnter,omitempty" yaml:"onEnter,omitempty"`
	// OnExit actions run when leaving the step after a transition fires.
	OnExit []Action `json:"onExit,omitempty" yaml:"onExit,omitempty"`
}

type StepKind

type StepKind string
const (
	StepKindHuman  StepKind = "human"
	StepKindAction StepKind = "action"
	StepKindEnd    StepKind = "end"
)

func (*StepKind) UnmarshalJSON

func (k *StepKind) UnmarshalJSON(b []byte) error

func (*StepKind) UnmarshalYAML

func (k *StepKind) UnmarshalYAML(n *yaml.Node) error

type Transition

type Transition struct {
	// From is the source step id.
	From string `json:"from" yaml:"from"`
	// To is the destination step id.
	To string `json:"to" yaml:"to"`
	// When is an optional CEL guard; empty means true.
	When string `json:"when,omitempty" yaml:"when,omitempty"`
	// Priority orders guards ascending (lower runs first).
	Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
}

type WorkflowDefinition

type WorkflowDefinition struct {
	// SchemaVersion is the workflow schema version (for example "0.1").
	SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion"`
	// ID identifies the workflow across versions.
	ID string `json:"id" yaml:"id"`
	// Version is the workflow revision string stored on RunRecord.
	Version string `json:"version" yaml:"version"`
	// Title is optional display text.
	Title string `json:"title,omitempty" yaml:"title,omitempty"`
	// Description is optional documentation.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// InitialStepID is where new instances start.
	InitialStepID string `json:"initialStepId" yaml:"initialStepId"`
	// TerminalStepIDs lists end steps that may complete a run.
	TerminalStepIDs []string `json:"terminalStepIds" yaml:"terminalStepIds"`
	// Steps is the workflow graph nodes.
	Steps []Step `json:"steps" yaml:"steps"`
	// Transitions is the workflow graph edges.
	Transitions []Transition `json:"transitions" yaml:"transitions"`
}

func DecodeFile

func DecodeFile(path string) (*WorkflowDefinition, error)

DecodeFile reads a workflow definition from disk based on file extension.

JSON: DisallowUnknownFields and reject trailing JSON after the document. YAML: KnownFields(true) on the root mapping (unknown keys error).

func DecodeJSON

func DecodeJSON(data []byte) (*WorkflowDefinition, error)

DecodeJSON parses a single workflow document from JSON bytes (strict: unknown fields and trailing content rejected).

func DecodeYAML

func DecodeYAML(data []byte) (*WorkflowDefinition, error)

DecodeYAML parses a single workflow document from YAML bytes (strict: unknown fields rejected).

Jump to

Keyboard shortcuts

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