Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 28, 2024 via pnpm

ajv-keywords 0.1.1

Custom JSON-Schema keywords for ajv validator
Package summary
Share
0
issues
1
license
1
MIT
Package created
5 Jun 2016
Version published
5 Jun 2016
Maintainers
1
Total deps
1
Direct deps
0
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
1 Packages, Including:
ajv-keywords@0.1.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

0
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

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.