NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #23 most downloaded on npm
Another JSON Schema Validator
Last release 5 months ago
24 Apr 2026
Ships unpredictably
gaps range from 8 days to 1.6 years
Most releases are documented
notes for 50 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
359 releases · first in 2015
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
Nothing published for this version
Nothing published for this version
Changed order of type validation - "type" keyword is now validated before keywords that apply to all types.
Changed order of type validation - "type" keyword is now validated before keywords that apply to all types.
Nothing published for this version
Nothing published for this version
More comprehencive uri-reference format in {format: "full"} mode.
More comprehencive uri-reference format in {format: "full"} mode.
Rename format uri-ref to uri-reference Cross-platform scripts Update draft-6 meta-schema
Rename format uri-ref to uri-reference
Cross-platform scripts
Update draft-6 meta-schema
Support $id from draft-06. Option schemaId determining whether $id, id or both are used. See Options Format "regex" is changed to prohibit \Z anchor.
Support $id from draft-06.
Option schemaId determining whether $id, id or both are used. See Options
Format "regex" is changed to prohibit \Z anchor.
Format "uri" is changed to only allow absolute URIs, relative URIs are supported with "uri-ref".
Run draft-06 tests from JSON-Schema-Test-Suite in addition to draft-04 tests.
Support custom formats for numbers (#291) Option ownProperties supports all keywords (#197). See Options. Improve support of custom keywords with $dat
Support custom formats for numbers (#291) Option ownProperties supports all keywords (#197). See Options. Improve support of custom keywords with $data option.
Also see 5.0.1-beta.0 about the migration from 4.x.x
Nothing published for this version
Improve error handling (#380, #394) Improve webpack support
Improve error handling (#380, #394) Improve webpack support (#403)
Option serialize to replace json-stable-stringify with another function to serialise schemas. Support deprecated patternGroups without draft-06 meta-s…
Option serialize to replace json-stable-stringify with another function to serialise schemas.
Support deprecated patternGroups without draft-06 meta-schema.
Log warning instead of throwing exception when option meta: false is used without validateSchema: false.
Same as 4.11.0 Also see 5.0.1-beta.0
Same as 4.11.0 Also see 5.0.1-beta.0
patternGroups is deprecated, it can be still used with option patternRequired.
If you are migrating from 4.x.x also see 5.0.0-beta.1 and Migration section below
Support for all keywords included in draft 6 (it is not published yet and can change).
const (previously available as constant). To simplify migration you can define an alias constant as a custom macro keyword:
ajv.addKeyword('constant', { macro: x => ({ const: x }) });
contains. It is re-implemented as a standard keyword, if none of the items is valid, errors for all items will be reported now.
NEW propertyNames keyword added (previously it was a part of ajv-keywords package). It allows to validate all property names rather than values.
exclusiveMaximum/Minimum in draft 6 must be numbers, Ajv supports boolean form too for backwards compatibility.
Moved/deprecated:
patternRequired.true/false can be used in order to always pass/fail validation.http://json-schema.org/draft-06/schema# (it can change when draft 6 is published).If your $schema keyword points to draft 4 or v5 meta-schema you need to add it manually:
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
// or
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-v5.json'));
v5 is no longer used, for $data reference support use option $databeautify: true is no longer supported.processCode: function() {} can be used to beautify/transpile generated code. See Optionstranspile option support require ajv-async package."co*" (co-wrapped generator functions).processCode option. See Options.true).Compatible versions are:
^2.0.0-beta^3.0.0-beta^2.0.0-betavar ajv = new Ajv({
meta: false, // optional, to prevent adding draft-06 meta-schema
extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
unknownFormats: 'ignore', // optional, current default is true (fail)
// ...
});
var metaSchema = require('ajv/lib/refs/json-schema-draft-04.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;
// optional, using unversioned URI is out of spec, see https://github.com/json-schema-org/json-schema-spec/issues/216
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema';
// Optionally you can also disable keywords defined in draft-06
ajv.removeKeyword('propertyNames');
ajv.removeKeyword('contains');
ajv.removeKeyword('const');
var ajv = new Ajv({
$data: true,
patternGroups: true,
meta: false, // optional, to prevent adding draft-06 meta-schema
extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
unknownFormats: 'ignore', // optional, current default is true (fail)
// ...
});
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema'; // optional, using unversioned URI is out of spec
var metaSchema = require('ajv/lib/refs/json-schema-v5.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;
// optional - to avoid changing the schemas
ajv.addKeyword('constant', { macro: x => ({ const: x }) }); // this keyword is renamed to const in draft-06
// you need to use version "^2.0.0-beta" of ajv-keywords
require('ajv-keywords')(ajv, ['switch', 'patternRequired', 'formatMinimum', 'formatMaximum']);
// Optionally you can also disable propertyNames keyword defined in draft-06
ajv.removeKeyword('propertyNames');
patternGroups is deprecated, it can be still used with option patternRequired.
This release is fully backward compatible, but it may require either migrating your schemas (recommended, e.g. using "migrate" command of ajv-cli) or changing your code that uses Ajv.
You can still use draft-04 and v5 schemas with this release (see Migration guide below).
The changes below are based on 4.11.7 version.
true/false can be used in order to always pass/fail validation.$id keyword is used as schema URI (previously id).exclusiveMaximum and exclusiveMinimum keywords must be numbers (previously boolean).See Internet drafts: JSON Schema, JSON Schema Validation.
It is a recommended approach.
id with $id$schemaexclusiveMaximum/Minimum with numeric formconstant with constenum with a single allowed value with consttrue{"not":{}} with falseYou can use "migrate" command of ajv-cli to make these changes to your schemas.
var ajv = new Ajv({
meta: false, // optional, to prevent adding draft-06 meta-schema
extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
unknownFormats: 'ignore', // optional, current default is true (fail)
// ...
});
var metaSchema = require('ajv/lib/refs/json-schema-draft-04.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;
// optional, using unversioned URI is out of spec, see https://github.com/json-schema-org/json-schema-spec/issues/216
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema';
// Optionally you can also disable keywords defined in draft-06
ajv.removeKeyword('propertyNames');
ajv.removeKeyword('contains');
ajv.removeKeyword('const');
var ajv = new Ajv({
$data: true,
patternGroups: true,
meta: false, // optional, to prevent adding draft-06 meta-schema
extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
unknownFormats: 'ignore', // optional, current default is true (fail)
// ...
});
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema'; // optional, using unversioned URI is out of spec
var metaSchema = require('ajv/lib/refs/json-schema-v5.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;
// optional - to avoid changing the schemas
ajv.addKeyword('constant', { macro: x => ({ const: x }) }); // this keyword is renamed to const in draft-06
// you need to use version "^2.0.0" of ajv-keywords
require('ajv-keywords')(ajv, ['switch', 'patternRequired', 'formatMinimum', 'formatMaximum']);
// Optionally you can also disable propertyNames keyword defined in draft-06
ajv.removeKeyword('propertyNames');
Moved/deprecated:
patternRequired.compileAsync method returns Promise and supports async loading of meta-schemas (#249, #334).schemaId determining whether $id, id or both are used.$data for $data reference support.ownProperties supports all keywords (#197).serialize to replace json-stable-stringify with another function to serialise schemas.meta: false is used without validateSchema: false.processCode: function() {} can be used to beautify/transpile generated code.beautify: true is no longer supported.v5 is no longer used.Option defaults changed:
"ignore" - when $ref is used other keywords are ignored (was true) (#294).false - do not store source code of validation functions (was true) (#309).true - fail schema compilation (was "ignore") (#324).transpile option support require ajv-async package."co*" (co-wrapped generator functions).processCode option. See Options.true).console.warn and console.error (#265).Compatible versions are:
Ajv.MissingRefError class is used to throw missing $ref exception Typings are updated - typescript 2.0 is required now
Ajv.MissingRefError class is used to throw missing $ref exception Typings are updated - typescript 2.0 is required now
Also see 5.0.0-beta.0
Methods are no longer bound to Ajv instances (#232). compileAsync method returns Promise and supports async loading of meta-schemas (#249, #334). Erro
Methods are no longer bound to Ajv instances (#232).
compileAsync method returns Promise and supports async loading of meta-schemas (#249, #334).
Errors are logged using console.warn and console.error (#265).
If async option is not specified, es7 native async functions are used as the primary option (if available)(#338), see Asynchronous validation.
Option defaults changed (see Options):
"fail" - fail schema compilation (#294).false - do not store source code of validation functions (#309).true - fail schema compilation (#324).Defaults in version 4.x.x:
{
extendRefs: true,
sourceCode: true,
unknownFormats: 'ignore'
}
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
allow hyphens in keyword names.
Custom keywords enhancements:
modifying: true in keyword definition to support keywords that change data (#392).valid: true/false in keyword definition to pre-define validation result - it allows to simplify generated code in cases when keywords are used only for side-effects (#393).Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Method getKeyword to return keyword definition. Method removeKeyword to remove custom or pre-defined keyword. See API. Fix for webpack warnings for op
Method getKeyword to return keyword definition.
Method removeKeyword to remove custom or pre-defined keyword. See API.
Fix for webpack warnings for optional dependencies (#117, #325).
Nothing published for this version
Nothing published for this version
Nothing published for this version
Support undefined, RegExp and Date instances in uniqueItems keyword (#342).
Support undefined, RegExp and Date instances in uniqueItems keyword (#342).
Nothing published for this version
Nothing published for this version
Option unknownFormats to fail schema compilation if unknown format is used or fail validation if unknown format is in v5 $data reference (#310) Suppor
Option unknownFormats to fail schema compilation if unknown format is used or fail validation if unknown format is in v5 $data reference (#310) Support for generating standalone module exporting a validation function to be used without Ajv (using ajv-cli)
Fixes:
null as schema value in keywords that support $data reference (#305)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Reduce memory utilisation by compiled validation functions (#293, @rf):
Reduce memory utilisation by compiled validation functions (#293, @rf):
eval with new Function (to reduce the size of scope variables of closures)sourceCode: false to optionally not store the generated code in the property of validating functionsNothing published for this version
Support absolute JSON-pointers in $data references (#285, #289, @HotelDon). allowedValues param in "enum" keyword error (#282). Use Ajv bundle with we
Support absolute JSON-pointers in $data references (#285, #289, @HotelDon).
allowedValues param in "enum" keyword error (#282).
Use Ajv bundle with webpack (#117, #288, @donaldpipowitch).
Pass schema compilation context as the 3rd parameter to compile and macro custom keyword functions (#280).
Pass root data as the 5th parameter to validation functions (including validate custom keyword function).
Improved support of references:
Improved support of references:
validate and getSchema (#47).Nothing published for this version
Option extendRefs to disable validation of other keywords when $ref is present in the schema. Support validating schemas against themselves (to allow
Option extendRefs to disable validation of other keywords when $ref is present in the schema.
Support validating schemas against themselves (to allow meta-schemas where id is the same as $schema, e.g. JSON hyper meta-schema).
Nothing published for this version
Coerce between scalar data and arrays with option coerceTypes: 'array' (#158, @willfarrell). See Coercing data types.
Coerce between scalar data and arrays with option coerceTypes: 'array' (#158, @willfarrell).
See Coercing data types.
meta schema for custom keyword schemas
Custom keywords:
Improved support for mutually recursive references (#210, #240) Support control characters in JSON properties (#226)
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →