Skip to content

Releases: ajv-validator/ajv

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).

v7.2.1

07 Mar 18:59
Compare
Choose a tag to compare

Add tests and fix parsers compiled with ajv.compileParser from JTD schemas:

  • fail on invalid JSON:
    • trailing comma in arrays/objects
    • invalid JSON numbers
    • control characters in strings
  • fix parsing of u-escaped characters
  • do not fail on duplicate object keys (consistent with JSON.parse)

Compiled parsers are now:

  • consistent with JSON.parse in case of invalid JSON
  • only parse data that is valid for JTD schema

It is a breaking change for compiled parsers compared with 7.2.0 that was released earlier on the same day.

v7.2.0

07 Mar 09:56
Compare
Choose a tag to compare

strictRequired option (off by default) - to log or fail if properties used in JSON Schema "required" are not defined in "properties" (@PBug90, #1403)

Compiled parsers (as fast as JSON.parse on valid JSON, but replace validation and fail much faster on invalid JSON) and serializers (10x+ faster than JSON.stringify) from JSON Type Definition schemas (#1454) - see examples in javascript and typescript

Please note: there are fixes to compiled parsers in 7.2.1

The website migrated to VuePress and documentation is restructured to make navigating Ajv documentation and learning easier - this is still work in progress, but already some improvement on the information structure. Any feedback/corrections would be very much appreciated!

Improved TypeScript support for JSONSchemaType:

  • JTDSchemaType utility type to convert your data type into the type of JTD schema, to simplify its writing and to make sure it is consistent with your data type, with type inference support for ajv methods (@erikbrinkman, #1446, #1456, #1457, #1475) - see example here
  • Alternatively, you can use JTDDataType utility type to convert your JTD schema type into the type of data (@erikbrinkman, #1458) - see this example

Other improvements by @Fdawgs (#1466), @t7yang (#1472, #1473), @koba04 (#1460)

v7.1.1

17 Feb 09:07
Compare
Choose a tag to compare

Support readonly arrays with JSONSchemaType (@LinusU, #1447)

v7.1.0

11 Feb 08:39
Compare
Choose a tag to compare

Support for JSON Type Definition RFC 8927 - a simple schema language provided as an alternative to JSON Schema.

See these docs:

Allow ":" in keyword names (#1421, @teq0)

v7.0.4

01 Feb 21:01
Compare
Choose a tag to compare

Fix: duplicate functions in standalone validation code with mutually recursive schemas (#1361)
Fix: reference resolution when base URI change was not applied (#1414)