UNPKG

@rjsf/validator-ajv6

Version:
24 lines (23 loc) 1.5 kB
import Ajv from 'ajv'; import { CustomValidatorOptionsType } from './types.js'; export declare const AJV_CONFIG: { readonly errorDataPath: "property"; readonly allErrors: true; readonly multipleOfPrecision: 8; readonly schemaId: "auto"; readonly unknownFormats: "ignore"; }; export declare const COLOR_FORMAT_REGEX: RegExp; export declare const DATA_URL_FORMAT_REGEX: RegExp; /** Creates an Ajv version 6 implementation object with standard support for the 'color` and `data-url` custom formats. * If `additionalMetaSchemas` are provided then the Ajv instance is modified to add each of the meta schemas in the * list. If `customFormats` are provided then those additional formats are added to the list of supported formats. If * `ajvOptionsOverrides` are provided then they are spread on top of the default `AJV_CONFIG` options when constructing * the `Ajv` instance. * * @param [additionalMetaSchemas] - The list of additional meta schemas that the validator can access * @param [customFormats] - The set of additional custom formats that the validator will support * @param [ajvOptionsOverrides={}] - The set of validator config override options * @deprecated in favor of the `@rjsf/validator-ajv8 */ export default function createAjvInstance(additionalMetaSchemas?: CustomValidatorOptionsType['additionalMetaSchemas'], customFormats?: CustomValidatorOptionsType['customFormats'], ajvOptionsOverrides?: CustomValidatorOptionsType['ajvOptionsOverrides']): Ajv.Ajv;