项目作者: enginyoyen

项目描述 :
Amazon States Language parser&validator in go-language
高级语言: Go
项目地址: git://github.com/enginyoyen/aslparser.git
创建时间: 2020-04-20T20:25:46Z
项目社区:https://github.com/enginyoyen/aslparser

开源协议:Other

下载


Amazon States Language Parser

Package aslparser validates and parses the Amazon States Language, that is used for step functions.
See https://states-language.net/spec.html for details.

Build Status

Installation

  1. go get github.com/enginyoyen/aslparser

Usage

First argument is the file content to be validated, while the second argument is whether it should use strict mode for validation

  1. stateMachine, err := aslparser.Parse(filePath, true)
  2. if !stateMachine.Valid() {
  3. for _, e := range stateMachine.Errors(){
  4. fmt.Print(e.Description())
  5. }
  6. }

Alternatively, ParseFile method uses file path to load and validate

  1. stateMachine, err := aslparser.ParseFile(filePath, true)
  2. if !stateMachine.Valid() {
  3. for _, e := range stateMachine.Errors(){
  4. fmt.Print(e.Description())
  5. }
  6. }

Converting JSON Schema to a static file

JSON schema is converted to an static go file to be included as an executable.

  1. go-bindata -o state_machine_bin.go schemas/state-machine.json schemas/state-machine-strict-arn.json

JSON Schema

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

TODO

  • Validate json-path in InputPath, OutputPath and ResultPath
  • Extend StateMachine to include complete spec

Licence

Use of this source code is governed by an MIT license that can be found in the LICENSE file.