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

rjsf-validator-cfworker

v1.0.2

Published

The @cfworker/json-schema based validator for @rjsf/core

Readme

rjsf-validator-cfworker

npm npm downloads MIT License

Sponsors

Development of this library has been sponsored by Glama.ai.

About The Project

Exports validator-cfworker plugin for react-jsonschema-form. This validator is based on @cfworker/json-schema, which is a lightweight JSON Schema validator optimized for Cloudflare Workers and other edge computing environments.

Why This Library?

This library was created to address a fundamental limitation with AJV (Another JSON Schema Validator): AJV cannot be used in contexts that disallow unsafe-eval.

Many modern web environments enforce strict Content Security Policies (CSP) that prohibit the use of eval() and similar dynamic code execution methods. This includes:

  • Cloudflare Workers - Edge computing environment with strict security policies
  • Browser extensions - Chrome and Firefox extensions with CSP restrictions
  • Strict CSP web applications - Applications that set script-src without 'unsafe-eval'

The original issue was raised in react-jsonschema-form#3269, requesting an alternative validator that works in these restricted environments.

This library provides a drop-in replacement for @rjsf/validator-ajv8 that uses @cfworker/json-schema under the hood, which does not rely on dynamic code evaluation.

Built With

Key Features

  • Cloudflare Workers Compatible: Designed to work in edge computing environments without relying on eval or dynamic code execution
  • Lightweight: Smaller bundle size compared to AJV-based validators
  • JSON Schema Support: Supports JSON Schema drafts 4, 6, 7, 2019-09, and 2020-12
  • No Precompilation Required: Works without code generation or precompilation steps
  • CSP Compliant: Works in environments with strict Content Security Policies

Getting Started

Prerequisites

  • @rjsf/utils >= 5.0.0

Installation

npm install rjsf-validator-cfworker
# or
yarn add rjsf-validator-cfworker

Usage

import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import validator from 'rjsf-validator-cfworker';

const schema: RJSFSchema = {
  type: 'string',
};

<Form schema={schema} validator={validator} />;

or, using a custom validator with a specific JSON Schema draft version:

import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import { customizeValidator } from 'rjsf-validator-cfworker';

const validator = customizeValidator({
  draft: '2020-12', // Use JSON Schema draft 2020-12
});

const schema: RJSFSchema = {
  type: 'string',
};

<Form schema={schema} validator={validator} />;

or, using short-circuit validation (stops on first error):

import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import { customizeValidator } from 'rjsf-validator-cfworker';

const validator = customizeValidator({
  shortCircuit: true, // Stop validation on first error
});

const schema: RJSFSchema = {
  type: 'string',
};

<Form schema={schema} validator={validator} />;

or, combining options:

import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import { customizeValidator } from 'rjsf-validator-cfworker';

const validator = customizeValidator({
  draft: '2019-09',
  shortCircuit: false,
  customFormats: {
    'phone-us': /\(?\d{3}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
  },
});

const schema: RJSFSchema = {
  type: 'string',
  format: 'phone-us',
};

<Form schema={schema} validator={validator} />;

API

customizeValidator(options)

Creates a customized validator instance.

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | draft | '4' \| '6' \| '7' \| '2019-09' \| '2020-12' | '2019-09' | The JSON Schema draft version to use | | shortCircuit | boolean | false | Whether to stop validation on the first error | | customFormats | object | undefined | Custom format validators (Note: limited support compared to AJV) |

Differences from @rjsf/validator-ajv8

This validator is designed for edge computing environments and has some differences from the AJV-based validator:

  1. No precompilation support: Unlike AJV, @cfworker/json-schema doesn't support standalone code generation
  2. Simplified format support: Custom formats are supported but with more limited functionality
  3. No meta schema customization: Additional meta schemas cannot be added dynamically
  4. No AJV-specific options: Options like $data, verbose, and discriminator are not available
  5. No localization: The localizer parameter is not supported

License

Distributed under the MIT License. See LICENSE for more information.