packages/docs/versioned_docs/version-5.24.10/api-reference/validator-ajv8.md
In RJSF version 5, the original, embedded AJV 6 validator implementation from earlier versions was extracted into its own package, @rjsf/validator-ajv6, which was immediately deprecated since AJV 6 is no longer getting maintenance updates.
A new @rjsf/validator-ajv8 package was added that uses the AJV 8 package, including adding support for using precompiled validators.
Below are the exported API functions that are provided by this package.
See the Validation documentation for examples of using these APIs.
There are a few Typescript types that are exported by @rjsf/validator-ajv8 in support of the APIs.
These types can be found on GitHub here.
Creates and returns a customized implementation of the ValidatorType with the given customization options if provided.
If a localizer is provided, it is used to translate the messages generated by the underlying AJV validation.
CustomValidatorOptionsType options that are used to create the ValidatorType instanceErrorObjects after running the form validation using AJVThe function used to compile a schema into an output file in the form that allows it to be used as a precompiled validator. The main reasons for using a precompiled validator is reducing code size, improving validation speed and, most importantly, avoiding dynamic code compilation when prohibited by a browser's Content Security Policy. For more information about AJV code compilation see: https://ajv.js.org/standalone.html
CustomValidatorOptionsType information used to alter the AJV validator used for compiling the schema. They are the same options that are passed to the customizeValidator() function in order to modify the behavior of the regular AJV-based validator.Creates and returns a ValidatorType interface that is implemented with a precompiled validator.
If a localizer is provided, it is used to translate the messages generated by the underlying AJV validation.
NOTE: The
validateFnsparameter is an object obtained by importing from a precompiled validation file created via thecompileSchemaValidators()function.
compileSchemaValidators() functioncompileSchemaValidators() functionErrorObjects after running the form validation using AJV