Skip to content

theflashlabs/ajv-plus

 
 

Ajv-Plus logo

 

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

build npm npm downloads Coverage Status

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.

Your support is very important - the funds will be used to develop and maintain Ajv-Plus.

Please sponsor Ajv-Plus via:

Thank you.

Features

Install

To install latest version :

npm install @theflashlabs/ajv-plus

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

License

MIT

About

A maintained and JSON specification-compliant fork of the original `ajv` package.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • TypeScript 97.6%
  • JavaScript 1.9%
  • Shell 0.5%