UseArazzo Validator

Every violation against the Arazzo specification, with the location that caused it.

An Arazzo document can parse cleanly and still be wrong: two steps sharing an ID, a goto to a step that does not exist, a runtime expression that does not parse. @usearazzo/validator finds those problems before a run does, and reports each one with its line, its severity, and the rule it broke.

Supported versions:

  • ✓ Arazzo 1.0.0, 1.0.1, 1.1.0

From the Terminal

The UseArazzo CLI puts the Validator behind a single command, for your terminal and your CI pipeline. The first document has two steps with the same ID, an error. The second has a step without a description, a warning.

usearazzo validate
$ npx @usearazzo/cli validate adopt-a-pet.arazzo.yaml
adopt-a-pet.arazzo.yaml
  16:9-18:38  error  9040403  Every step must have a unique 'stepId' within a workflow.
  19:9-22:1   error  9040403  Every step must have a unique 'stepId' within a workflow.

✖ 2 problems (2 errors)$ npx @usearazzo/cli validate onboarding.arazzo.yaml
onboarding.arazzo.yaml
  16:9-18:1  warning  9050201  Step 'description' should be present and non-empty string.

⚠ 1 problem (1 warning)

From Your Code

The Validator is a library first. The command above is a thin wrapper around one function, validateURI, and your code can call it directly. Point it at a file or a URL and it returns every problem as a diagnostic. Here it reads the first document from the terminal:

import { validateURI, DiagnosticSeverity } from '@usearazzo/validator';

const diagnostics = await validateURI('./adopt-a-pet.arazzo.yaml');
const errors = diagnostics.filter((d) => d.severity === DiagnosticSeverity.Error);

console.log(`${errors.length} errors`);
console.log(diagnostics[0]);
2 errors
{
  range: {
    start: { line: 15, character: 8 },
    end: { line: 17, character: 37 }
  },
  message: "Every step must have a unique 'stepId' within a workflow.",
  severity: 1,
  code: 9040403,
  source: 'apilint',
  data: {}
}

The same two errors the terminal printed, as data. Positions count from zero here, and the terminal prints them from one.

  • A document with problems is not an exception. The call resolves with its diagnostics, and an empty array means nothing was found.
  • Content already in memory. validate takes the text itself, for an editor buffer or a document you built.
  • Options. Turn JSON Schema validation on, or keep the Validator from reading anything beyond the document.

Every function, option, and rule is in the API reference.

What It Checks

Every Arazzo object

Required fields, field types, and allowed values on every object, from the document root to criteria and actions. IDs must be unique, and the steps and workflows a document points at must exist in it. Runtime expressions must parse.

The version you wrote

Each document is checked against the Arazzo version in its own arazzo field. A dependsOn on a step passes in 1.1.0 and is reported in 1.0.1.

Diagnostics your tools understand

Every problem is a Language Server Protocol diagnostic: a range, a severity, a stable numeric code, and a message. Editors underline it, CI counts it, and your code can match on it.

Ready for untrusted documents

Only local JSON and YAML files are read. For a document you did not write, one option turns off everything beyond the document itself; another confines reads to a single directory.

The API reference lists every rule, with its code, severity, and message.

Installation

npm install @usearazzo/validator

That is the library. For the command line, install the UseArazzo CLI instead, or run it with npx @usearazzo/cli validate.

Rest of the Toolkit

Runner

Executes the workflows you validate here, interpreting the same Arazzo semantics.

Explore Runner

CLI

Puts this library behind a command, so validation runs from a terminal or a CI pipeline instead of your own code.

Explore CLI

Under the hood, the Validator uses @usearazzo/parser to fetch the documents it checks.

Frequently Asked Questions

Yes. Run npm install @usearazzo/validator. It is published as an alpha, so the API may still change before the stable release.

Yes. Run npx @usearazzo/cli validate adopt-a-pet.arazzo.yaml. The UseArazzo CLI wraps the Validator, prints every problem with its location, and exits with 1 when there is an error, so it works in CI too. The CLI reference lists every option.

Call validateURI from @usearazzo/validator with a path or a URL. It resolves with an array of diagnostics, and an empty array means nothing was found. A document with problems is not an exception. For content already in memory, validate takes the text itself. Both are covered in the API reference.

The Validator is the library that does the checking. The UseArazzo CLI is a command that calls it and prints the result. The rules and the diagnostics are the same. Use the library inside your own code, such as an editor plugin, a service, or a test. Use the CLI in a terminal or a CI pipeline.

Yes. Every problem is a Language Server Protocol diagnostic with a range, a severity, a code, and a message, the shape editors already render. validate takes a TextDocument, so it fits a language server that already holds the open buffer.

Yes. @usearazzo/validator is free, open-source, and licensed under Apache 2.0.

Every Arazzo object against the specification: required fields, types, unique IDs, steps and workflows that must exist in the document, and runtime expression syntax. It also checks that local $ref pointers in JSON Schemas resolve. JSON Schema validation is available on top, opt-in. The API reference lists every rule.

Arazzo 1.0.0, 1.0.1, and 1.1.0.

By default it reads only local .json, .yaml, and .yml files, and fetches the source descriptions a document names. For untrusted input, set fileAllowList: [] and sourceDescriptionsResolution: false, or confine reads to one directory.