format name
string is converted to RegExp; function should return boolean (true when valid)
this for method chaining
Define custom keyword
custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
keyword definition object with properties type
(type(s) which the keyword applies to), validate
or compile
.
this for method chaining
Add schema that will be used to validate other schemas options in META_IGNORE_OPTIONS are alway set to false
schema object
optional schema key
this for method chaining
Adds schema to the instance.
schema or array of schemas. If array is passed, key
and other parameters will be ignored.
Optional schema key. Can be passed to validate
method instead of schema object or id/ref. One schema per instance can have empty id
and key
.
this for method chaining
Create validating function for passed schema.
schema object
validating function
Creates validating function for passed schema with asynchronous loading of missing schemas.
loadSchema
option should be a function that accepts schema uri and node-style callback.
schema object
optional true to compile meta-schema; this parameter can be skipped
optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
validating function
Convert array of error message objects to string
optional array of validation errors, if not passed errors from the instance are used.
optional options with properties separator
and dataVar
.
human readable string with all errors descriptions
Get keyword definition
pre-defined or custom keyword.
custom keyword definition, true
if it is a predefined keyword, false
otherwise.
Get compiled schema from the instance by key
or ref
.
key
that was passed to addSchema
or full schema reference (schema.id
or resolved id).
schema validating function (with property schema
).
Remove keyword
pre-defined or custom keyword.
this for method chaining
Remove cached schema(s). If no parameter is passed all schemas but meta-schemas are removed. If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
key, ref, pattern to match key/ref or schema object
this for method chaining
Validate data using schema Schema will be compiled and cached (using serialized JSON as key, fast-json-stable-stringify is used to serialize by default).
key, ref or schema object
to be validated
validation result. Errors from the last validation will be available in ajv.errors
(and also in compiled schema: schema.errors
).
Validate keyword
keyword definition object
true to throw exception if definition is invalid
validation result
Validate schema
schema to validate
true if schema is valid
Add custom format