ajv-cli
$ ajv Official Low Riskajv-cli (ajv) is the official Node.js command-line interface for the Ajv validator. It validates JSON, JSON5, YAML, and CJSON documents against JSON Schema or JTD (--spec=jtd), resolves $ref schemas (-r), and compiles standalone validators (ajv compile).
npm install -g ajv-cli Validates JSON/YAML payloads deterministically against Draft-07/2020-12 or JTD schemas locally via ajv validate.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Non-interactive with clear 0/1 exit codes, --all-errors reporting, and glob support, though validation errors print to stderr.
- Deterministic exit codes and
--all-errors - Node.js CLI with
--specselection
validate and test are strictly read-only; only compile -o or migrate -o write local files.
- Read-only validation by default
Easy npm / npx installation everywhere Node.js is available, though not distributed as a native Homebrew bottle or standalone binary.
- Requires Node.js (
npm install -g ajv-cliornpx)
Supports Draft-07, Draft-2019-09, Draft-2020-12, JTD, JSON5, YAML, and $ref resolution in one fast validator.
- Supports multiple JSON Schema drafts, JTD, YAML, and JSON5
Official ajv-validator/ajv-cli project under MIT license.
- Official
ajv-validator/ajv-clirepo
Clear README and ajv.js.org package docs covering --spec, -r, and -c plugin options.
- Official docs at ajv.js.org/packages/ajv-cli.html
Security, Auth & Guardrails
None; validates local schema and data files.
MIT open-source npm CLI; completely free.
# ajv-cli Agent Rules - Specify `--spec=draft2020` (or `draft2019` / `jtd`) explicitly when schemas are not Draft-07. - Pass `-c ajv-formats` when schemas validate `date-time`, `email`, or `uri` formats.
Agent-Ready Command Recipes
Safe Read-Only Queries
ajv validate -s schema.json -d data.json --all-errors
Validates data.json against schema.json and reports all schema violations with exit code 1 on failure.
ajv validate --spec=draft2020 -s main.schema.json -r "defs/*.json" -d "data/*.json"
Resolves external $ref schema files and validates matching data files via globs.
Controlled Writes & Previews
ajv compile -s schema.json -o validate.js
Generates a standalone JavaScript validation function file at validate.js.
Strengths for Agents
- + Fast validation across JSON, JSON5, and YAML with glob support (
-d "data/*.json"). - + Supports Draft-07, Draft-2019-09, Draft-2020-12, and JTD (
--spec=jtd). - + Standalone
ajv compilegenerates zero-dependency JS validators.
Caveats & Pitfalls
- ! Defaults to Draft-07; Draft-2020-12 schemas fail unless
--spec=draft2020is passed. - ! Standard
formatkeywords (likeemailoruri) require installing and loadingajv-formatsvia-c ajv-formats.