Ajv (Another JSON Schema Validator)

Fastest JSON Schema validator for JavaScript. Compiles JSON Schema drafts 04, 06, 07, 2019-09, and 2020-12 into optimized validation functions. Used by many tools (webpack, eslint, ajv-formats) for configuration and data validation. Supports custom keywords, formats, and error messages. The standard JSON Schema validation library for the Node.js ecosystem.

Evaluated Mar 06, 2026 (0d ago) v8.x
Homepage ↗ Repo ↗ Developer Tools json-schema validation schema ajv openapi draft-7 draft-2020-12
⚙ Agent Friendliness
66
/ 100
Can an agent use this?
🔒 Security
98
/ 100
Is it safe for agents?
⚡ Reliability
86
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
72
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
88
Secret Handling
100

Local computation. MIT licensed. Regular security audits. ReDoS-safe format validators when using ajv-formats. No remote calls.

⚡ Reliability

Uptime/SLA
100
Version Stability
82
Breaking Changes
75
Error Recovery
88
AF Security Reliability

Best When

You need high-performance JSON Schema (draft-07, draft-2020-12) validation, OpenAPI schema compliance, or have existing JSON Schema files you want to enforce.

Avoid When

You're starting a new TypeScript project without existing JSON Schema — Zod provides better TypeScript integration with schema-derived types without a separate JSON Schema definition.

Use Cases

  • Validate API request/response bodies against JSON Schema for agent API clients and servers
  • Validate configuration files and environment variables before agent startup using compiled schemas
  • Enforce data contracts between agent components by validating message schemas at runtime
  • Validate OpenAPI response bodies against schemas for agent integration testing
  • Generate type-safe validation in TypeScript agent pipelines with compile-time schema type inference

Not For

  • Simple input validation — Zod or Yup offer more ergonomic APIs with TypeScript inference for application-level validation
  • Runtime type checking in TypeScript — use Zod for validator+type inference in one; Ajv requires separate type definitions
  • Human-readable error messages out of the box — Ajv errors are verbose JSON; use ajv-errors or transform errors for user-facing messages

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Local library — no authentication required. MIT licensed.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT licensed. Zero cost.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Ajv v8 dropped support for JSON Schema draft-04 by default — use new Ajv04() from 'ajv/dist/draft-04' for draft-04 schemas; breaking change from v6
  • Compile schemas once at startup — ajv.compile(schema) is expensive; store compiled validator in a variable and reuse rather than compiling on each request
  • format validation (email, date, uri) is NOT included by default in v8 — install 'ajv-formats' package and apply: const ajv = new Ajv(); addFormats(ajv)
  • additionalProperties: false in schemas rejects extra fields — common source of validation failures when API responses have undocumented fields; use allowUnionTypes option
  • Ajv errors are on the validate.errors property AFTER calling validate() — validate() returns boolean, errors are stored as side effect: const valid = validate(data); if (!valid) console.log(validate.errors)
  • TypeScript users: ajv-validator/ajv provides TypeScript types but schema-to-type inference is not built-in — use TypeBox or Zod for automatic TypeScript type derivation from schemas

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Ajv (Another JSON Schema Validator).

$99

Scores are editorial opinions as of 2026-03-06.

5209
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered