Package Exports
- @theflashlabs/ajv-plus
- @theflashlabs/ajv-plus/dist/ajv.js
- @theflashlabs/ajv-plus/dist/compile/codegen
- @theflashlabs/ajv-plus/dist/compile/codegen/index.js
- @theflashlabs/ajv-plus/dist/core
- @theflashlabs/ajv-plus/dist/core.js
- @theflashlabs/ajv-plus/dist/types
- @theflashlabs/ajv-plus/dist/types/index.js
- @theflashlabs/ajv-plus/dist/vocabularies/applicator
- @theflashlabs/ajv-plus/dist/vocabularies/applicator/index.js
- @theflashlabs/ajv-plus/dist/vocabularies/core/ref
- @theflashlabs/ajv-plus/dist/vocabularies/core/ref.js
- @theflashlabs/ajv-plus/dist/vocabularies/discriminator
- @theflashlabs/ajv-plus/dist/vocabularies/discriminator/index.js
- @theflashlabs/ajv-plus/dist/vocabularies/format
- @theflashlabs/ajv-plus/dist/vocabularies/format/index.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/const
- @theflashlabs/ajv-plus/dist/vocabularies/validation/const.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/enum
- @theflashlabs/ajv-plus/dist/vocabularies/validation/enum.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitItems
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitItems.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitLength
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitLength.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitProperties
- @theflashlabs/ajv-plus/dist/vocabularies/validation/limitProperties.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/multipleOf
- @theflashlabs/ajv-plus/dist/vocabularies/validation/multipleOf.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/pattern
- @theflashlabs/ajv-plus/dist/vocabularies/validation/pattern.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/required
- @theflashlabs/ajv-plus/dist/vocabularies/validation/required.js
- @theflashlabs/ajv-plus/dist/vocabularies/validation/uniqueItems
- @theflashlabs/ajv-plus/dist/vocabularies/validation/uniqueItems.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@theflashlabs/ajv-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Ajv-Plus JSON schema validator
This is a maintained and JSON specification-compliant fork of the original ajv package.
The fastest JSON validator for Node.js and browser.
Supports JSON Schema draft-04/06/07/2019-09/2020-12 (draft-04 support requires ajv-draft-04 package).
Why fork?
- Ajv-Plus wants to be actively maintained. Support the upcoming JSON Schema specification version too.
- Ajv-Plus wants to be 100% compliant with the standard JSON Specification.
- Benchmarks are available at https://theflashlabs.github.io/ajv-plus/dev/bench/
Thanks to Author and contributors of AJV
Thanks to the original author Evgeny Poberezkin and all the contributors of AJV.
Contributing
Please review Contributing guidelines.
Please sponsor Ajv-Plus development
Your support is very important - the funds will be used to develop and maintain Ajv-Plus.
Please sponsor Ajv-Plus via:
Thank you.
Features
- Ajv implements JSON Schema draft-06/07/2019-09/2020-12 standards (draft-04 is supported in v6):
- all validation keywords (see JSON Schema validation keywords)
- OpenAPI extensions:
- NEW: keyword discriminator.
- keyword nullable.
- full support of remote references (remote schemas have to be added with
addSchemaor compiled to be available) - support of recursive references between schemas
- correct string lengths for strings with unicode pairs
- JSON Schema formats (with ajv-formats plugin).
- validates schemas against meta-schema
- supports browsers and Node.js 10.x - current
- asynchronous loading of referenced schemas during compilation
- "All errors" validation mode with option allErrors
- error messages with parameters describing error reasons to allow error message generation
- i18n error messages support with ajv-i18n package
- removing-additional-properties
- assigning defaults to missing properties and items
- coercing data to the types specified in
typekeywords - user-defined keywords
- additional extension keywords with ajv-keywords package
- $data reference to use values from the validated data as values for the schema keywords
- asynchronous validation of user-defined formats and keywords
Install
To install latest version :
npm install @theflashlabs/ajv-plusGetting started
In JavaScript:
// or ESM/TypeScript import
import Ajv from "@theflashlabs/ajv-plus"
// Node.js require:
const Ajv = require("@theflashlabs/ajv-plus")
const ajv = new Ajv() // options can be passed, e.g. {allErrors: true}
const schema = {
type: "object",
properties: {
foo: {type: "integer"},
bar: {type: "string"},
},
required: ["foo"],
additionalProperties: false,
}
const data = {
foo: 2,
bar: "abc",
}
const validate = ajv.compile(schema)
const valid = validate(data)
if (!valid) console.log(validate.errors)Changes history
See https://github.com/theflashlabs/ajv-plus/releases
Code of conduct
Please review and follow the Code of conduct.