flows

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractIngredients

func ExtractIngredients(payload types.KV, item any, ingredients []Ingredient) (types.KV, error)

ExtractIngredients extracts ingredient values from payload.

func ValidateParams

func ValidateParams(params types.KV, specs []ParamSpec) error

Types

type Ingredient

type Ingredient struct {
	Name        string `json:"name" yaml:"name"`
	Path        string `json:"path" yaml:"path"`
	Required    bool   `json:"required,omitempty" yaml:"required,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

Ingredient defines how to extract a variable from an event payload.

Path is a gjson path evaluated against a JSON object. For convenience, the extractor evaluates the path against a root object with these keys: - payload: the full payload - item: an optional object (for polling per-item extraction)

Example Path: "payload.data.id" or "item.status".

type ParamSpec

type ParamSpec struct {
	Name        string    `json:"name" yaml:"name"`
	Type        ParamType `json:"type" yaml:"type"`
	Required    bool      `json:"required,omitempty" yaml:"required,omitempty"`
	Description string    `json:"description,omitempty" yaml:"description,omitempty"`

	Enum    []string `json:"enum,omitempty" yaml:"enum,omitempty"`
	Pattern string   `json:"pattern,omitempty" yaml:"pattern,omitempty"`
}

ParamSpec defines an input parameter for an action. It is intentionally minimal but practical.

type ParamType

type ParamType string
const (
	ParamTypeString ParamType = "string"
	ParamTypeNumber ParamType = "number"
	ParamTypeBool   ParamType = "bool"
	ParamTypeObject ParamType = "object"
	ParamTypeArray  ParamType = "array"
)

type ValidationError

type ValidationError struct {
	Fields map[string]string
}

ValidationError is returned when params do not match a ParamSpec set.

func IsValidationError

func IsValidationError(err error) (*ValidationError, bool)

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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