UNPKG

1.26 kBTypeScriptView Raw
1export type JSONSchema4 = import("json-schema").JSONSchema4;
2export type JSONSchema6 = import("json-schema").JSONSchema6;
3export type JSONSchema7 = import("json-schema").JSONSchema7;
4export type ErrorObject = import("ajv").ErrorObject;
5export type Extend = {
6 formatMinimum?: number | undefined;
7 formatMaximum?: number | undefined;
8 formatExclusiveMinimum?: boolean | undefined;
9 formatExclusiveMaximum?: boolean | undefined;
10 link?: string | undefined;
11};
12export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend;
13export type SchemaUtilErrorObject = ErrorObject & {
14 children?: Array<ErrorObject>;
15};
16export type PostFormatter = (
17 formattedError: string,
18 error: SchemaUtilErrorObject
19) => string;
20export type ValidationErrorConfiguration = {
21 name?: string | undefined;
22 baseDataPath?: string | undefined;
23 postFormatter?: PostFormatter | undefined;
24};
25/**
26 * @param {Schema} schema
27 * @param {Array<object> | object} options
28 * @param {ValidationErrorConfiguration=} configuration
29 * @returns {void}
30 */
31export function validate(
32 schema: Schema,
33 options: Array<object> | object,
34 configuration?: ValidationErrorConfiguration | undefined
35): void;
36import ValidationError from "./ValidationError";
37export { ValidationError };