A library that formats JSON Schema validation errors from Ajv into human-readable messages with codeframe highlighting and suggestions. Current version 2.0.3 supports Ajv versions 4.11.8 through 8, and requires Node >= 18.20.6. Ships TypeScript types and offers both CLI (console-friendly) and JS (structured) output formats. Unlike raw Ajv error objects, better-ajv-errors provides line/column references and 'did you mean?' suggestions.
npm install better-ajv-errorsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates validating a payload with Ajv and formatting errors with better-ajv-errors in CLI mode.
new Ajv({ allErrors: true, verbose: true })Use .default or an import statement.
Set format option to 'js' if you need machine-readable output.
Use require('better-ajv-errors').defaultCall betterAjvErrors(schema, data, errors, { format: 'js' })