unstale

npm / ajv

ajv

What changed in ajv 7 to 8, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

29 breaking2 security1 deprecations12 new APIs and options1 performance4 behavior and defaults3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

ajv 814 changes

Breaking changes 5

  • Ajv adds support for Node.js 22 and 24, and drops support for Node.js 16 and 21.

    8.20.0release notes

  • Fixes Infinity and NaN serialization so they serialize to null.

    8.18.0release notes

  • Validation errors use instancePath instead of dataPath.

    8.0.0release notes

  • JTD errors are now consistent with the JTD specification.

    8.0.0release notes

  • The property name is removed from propertyName keyword error messages and remains available in error.params.propertyName.

    8.0.0release notes

Security 2

  • Fixes prototype pollution via the format keyword when using a $data reference.

    8.19.0release notes

  • Uses the configured RegExp engine with the $data keyword to mitigate ReDoS attacks.

    8.18.0release notessecurity advisory

New APIs and options 1

Performance 1

  • Adds sideEffects: false to enable tree-shaking of the package.

    8.18.0release notes

Behavior and default changes 2

  • Error objects include additional properties to simplify error handling.

    8.0.0release notes

  • Validation error messages replace “should” with “must.”

    8.0.0release notes

Fixes and other changes 3

  • Adds ES2022.RegExp support for RegExpIndicesArray.

    8.20.0release notes

  • Fixes resolution of $ref: "#" when $id is present.

    8.0.0release notes

  • Node.js require works without accessing a .default property.

    8.0.0release notes

ajv 738 changes

Breaking changes 24

  • Keyword names must now be passed as a property in the definition object; the old API works with a deprecated warning. Inline keyword support was removed, and code-generation keywords use the code definition property.

    7.0.0release notes

  • Ajv is now an ES6 class and instances can only be created with the new keyword.

    7.0.0release notes

  • Formats are now provided by a separate package and must be explicitly added when used.

    7.0.0release notes

  • Separate Ajv classes are provided for draft-07 and draft-2019-09 support, with different default imports.

    7.0.0release notes

  • The option defaults to false and controls whether the type keyword allows multiple non-null types.

    7.0.0release notes

  • The cache option was removed; a Map is used as the cache, with the schema object as key.

    7.0.0release notes

  • The removed processCode option is replaced by code.process, which receives code and schemaEnv and returns a string.

    7.0.0release notes

  • The removed sourceCode option is replaced by code.source set to true.

    7.0.0release notes

  • JSON Schema draft-04 support was removed; schemas using id attributes must replace them with $id or continue using version 6.

    7.0.0release notes

  • The deprecated option was removed.

    7.0.0release notes

  • Schemas are now compiled to ES6 code by default; ES5 code generation remains available through an option.

    7.0.0release notes

  • $ref siblings are now validated by default; ignoreKeywordsWithRef can be used to ignore them.

    7.0.0release notes

  • The option was removed; validateFormats: false can be used instead, and the old format mode is available through ajv-formats.

    7.0.0release notes

  • JSONPointers are now used to report errors by default; jsPropertySyntax can be used for the old format.

    7.0.0release notes

  • Missing references now always throw an exception; an empty schema with the ignored $id can be passed to addSchema.

    7.0.0release notes

  • The nullable keyword is now supported by default, so the nullable option was removed.

    7.0.0release notes

  • Regular expressions in pattern are now used as if they had the Unicode u flag, which can make some previously valid expressions invalid and vice versa.

    7.0.0release notes

  • Regular expressions in patternProperties are now used as if they had the Unicode u flag, which can make some previously valid expressions invalid and vice versa.

    7.0.0release notes

  • The option was removed because JSON Schema draft-04 is no longer supported.

    7.0.0release notes

  • The serialize option was removed; a Map is used as the cache, with the schema object as key.

    7.0.0release notes

  • Strict mode was added to prohibit ignored or ambiguous JSON Schema elements; its default is true.

    7.0.0release notes

  • The option was removed; strict behavior is now controlled with strict.

    7.0.0release notes

  • The option was removed because the uniqueItems keyword is always validated.

    7.0.0release notes

  • Keywords applying to all types are validated before keywords applying to specific data types; custom all-type keywords can use post: true to run afterward.

    7.0.0release notes

Deprecations 1

  • The option now expects an array of keyword definitions; the old API works with a deprecated warning.

    7.0.0release notes

New APIs and options 11

  • A new method allows adding an array of keyword definitions.

    7.0.0release notes

  • The option defaults to false and controls whether properties and patternProperties may overlap.

    7.0.0release notes

  • Setting es5 to true generates ES5 code instead of the default ES6 code.

    7.0.0release notes

  • Setting lines to true adds line breaks to generated code to simplify debugging compiled schemas.

    7.0.0release notes

  • The optimize option controls code optimization.

    7.0.0release notes

  • A type utility generates a JSON Schema type for the interface supplied as its type parameter; unions are not supported at this time.

    7.0.0release notes

  • The option defaults to Infinity and optimizes validation of enums, similar to loopRequired.

    7.0.0release notes

  • Schemas can be compiled to standalone modules with one or multiple exports.

    7.0.0release notes

  • The option defaults to log and helps prevent incomplete tuple schemas.

    7.0.0release notes

  • The option defaults to log and helps prevent mistakes involving type keywords and keyword applicability.

    7.0.0release notes

  • The option defaults to true and enables format validation.

    7.0.0release notes

Behavior and default changes 2