Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enginyoyen/aslparser
Amazon States Language parser&validator in go-language
https://github.com/enginyoyen/aslparser
amazon-states-language state-machine
Last synced: 2 days ago
JSON representation
Amazon States Language parser&validator in go-language
- Host: GitHub
- URL: https://github.com/enginyoyen/aslparser
- Owner: enginyoyen
- License: other
- Created: 2020-04-20T20:25:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-10T15:31:42.000Z (over 4 years ago)
- Last Synced: 2024-06-20T19:15:13.318Z (7 months ago)
- Topics: amazon-states-language, state-machine
- Language: Go
- Size: 30.3 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://states-language.net/spec.html) for details.[![Build Status](https://travis-ci.com/enginyoyen/aslparser.svg?branch=master)](https://travis-ci.com/enginyoyen/aslparser)
## Installation
```
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
```
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())
}
}
```## Converting JSON Schema to a static file
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
JSON Schema file modified and original JSON schemas based on [asl-validator](https://github.com/airware/asl-validator) by AirWare (https://www.airware.com/).
Additionally, test input file are also copied from the repo.
See [schema files](https://github.com/airware/asl-validator/tree/master/src/schemas)
See [test files](https://github.com/airware/asl-validator/tree/master/src/__tests__/definitions)## 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.