Skip to content

Releases: ajv-validator/ajv

v8.0.1

27 Mar 22:43
Compare
Choose a tag to compare

Typescript: export function getData (for ajv-errors)

v8.0.0

27 Mar 12:39
Compare
Choose a tag to compare

This document describes changes from v7.2.4 to v8.0.0.

If you are migrating from v6 you can use this document.

New features

Support JSON Schema draft-2020-12: prefixItems keyword and changed semantics of items keyword, dynamic recursive references.
OpenAPI discriminator keyword.
Improved JSON Type Definition support:

  • errors consistent with JTD specification.
  • error objects with additional properties to simplify error handling (see Error objects)
  • internationalized error messages with ajv-i18n
    TypeScript: support type unions in JSONSchemaType

Other changes / improvements

Node.js require works without .default property - see examples in Getting started
Reduce runtime dependency for standalone validation code
Fix resolution of $ref: "#" when $id is present (#815)

Breaking changes

Option strict controls all strict mode restrictions
JSON Schema validation errors changes:

  • dataPath property replaced with instancePath
  • "should" replaced with "must" in the messages
  • property name is removed from "propertyName" keyword error message (it is still available in error.params.propertyName).

v7.2.4

26 Mar 08:15
Compare
Choose a tag to compare

Fix #1515: correctly initialize evaluated properties.

v8.0.0-beta.4

23 Mar 07:55
Compare
Choose a tag to compare
v8.0.0-beta.4 Pre-release
Pre-release

Revert the change for strict mode options in v8.0.0-beta.1 to allow overrides to disable some options, not only to enable.

These strict mode options are available:
strictSchema - new, equivalent to strict: true in v7, default true
strictNumbers - reinstated from v6, but with default true
strictTypes - same as in v7, default "log"
strictTuples - same as in v7, default "log"
strictTuples - same as in v7, default false

Option strict sets all options above to the same value.

v8.0.0-beta.3

21 Mar 18:40
Compare
Choose a tag to compare
v8.0.0-beta.3 Pre-release
Pre-release

JSON Schema draft2012-12 support - prefixItems, new semantics of items, dynamicRef and dynamicAnchor

Fixes:

  • #815 - incorrect resolution of $ref: "#" with $id in subschema
  • #1493 - incorrect error message for missing property with ownProperties: true option
  • #1501 - incorrect compilation of JTD schema with many properties in the schema

v7.2.3

20 Mar 06:57
Compare
Choose a tag to compare

Remove docs from npm package

v7.2.2

20 Mar 06:39
Compare
Choose a tag to compare

Docs correction
Simplified JSONSchemaType (@erikbrinkman)
Fix #1493 - incorrect reporting of missing required property with option ownProperties: true
Fix #1501 - JTD not working correctly with many properties in the schema

v8.0.0-beta.2

16 Mar 20:18
Compare
Choose a tag to compare
v8.0.0-beta.2 Pre-release
Pre-release

OpenAPI discriminator keyword

v8.0.0-beta.1

15 Mar 07:52
Compare
Choose a tag to compare
v8.0.0-beta.1 Pre-release
Pre-release

Support for union types in JSONSchemaType (#1302, @erikbrinkman).
More ergonomic Ajv constructor export - no need to use .default in .js and .mjs files (#1381).
Remove circular dependencies (#1399).
New syntax for strict option (#1392). It can now be used as boolean/"log" (to set all strict mode restrictions) or as an object with properties schema, number, types, tuples and required, the defaults are:

{
  schema: true,
  number: true,
  types: "log",
  tuples: "log",
  required: false
}

Options strictTypes, strictTuples and strictRequired removed.

v8.0.0-beta.0

13 Mar 11:04
Compare
Choose a tag to compare
v8.0.0-beta.0 Pre-release
Pre-release

JTD error objects:

  • schemaPath and instancePath are consistent with JSON Type Definition RFC
  • added properties keyword and params, message (can be removed with messages: false option) to error objects
    JTD error messages can be translated with ajv-i18n v4.0.0-beta.0
  • typescript: discriminated union type for JTD errors for type-safe error handling, errors need to be cast to JTDErrorObject type.

JSON Schema errors:

  • dataPath property replaced with instancePath (update in your code!)
  • "should" replaced with "must" in the messages
  • property name is removed from "propertyName" keyword error message (it is still available in error.params.propertyName).