UNPKG

json-schema-describes-subset

Version:

Tools for static JSON schema analysis, including functions to determine if one schema describes a subset of another or if a schema describes the empty set or to convert a schema to its disjunctive normal form (DNF).

16 lines (15 loc) 873 B
import type { JSONSchema, JSONSchemaObject } from '../json-schema/index.js'; import type { ValidationPlugin } from '../plugin/plugin.js'; /** * Setting for {@link Ajv}'s options. Fixed opinionated value, that should work * for the vast majority of cases. Rounding errors should usually be smaller * than this. Setting this option in ajv will have a minor influence on * performance, but since this tool is designed for static schema analysis, this * is tolerable. * */ export declare const multipleOfPrecision = 7; export declare const multipleOfEpsilon: number; export type ValidateFunction = (schema: JSONSchema, data: unknown) => boolean; export declare function enhanceSchema(schema: JSONSchema, definitions: JSONSchemaObject[]): JSONSchema; export declare function createValidate(plugins: ValidationPlugin[], definitions: JSONSchemaObject[]): ValidateFunction;