Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@rjsf/validator-ajv8
Advanced tools
Changelog
5.7.0
SelectWidget
and description for CheckboxWidget
MultiSchemaField
to use the new getDiscriminatorFieldFromSchema()
APIexperimental_defaultFormStateBehavior
prop to Form
FileWidget
to again support adding multiple files to arraysadditionalProperties
to fluent-ui theme, fixing #2777.8.x
version of @fluentui/react
maintaining backwards compatibility to version 7, fixing #3463getDiscriminatorFieldFromSchema()
(a refactor of code from MultiSchemaField
) and hashForSchema()
getDefaultFormState()
and toPathSchema()
to use getDiscriminatorFieldFromSchema()
to provide a discriminator field to getClosestMatchingOption()
calls.retrieveSchema()
internal API functions to support implementing an internal schemaParser()
API for use in precompiling schemas, in support of #3543toPathSchema()
to handle properties
in an object along with anyOf
/oneOf
, fixing #3628 and #1628computeDefaults()
into destructured props object to reduce clutter when only specifying later of the optional argument, fixing #3602computeDefaults()
to handle $ref
in an object along with anyOf
/oneOf
, fixing #3633compileSchemaValidators()
and createPrecompiledValidator()
implemented to support using precompiled validators build with AJV 8, fixing #3543custom-templates
describing how to extend the BaseInputTemplate
8.x
version of @fluentui/react
, fixing #3463validation
describing the new precompiled validators featurevalidator-ajv8.md
documentation to the api-reference
directory as well as putting it into the sidebar.js
Readme
AJV-8 based validator plugin for react-jsonschema-form
.
Explore the docs »
View Playground
·
Report Bug
·
Request Feature
Exports validator-ajv8
plugin for react-jsonschema-form
.
@rjsf/utils >= 5.0.0
yarn add @rjsf/core
yarn add @rjsf/validator-ajv8
import { RJSFSchema } from 'packages/utils/dist/index';
import Form from 'packages/core/dist/index';
import validator from '@rjsf/validator-ajv8';
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-ajv8';
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-ajv8';
const metaSchemaDraft06 = require('ajv/lib/refs/json-schema-draft-06.json');
const validator = customizeValidator({
additionalMetaSchemas: [metaSchemaDraft06],
});
const schema: RJSFSchema = {
$schema: 'http://json-schema.org/draft-06/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-ajv8';
const validator = customizeValidator({
ajvOptionsOverrides: {
$data: true,
verbose: true,
},
});
const schema: RJSFSchema = {
type: 'string',
};
<Form schema={schema} validator={validator} />;
or, using a more complex example using ajv-formats
custom format options.
import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import { customizeValidator } from '@rjsf/validator-ajv8';
const validator = customizeValidator({
ajvFormatOptions: {
keywords: true,
formats: ['date', 'time'],
},
});
const schema: RJSFSchema = {
type: 'string',
};
<Form schema={schema} validator={validator} />;
Finally, you can combine both additional meta schemas, custom formats, custom validator config override options and ajv-formats
custom format options.
import { RJSFSchema } from '@rjsf/utils';
import Form from '@rjsf/core';
import { customizeValidator } from '@rjsf/validator-ajv8';
const metaSchemaDraft06 = require('ajv/lib/refs/json-schema-draft-06.json');
const customFormats = {
'phone-us': /\(?\d{3}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
};
const validator = customizeValidator({
additionalMetaSchemas: [metaSchemaDraft06],
customFormats,
ajvOptionsOverrides: {
$data: true,
verbose: true,
},
ajvFormatOptions: {
keywords: true,
formats: ['date', 'time'],
},
});
const schema: RJSFSchema = {
$schema: 'http://json-schema.org/draft-06/schema#',
type: 'string',
format: 'phone-us',
};
<Form schema={schema} validator={validator} />;
See the open issues for a list of proposed features (and known issues).
Read our contributors' guide to get started.
rjsf team: https://github.com/orgs/rjsf-team/people
GitHub repository: https://github.com/rjsf-team/react-jsonschema-form
FAQs
The ajv-8 based validator for @rjsf/core
The npm package @rjsf/validator-ajv8 receives a total of 166,838 weekly downloads. As such, @rjsf/validator-ajv8 popularity was classified as popular.
We found that @rjsf/validator-ajv8 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.