Ajv JSON Schema Validator

website·Indexed Apr 11, 2026

https://ajv.js.org/

Ajv is a high-performance JSON schema validator for Node.js, browsers, and other JavaScript environments. It supports JSON Schema drafts 04, 06, 07, 2019-09, and 2020-12, as well as JSON Type Definition (RFC8927). The library compiles schemas into optimized JavaScript code, offers TypeScript integration with type guards, and includes plugins like ajv-formats and ajv-keywords for extended functionality. It enables declarative data validation without code and is widely used in production by projects such as ESLint and Fastify.

Tokens
7.8K
Snippets
15
Records
88
Agent score
50%

What's inside Ajv

  1. CodeGen module replaces doT templates in Ajv v7

    Starting from Ajv v7, the CodeGen module replaces doT templates for JSON schema validation code generation. The motivations for this change include: doT templates were difficult to maintain and change, particularly for occasional contributors; they discouraged modularity within validation keywords code and led to implicit dependencies; they had risks of remote code execution when untrusted schemas were used; ES6 template literals now offer a great alternative to both ASTs and plain string concatenation.
  2. Ajv JSON schema validator overview

    Ajv is a high-performance JSON schema validator for Node.js, browsers, Electron apps, WeChat mini-apps, and other JavaScript environments. It enables declarative data validation via schemas without writing validation code.
  3. New features in Ajv v8

    v6-to-v8-migration.html
    v8 adds support for JSON Type Definition (RFC8927), JSON Schema draft-2020-12 and draft-2019-09 features (unevaluatedProperties, unevaluatedItems, dynamic recursive references), OpenAPI discriminator keyword, compiled parsers/serializers from JTD schemas, standalone validation code generation, strict mode to prevent schema mistakes, and ES6 code output (with ES5 option). Schemas are now compiled to ES6 code.
  4. Install ajv-i18n package

    Install the ajv-i18n package using npm to add internationalized error messages to Ajv validation errors.
    npm install ajv-i18n
  5. Ajv version 7 new features

    Ajv version 7 added support for JSON Schema draft-2019-09 features including unevaluatedProperties, unevaluatedItems, and dynamic recursive references. It also introduced strict mode to prevent mistakes in JSON schemas, and rewrote code generation to be safe from code injection and reduce compiled schema size by over 10%.
  6. JSON Type Definition support in Ajv

    Ajv supports JSON Type Definition (JTD), a simpler alternative to JSON Schema defined in RFC8927. JTD is less error-prone and easier to use. See the guide for comparing JSON Schema vs JTD.
  7. Ajv version 8 release summary

    Ajv version 8 introduces support for JSON Schema draft-2020-12, OpenAPI discriminator keyword, improved JSON Type Definition (JTD) error handling with ajv-i18n internationalization, and TypeScript type unions in JSONSchemaType.
  8. ajv-i18n package overview

    ajv-i18n provides internationalized error messages for Ajv, a fast JSON validator for JSON Schema and JSON Type Definition (JTD). It supports 23 locales including English, Russian, Chinese, German, French, Spanish, Japanese, Korean, and many others.
  9. Event Speakers

    Speakers include: Evgeny Poberezkin (Ajv creator), Mehan Jayasuriya (Mozilla Foundation Program Officer, MOSS program), Matteo Collina (NearForm Technical Director, Node.js TSC member, Fastify creator), Kin Lane (Postman Chief Evangelist, former Presidential Innovation Fellow), and Ulysse Carion (JSON Type Definition specification creator).
  10. Ajv version 8 new features

    Ajv version 8 includes: support for JSON Schema draft-2020-12 with prefixItems keyword and changed items keyword semantics, dynamic recursive references, OpenAPI discriminator keyword, and improved JSON Type Definition support.
  11. Migration overview from Ajv v6 to v8

    v6-to-v8-migration.html
    Ajv v8 introduces significant changes including JSON Type Definition (JTD) support, strict mode, improved TypeScript compatibility, and re-written code generation for security. Key breaking changes: draft-04 support removed (use $id instead of id), formats separated to ajv-formats package, Ajv now requires 'new' keyword, and validation error properties changed (dataPath→instancePath, 'should'→'must').