5.22.3 • Published 9 months ago

@rjsf/validator-ajv6 v5.22.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

Build Status npm npm downloads Contributors Apache 2.0 License

Table of Contents

About The Project

Exports validator-ajv6 plugin for react-jsonschema-form.

Built With

Getting Started

NOTE: This package is deprecated in favor of the @rjsf/validator-ajv8 and is provided primarily for people upgrading to version 5 who initially want to minimize the validator differences.

Prerequisites

React JsonSchema Form Utils

  • @rjsf/utils >= 5.0.0
yarn add @rjsf/core

Installation

yarn add @rjsf/validator-ajv6

Usage

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

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

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

or, using a more complex example using custom validator with custom formats

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

const customFormats = {
  'phone-us': /\(?\d{3}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
};

const validator = customizeValidator({
  customFormats,
});

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

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

or, using a more complex example using a custom with additional meta schema

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

const metaSchemaDraft04 = require('ajv/lib/refs/json-schema-draft-04.json');

const validator = customizeValidator({
  additionalMetaSchemas: [metaSchemaDraft04],
});

const schema: RJSFSchema = {
  $schema: 'http://json-schema.org/draft-04/schema#',
  type: 'string',
};

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

or, using a more complex example using custom validator config override options

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

const validator = customizeValidator({
  ajvOptionsOverrides: {
    $data: true,
    verbose: true,
  },
});

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

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

Finally, you can combine both additional meta schemas, custom formats and custom validator config override options.

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

const metaSchemaDraft04 = require('ajv/lib/refs/json-schema-draft-04.json');

const customFormats = {
  'phone-us': /\(?\d{3}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
};

const validator = customizeValidator({
  additionalMetaSchemas: [metaSchemaDraft04],
  customFormats,
  ajvOptionsOverrides: {
    $data: true,
    verbose: true,
  },
});

const schema: RJSFSchema = {
  $schema: 'http://json-schema.org/draft-04/schema#',
  type: 'string',
  format: 'phone-us',
};

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

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Read our contributors' guide to get started.

Contact

rjsf team: https://github.com/orgs/rjsf-team/people

GitHub repository: https://github.com/rjsf-team/react-jsonschema-form

5.22.3

9 months ago

5.22.2

9 months ago

5.22.1

9 months ago

5.22.0

9 months ago

5.21.2

9 months ago

5.21.1

10 months ago

5.21.0

10 months ago

6.0.0-alpha.0

11 months ago

5.18.6

1 year ago

5.18.5

1 year ago

5.19.4

12 months ago

5.19.3

1 year ago

5.19.2

1 year ago

5.19.1

1 year ago

5.19.0

1 year ago

5.20.1

11 months ago

5.20.0

11 months ago

5.18.4

1 year ago

5.18.3

1 year ago

5.18.2

1 year ago

5.18.1

1 year ago

5.18.0

1 year ago

5.17.1

1 year ago

5.17.0

1 year ago

5.16.1

2 years ago

5.16.0

2 years ago

5.15.1

2 years ago

5.15.0

2 years ago

5.13.2

2 years ago

5.13.1

2 years ago

5.13.0

2 years ago

5.11.2

2 years ago

5.11.1

2 years ago

5.14.3

2 years ago

5.14.2

2 years ago

5.14.1

2 years ago

5.12.1

2 years ago

5.12.0

2 years ago

5.10.0

2 years ago

5.13.6

2 years ago

5.13.5

2 years ago

5.13.4

2 years ago

5.13.3

2 years ago

5.9.0

2 years ago

5.8.2

2 years ago

5.7.3

2 years ago

5.8.1

2 years ago

5.7.2

2 years ago

5.8.0

2 years ago

5.7.1

2 years ago

5.7.0

2 years ago

5.6.0

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

5.4.0

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.6.2

2 years ago

5.5.2

2 years ago

5.0.2

2 years ago

5.1.0

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

5.0.0-beta.20

2 years ago

5.0.0-beta.15

3 years ago

5.0.0-beta.16

3 years ago

5.0.0-beta.14

3 years ago

5.0.0-beta.19

2 years ago

5.0.0-beta.17

2 years ago

5.0.0-beta.18

2 years ago

5.0.0-beta.11

3 years ago

5.0.0-beta.12

3 years ago

5.0.0-beta.13

3 years ago

5.0.0-beta.10

3 years ago

5.0.0-beta.9

3 years ago

5.0.0-beta.8

3 years ago

5.0.0-beta.6

3 years ago

5.0.0-beta.5

3 years ago

5.0.0-beta.4

3 years ago

5.0.0-beta.2

3 years ago

5.0.0-beta.1

3 years ago