npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@canard/schema-form-ajv6-plugin

v0.13.0

Published

AJV 6.x validator plugin for @canard/schema-form providing JSON Schema validation with legacy Draft-04, Draft-06, and Draft-07 support

Readme

@canard/schema-form-ajv6-plugin

Typescript Javascript React AJV Json Schema Form Plugin


Overview

@canard/schema-form-ajv6-plugin is a validator plugin for @canard/schema-form that provides JSON Schema validation using AJV 6.x.


Notice

⚠️ This plugin uses AJV 6.x which is compatible with older JSON Schema specifications (Draft-07 and earlier).

📌 If you need support for newer JSON Schema features (Draft 2019-09, Draft 2020-12), consider using @canard/schema-form-ajv8-plugin instead.

💡 This plugin provides a complete JSON Schema validation solution with detailed error reporting and custom validation support.


How to use

yarn add @canard/schema-form @canard/schema-form-ajv6-plugin
import { SchemaForm, registerPlugin } from '@canard/schema-form';
import { ajvValidatorPlugin } from '@canard/schema-form-ajv6-plugin';
// Or register with custom AJV instance
import Ajv from 'ajv';

// Register the validator plugin globally
registerPlugin(ajvValidatorPlugin);

// When using a custom AJV instance
const customAjv = new Ajv({
  allErrors: true,
  nullable: true,
  verbose: true,
});
ajvValidatorPlugin.bind(customAjv);
registerPlugin(ajvValidatorPlugin);

Features

Plugin Interface

The plugin implements the ValidatorPlugin interface providing two main methods:

bind(instance: Ajv.Ajv)

  • Purpose: Allows you to provide a custom AJV instance with your preferred configuration
  • Usage: Optional - if not called, a default AJV instance will be created automatically
  • Benefits: Full control over AJV settings, custom keywords, formats, and validation rules

compile(jsonSchema)

  • Purpose: Creates a validator function from the provided JSON Schema
  • Returns: A validator factory function that can validate data against the schema
  • Features: Automatic error transformation, detailed validation messages, performance optimization

Default Configuration

When no custom AJV instance is provided, the plugin uses these default settings:

const defaultSettings: Ajv.Options = {
  allErrors: true, // Collect all validation errors, not just the first one
  nullable: true, // Enable `nullable` keyword (= `type:[{type}, 'null']`)
  verbose: true, // Include schema and data information in errors
  format: false, // Disable format validation (can be enabled if needed)
};

Validator Factory

The createValidatorFactory function provides:

  • Error Standardization: Converts AJV errors to a consistent format
  • Performance Optimization: Caches compiled validators for reuse
  • Detailed Error Messages: Rich error information for better user experience
  • Type Safety: Full TypeScript support with proper type inference

Compatibility

@canard/schema-form-ajv6-plugin is built with ECMAScript 2020 (ES2020) syntax and supports AJV 6.x.

Supported environments:

  • Node.js 14.17.0 or later
  • Modern browsers (Chrome 91+, Firefox 90+, Safari 14+)
  • AJV 6.0.0 or later

For legacy environment support: Please use a transpiler like Babel to transform the code for your target environment.

Dependency requirements:

  • @canard/schema-form (peer dependency)
  • ajv ^6.0.0

JSON Schema Support:

  • Draft-04
  • Draft-06
  • Draft-07

Migration Guide

From Manual AJV Usage

// Before (manual AJV)
// After (with plugin)
import { SchemaForm, registerPlugin } from '@canard/schema-form';
import { ajvValidatorPlugin } from '@canard/schema-form-ajv6-plugin';
import Ajv from 'ajv';

const ajv = new Ajv();
const validate = ajv.compile(schema);
const isValid = validate(data);

registerPlugin(ajvValidatorPlugin);
// Validation is now handled automatically by SchemaForm

To AJV 8.x

If you need to upgrade to AJV 8.x for newer JSON Schema features:

yarn remove @canard/schema-form-ajv6-plugin
yarn add @canard/schema-form-ajv8-plugin
// Update import
import { ajvValidatorPlugin } from '@canard/schema-form-ajv8-plugin';

License

This repository is licensed under the MIT License. Please refer to the LICENSE file for details.


Contact

For inquiries or suggestions related to the project, please create an issue on the GitHub repository.