3.8.2 • Published 5 months ago

asl-validator v3.8.2

Weekly downloads
61,481
License
Apache-2.0
Repository
github
Last release
5 months ago

asl-validator

license npm version

NPM

A simple Amazon States Language validator based on JSON schemas. It also validates JSON paths syntax in InputPath, OutputPath and ResultPath.

When writing your state machine (for AWS step functions), you can't locally validate you state machine definition without creating it. asl-validator makes it possible.

Install

# Use via the CLI
npm install -g asl-validator
# Use in your code
npm install asl-validator

CLI

$ asl-validator --help
Usage: asl-validator [options]

Amazon States Language validator

Options:
  -V, --version                       output the version number
  --json-definition <jsonDefinition>  JSON definition (default: [])
  --json-path <jsonPath>              JSON path (default: [])
  --yaml-definition <yamlDefinition>  YAML definition (default: [])
  --yaml-path <yamlPath>              YAML path (default: [])
  --silent                            silent mode
  --no-path-check                     skips checking path expressions
  --no-arn-check                      skips the arn check for Resource values
  -h, --help                          display help for command

You can validate multiple state machines at once by passing multiple --json-definition, --json-path, --yaml-definition and --yaml-path arguments.

Return status:

  • 0 if state machine definitions are valid
  • 1 if at least one state machine definition is invalid
  • 2 if an exception occurs

In your code

const aslValidator = require("asl-validator");
const definition = require("./path/to/my/state/machine/json/definition");
const { isValid, errors, errorsText } = aslValidator(definition);
if (isValid) {
  console.log("✓ State machine definition is valid");
} else {
  // Either go through the errors object
  console.error(
    "✕ State machine definition is invalid:",
    errors.map(({ message }) => message).join("\n")
  );
  // Or display the preformatted errors text
  console.error("✕ State machine definition is invalid:", errorsText("\n"));
}

Test

npm run test

Lint

npm run lint

See also

License

See LICENSE.

3.8.2

5 months ago

3.8.1

7 months ago

3.8.0

10 months ago

3.6.2

10 months ago

3.7.0

10 months ago

3.6.1

11 months ago

3.6.0

11 months ago

3.4.0

1 year ago

3.2.0

1 year ago

3.3.0

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.8

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.2.2

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.10.0

3 years ago

1.9.8

3 years ago

1.9.7

3 years ago

1.9.6

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago