Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 24, 2024 via pnpm

ajv-keywords 3.5.2

Custom JSON-Schema keywords for Ajv validator
Package summary
Share
0
issues
2
licenses
6
MIT
1
BSD-2-Clause
Package created
5 Jun 2016
Version published
27 Jul 2020
Maintainers
1
Total deps
7
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
ajv-keywords@3.5.2
ajv@6.12.6
fast-deep-equal@3.1.3
fast-json-stable-stringify@2.1.0
json-schema-traverse@0.4.1
punycode@2.3.1

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
uri-js@4.4.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of ajv-keywords 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
ajv6.12.6197.63 kBMIT
prod peer

Visualizations

Frequently Asked Questions

What does ajv-keywords do?

Ajv-keywords is a custom JSON-Schema keywords utility for Ajv validator. This utility comes handy to extend the functionality of Ajv, which is a fast JSON schema validator. Custom keywords provided by ajv-keywords package include typeof, instanceof, range, regex, among others, which offer extended validation mechanisms, hence providing users with more robust ways of validating JSON data.

How do you use ajv-keywords?

Using Ajv-keywords in your project involves a few steps. First, you'll need to install it using npm with the following command: npm install ajv-keywords. Next, in your JavaScript file, you'll require Ajv and ajv-keywords and create an instance of Ajv. You can then add all available keywords from ajv-keywords. Below is a basic example of how to validate a JSON using ajv-keywords:

const Ajv = require("ajv")
const ajv = new Ajv()
require("ajv-keywords")(ajv)

// Use extra keywords from ajv-keywords in your schema
const schema = { instanceof: 'RegExp' }

// Validate 
ajv.validate(schema, /.*/) // returns true
ajv.validate(schema, '.*') // returns false

You can also add specific keywords instead of all available ones, for instance, adding the "instanceof" keyword would look like this:

require("ajv-keywords")(ajv, "instanceof")

Or multiple keywords like so:

require("ajv-keywords")(ajv, ["typeof", "instanceof"])

Where are the ajv-keywords docs?

The documentation for ajv-keywords can be found on its GitHub repository README file: https://github.com/epoberezkin/ajv-keywords. This document provides comprehensive information about all available keywords, installation instructions, usage examples and options, among other details. Following the examples and explanations provided in these docs will give you a deeper understanding of how to leverage ajv-keywords in JSON validation tasks.