ajv-cmd provides a robust command-line interface (CLI) for performing essential operations on JSON Schema files, leveraging the powerful AJV (Another JSON Schema Validator) library. It enables users to dereference, validate, transpile, and test JSON Schema definitions directly from the terminal, streamlining schema management and integration into build processes. The current stable version is 0.12.0. While no explicit release cadence is stated, its `0.x.x` versioning coupled with recent GitHub activity suggests active development and potentially rapid iterations. A key differentiator is its modern approach, requiring Node.js 24+, and its commitment to supply chain security standards like SLSA 3 and OpenSSF Scorecard, building upon the foundation of `ajv-cli` with a focus on contemporary JavaScript environments and best practices. It's primarily designed for developers who need to automate schema validation and compilation within CI/CD pipelines or local development workflows, providing a convenient wrapper around AJV's extensive capabilities.
npm install ajv-cmdVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `ajv-cmd` and use its `validate` and `transpile` commands within a bash script to process multiple JSON Schema files. It shows common `ajv` options for strict validation and transpilation.
Upgrade your Node.js environment to version 24 or newer. Consider using a Node Version Manager (NVM) to manage multiple Node.js installations.
Pin your `ajv-cmd` dependency to a specific minor version (e.g., `"ajv-cmd": "~0.12.0"`) or explicitly test upgrades across minor versions.
Prefer using `ajv-cmd` strictly as a command-line interface tool, as it is primarily designed for this purpose. If programmatic access is essential, consider using the underlying `ajv` library directly.
Thoroughly test your schemas and data with these options. Refer to the official AJV documentation for a complete understanding of strict mode and type coercion behavior. Start with less strict options and gradually enable them as needed.
When installed locally, use `npx ajv ...` or add `./node_modules/.bin` to your system's PATH. If installed globally (`npm install -g ajv-cmd`), ensure your global `npm` bin directory is in your PATH.
Update your Node.js environment to version 24 or higher. Use a Node Version Manager (e.g., `nvm install 24`, `nvm use 24`) to easily switch versions.
Carefully review your JSON Schema for syntax errors, incorrect keywords, or violations of the JSON Schema specification. Use a schema linter or online validator to pinpoint issues.
Avoid importing directly from `ajv-cmd/src/...` paths. This package is designed for command-line use. If programmatic validation or transpilation is required, use the core `ajv` library directly or rely on `ajv-cmd` via `child_process` (e.g., `execa`).