Amazon States Language parser&validator in go-language
Package aslparser
validates and parses the Amazon States Language, that is used for step functions.
See https://states-language.net/spec.html for details.
go get github.com/enginyoyen/aslparser
First argument is the file content to be validated, while the second argument is whether it should use strict mode for validation
stateMachine, err := aslparser.Parse(filePath, true)
if !stateMachine.Valid() {
for _, e := range stateMachine.Errors(){
fmt.Print(e.Description())
}
}
Alternatively, ParseFile
method uses file path to load and validate
stateMachine, err := aslparser.ParseFile(filePath, true)
if !stateMachine.Valid() {
for _, e := range stateMachine.Errors(){
fmt.Print(e.Description())
}
}
JSON schema is converted to an static go file to be included as an executable.
go-bindata -o state_machine_bin.go schemas/state-machine.json schemas/state-machine-strict-arn.json
JSON Schema file modified and original JSON schemas based on asl-validator by AirWare (https://www.airware.com/).
Additionally, test input file are also copied from the repo.
See schema files
See test files
StateMachine
to include complete specUse of this source code is governed by an MIT license that can be found in the LICENSE file.