Skip to content

Instantly share code, notes, and snippets.

@kadrach
Forked from studds/aws-step-function.json
Created September 11, 2021 01:33
Show Gist options
  • Save kadrach/899119d276cf06660a49935028e3e38a to your computer and use it in GitHub Desktop.
Save kadrach/899119d276cf06660a49935028e3e38a to your computer and use it in GitHub Desktop.
JSON Schema for AWS Step Functions (derived from https://github.com/airware/asl-validator)
{
"$schema": "http://json-schema.org/draft-07/schema",
"definitions": {
"state-machine": {
"type": "object",
"properties": {
"Comment": {
"type": "string"
},
"StartAt": {
"type": "string"
},
"States": {
"type": "object",
"patternProperties": {
"^.{1,128}$": {
"$ref": "#/definitions/state"
}
},
"additionalProperties": false
},
"Version": {
"type": "string"
},
"TimeoutSeconds": {
"type": "integer",
"minimum": 0
}
},
"additionalProperties": false,
"required": ["StartAt", "States"]
},
"choice": {
"definitions": {
"Operator": {
"type": "object",
"properties": {
"Variable": {
"type": "string"
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"And": {
"type": "array",
"items": {
"$ref": "#/definitions/choice/definitions/Operator"
}
},
"Or": {
"type": "array",
"items": {
"$ref": "#/definitions/choice/definitions/Operator"
}
},
"Not": {
"$ref": "#/definitions/choice/definitions/Operator"
},
"BooleanEquals": {
"type": "boolean"
},
"NumericEquals": {
"type": "number"
},
"NumericGreaterThan": {
"type": "number"
},
"NumericGreaterThanEquals": {
"type": "number"
},
"NumericLessThan": {
"type": "number"
},
"NumericLessThanEquals": {
"type": "number"
},
"StringEquals": {
"type": "string"
},
"StringGreaterThan": {
"type": "string"
},
"StringGreaterThanEquals": {
"type": "string"
},
"StringLessThan": {
"type": "string"
},
"StringLessThanEquals": {
"type": "string"
},
"TimestampEquals": {
"type": "string"
},
"TimestampGreaterThan": {
"type": "string"
},
"TimestampGreaterThanEquals": {
"type": "string"
},
"TimestampLessThan": {
"type": "string"
},
"TimestampLessThanEquals": {
"type": "string"
}
},
"oneOf": [
{
"required": ["And"]
},
{
"required": ["BooleanEquals"]
},
{
"required": ["Not"]
},
{
"required": ["NumericEquals"]
},
{
"required": ["NumericGreaterThan"]
},
{
"required": ["NumericGreaterThanEquals"]
},
{
"required": ["NumericLessThan"]
},
{
"required": ["NumericLessThanEquals"]
},
{
"required": ["Or"]
},
{
"required": ["StringEquals"]
},
{
"required": ["StringGreaterThan"]
},
{
"required": ["StringGreaterThanEquals"]
},
{
"required": ["StringLessThan"]
},
{
"required": ["StringLessThanEquals"]
},
{
"required": ["TimestampEquals"]
},
{
"required": ["TimestampGreaterThan"]
},
{
"required": ["TimestampGreaterThanEquals"]
},
{
"required": ["TimestampLessThan"]
},
{
"required": ["TimestampLessThanEquals"]
}
]
}
},
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Choice"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"Choices": {
"type": "array",
"items": {
"$ref": "#/definitions/choice/definitions/Operator"
}
},
"Default": {
"type": "string"
}
},
"required": ["Type", "Choices"],
"additionalProperties": false
},
"fail": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Fail"]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"Cause": {
"type": "string"
},
"Error": {
"type": "string"
}
},
"required": ["Type"],
"additionalProperties": false
},
"map": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Map"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"ResultPath": {
"type": ["string", "null"]
},
"ItemsPath": {
"type": ["string", "null"]
},
"MaxConcurrency": {
"type": "number",
"minimum": 0
},
"Iterator": {
"$ref": "#/definitions/state-machine"
},
"Parameters": {
"type": "object"
},
"Retry": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"IntervalSeconds": {
"type": "number",
"minimum": 0
},
"MaxAttempts": {
"type": "number",
"minimum": 0
},
"BackoffRate": {
"type": "number",
"minimum": 0
}
},
"required": ["ErrorEquals"]
}
},
"Catch": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
}
},
"required": ["ErrorEquals", "Next"]
}
}
},
"oneOf": [
{
"required": ["Next"]
},
{
"required": ["End"]
}
],
"required": ["Type", "Iterator"],
"additionalProperties": false
},
"parallel": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Parallel"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"ResultPath": {
"type": ["string", "null"]
},
"Branches": {
"type": "array",
"items": {
"$ref": "#/definitions/state-machine"
}
},
"Retry": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"IntervalSeconds": {
"type": "number",
"minimum": 0
},
"MaxAttempts": {
"type": "number",
"minimum": 0
},
"BackoffRate": {
"type": "number",
"minimum": 0
}
},
"required": ["ErrorEquals"]
}
},
"Catch": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
}
},
"required": ["ErrorEquals", "Next"]
}
}
},
"oneOf": [
{
"required": ["Next"]
},
{
"required": ["End"]
}
],
"required": ["Type", "Branches"],
"additionalProperties": false
},
"pass": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Pass"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"ResultPath": {
"type": "string"
},
"Parameters": {
"type": "object"
},
"Result": {}
},
"oneOf": [
{
"required": ["Next"]
},
{
"required": ["End"]
}
],
"required": ["Type"],
"additionalProperties": false
},
"state": {
"type": "object",
"oneOf": [
{
"$ref": "#/definitions/choice"
},
{
"$ref": "#/definitions/fail"
},
{
"$ref": "#/definitions/parallel"
},
{
"$ref": "#/definitions/pass"
},
{
"$ref": "#/definitions/succeed"
},
{
"$ref": "#/definitions/task"
},
{
"$ref": "#/definitions/wait"
},
{
"$ref": "#/definitions/map"
}
]
},
"succeed": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Succeed"]
},
"Comment": {
"type": "string"
}
},
"required": ["Type"],
"additionalProperties": false
},
"task": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Task"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"Resource": {
"oneOf": [
{
"type": "string",
"pattern": "^arn:aws:([a-z]|-)+:([a-z]|[0-9]|-)*:[0-9]*:([a-z]|-)+:[a-zA-Z0-9-_.]+(:(\\$LATEST|[a-zA-Z0-9-_]+))?$"
},
{
"type": "object"
}
]
},
"ResultPath": {
"type": ["string", "null"]
},
"Retry": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"IntervalSeconds": {
"type": "number",
"minimum": 0
},
"MaxAttempts": {
"type": "number",
"minimum": 0
},
"BackoffRate": {
"type": "number",
"minimum": 0
}
},
"required": ["ErrorEquals"]
}
},
"Catch": {
"type": "array",
"items": {
"types": "object",
"properties": {
"ErrorEquals": {
"type": "array",
"items": {
"types": "string"
}
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
}
},
"required": ["ErrorEquals", "Next"]
}
},
"TimeoutSeconds": {
"type": "number",
"minimum": 1
},
"HeartbeatSeconds": {
"type": "number",
"minimum": 1
},
"Parameters": {
"type": "object"
}
},
"oneOf": [
{
"required": ["Next"]
},
{
"required": ["End"]
}
],
"required": ["Type", "Resource"],
"additionalProperties": false
},
"wait": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": ["Wait"]
},
"Next": {
"type": "string",
"pattern": "^.{1,128}$"
},
"End": {
"enum": [true]
},
"Comment": {
"type": "string"
},
"OutputPath": {
"type": ["string", "null"]
},
"InputPath": {
"type": ["string", "null"]
},
"Seconds": {
"type": "number",
"minimum": 0
},
"Timestamp": {
"type": "string"
},
"SecondsPath": {
"type": ["string", "null"]
},
"TimestampPath": {
"type": ["string", "null"]
}
},
"oneOf": [
{
"required": ["Next"]
},
{
"required": ["End"]
}
],
"required": ["Type"],
"additionalProperties": false
}
},
"$ref": "#/definitions/state-machine"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment