UNPKG

@sjsf/ajv8-validator

Version:

The ajv-8 based validator for svelte-jsonschema-form

10 lines (9 loc) 747 B
import type { Ajv, AsyncValidateFunction, ValidateFunction } from "ajv"; import type { AnyValidateFunction } from "ajv/dist/core.js"; import { type MapLike } from "@sjsf/form/lib/memoize"; import type { Config, Schema } from "@sjsf/form"; export interface ValidatorsCache extends MapLike<Schema, AnyValidateFunction> { delete(schema: Schema): boolean; } export declare function createSchemaCompiler<A extends boolean>(ajv: Ajv, _async: A, validatorsCache?: ValidatorsCache): (schema: Schema, rootSchema: Schema) => A extends true ? AsyncValidateFunction : ValidateFunction; export declare function createFieldSchemaCompiler<A extends boolean>(ajv: Ajv, async: A): (config: Config) => A extends true ? AsyncValidateFunction : ValidateFunction;