Releases: ajv-validator/ajv
v7.2.3
Remove docs from npm package
v7.2.2
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
OpenAPI discriminator keyword
v8.0.0-beta.1
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
JTD error objects:
schemaPath
andinstancePath
are consistent with JSON Type Definition RFC- added properties
keyword
andparams
,message
(can be removed withmessages: 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 withinstancePath
(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
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
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
v7.1.0
Support for JSON Type Definition RFC 8927 - a simple schema language provided as an alternative to JSON Schema.
See these docs:
- an informal document on Ajv site
- RFC8927
- choosing schema language - comparison with JSON Schema