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).

26 lines (25 loc) 1.08 kB
import type { JSONSchema } from '../../../json-schema/index.js'; import type { InternalOptions } from '../../../options/index.js'; import type { SplitToRawDNF } from '../../../atomic-schema/split/index.js'; import type { RawDNF } from '../../../atomic-schema/to-raw-dnf/index.js'; export type IsStringWithConstsOrPatternsResult = { isStringWithConstsOrPatterns: true; consts: string[]; patterns: string[]; } | { isStringWithConstsOrPatterns: false; consts?: undefined; patterns?: undefined; }; /** * Returns constant values and patterns that will satisfy the provided string * schema. Returns null if the schema if such constant values or patterns could * not be found. * */ export declare function retrieveStringSchemaConstsAndPatterns({ schema, options, splitToRawDNF, }: { schema: JSONSchema; options: InternalOptions; splitToRawDNF: SplitToRawDNF; }): IsStringWithConstsOrPatternsResult; export declare function retrieveStringSchemaConstsAndPatternsFromRawDNF(dnf: RawDNF, options: InternalOptions): IsStringWithConstsOrPatternsResult;