Title here
Summary here
AWF validates workflow inputs at runtime against defined rules.
inputs:
- name: input_name
type: string # string, integer, boolean
required: true # must be provided
default: "value" # default if not provided
validation: # validation rules
pattern: "^[a-z]+$"| Type | Description | Example Values |
|---|---|---|
string | Text value | "hello", "path/to/file" |
integer | Whole number | 42, 100, -5 |
boolean | True/false | true, false |
Validate string matches a regular expression:
inputs:
- name: email
type: string
required: true
validation:
pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
- name: version
type: string
validation:
pattern: "^v?[0-9]+\\.[0-9]+\\.[0-9]+$"Restrict to a set of allowed values:
inputs:
- name: env
type: string
default: staging
validation:
enum: [dev, staging, prod]
- name: log_level
type: string
default: info
validation:
enum: [debug, info, warn, error]Validate integer falls within range:
inputs:
- name: count
type: integer
default: 10
validation:
min: 1
max: 100
- name: port
type: integer
default: 8080
validation:
min: 1024
max: 65535Validate file exists on filesystem:
inputs:
- name: config_file
type: string
required: true
validation:
file_exists: trueValidate file has allowed extension:
inputs:
- name: source_file
type: string
required: true
validation:
file_extension: [".go", ".py", ".js", ".ts"]
- name: config
type: string
validation:
file_exists: true
file_extension: [".yaml", ".yml", ".json"]Multiple validation rules can be combined:
inputs:
- name: source_file
type: string
required: true
validation:
file_exists: true
file_extension: [".go", ".py"]
- name: threads
type: integer
default: 4
validation:
min: 1
max: 32Validation errors are collected and reported together:
awf run deploy --input email=invalid --input count=999input validation failed: 2 errors:
- inputs.email: does not match pattern ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
- inputs.count: value 999 exceeds maximum 100Validation failures return exit code 1 (User Error).
Use --format json for structured errors:
awf run deploy --input email=invalid -f json{
"success": false,
"error": {
"code": 1,
"type": "validation_error",
"message": "input validation failed",
"details": {
"errors": [
{
"input": "email",
"rule": "pattern",
"message": "does not match pattern"
}
]
}
}
}name: deploy
version: "1.0.0"
inputs:
- name: env
type: string
required: true
validation:
enum: [dev, staging, prod]
- name: version
type: string
required: true
validation:
pattern: "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
- name: config_file
type: string
required: true
validation:
file_exists: true
file_extension: [".yaml", ".yml"]
- name: replicas
type: integer
default: 2
validation:
min: 1
max: 10
- name: dry_run
type: boolean
default: false
states:
initial: validate
validate:
type: step
command: |
echo "Deploying {{.inputs.version}} to {{.inputs.env}}"
echo "Config: {{.inputs.config_file}}"
echo "Replicas: {{.inputs.replicas}}"
echo "Dry run: {{.inputs.dry_run}}"
on_success: done
done:
type: terminal# Valid
awf run deploy \
--input env=prod \
--input version=v1.2.3 \
--input config_file=deploy.yaml \
--input replicas=3
# Invalid - multiple errors
awf run deploy \
--input env=invalid \
--input version=1.2.3 \
--input replicas=99| Stage | What’s Validated |
|---|---|
| Load time | YAML syntax, state references, template references, transition requirements |
| Runtime | Input values against validation rules |
awf validate | All load-time checks without execution |
Load-time validation enforces structural rules on workflow states:
| Rule | Applies To | Description |
|---|---|---|
| Transition required | Command steps | on_success/on_failure or transitions must be defined |
| Transition exempt | Parallel branch children | Steps listed in a parallel step’s parallel field do not require transitions (the parallel executor controls flow) |
| Transition exempt | Loop body steps | Steps listed in a loop’s body field have relaxed transition target validation |
| Branches required | Parallel steps | parallel field must list at least one branch step |
| Valid strategy | Parallel steps | strategy must be all_succeed, any_succeed, best_effort, or empty |
See Workflow Syntax for parallel step details.
file_exists for file paths