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

59 lines 2.22 kB
import { arrayExtraction, arraySimplification } from './array.js'; import { constExtraction, constSimplification } from './const.js'; import { ifThenElseExtraction } from './if-then-else.js'; import { numberExtraction, numberSimplification } from './number/index.js'; import { objectExtraction, objectSimplification } from './object/index.js'; import { oneOfExtraction } from './one-of.js'; import { stringExtraction, stringSimplification } from './string.js'; import { typeExtraction } from './type.js'; import { notExtraction } from './not.js'; import { allOfExtraction } from './all-of.js'; import { anyOfExtraction } from './any-of.js'; import { refExtraction, refSimplification } from './ref.js'; export * from './all-of.js'; export * from './any-of.js'; export * from './not.js'; export * from './const.js'; export * from './type.js'; export * from './number/index.js'; export * from './string.js'; export * from './array.js'; export * from './object/index.js'; export * from './ref.js'; export * from './if-then-else.js'; export * from './one-of.js'; export const builtInExtractionPlugins = { not: notExtraction, allOf: allOfExtraction, anyOf: anyOfExtraction, type: typeExtraction, const: constExtraction, number: numberExtraction, string: stringExtraction, object: objectExtraction, array: arrayExtraction, ifThenElse: ifThenElseExtraction, oneOf: oneOfExtraction, ref: refExtraction, }; export function getBuiltInExtractionPlugins(overrides) { const moreGeneralOverrides = overrides; return Object.entries(builtInExtractionPlugins).map(([id, plugin]) => { return moreGeneralOverrides[id] ?? plugin; }); } export const builtInSimplificationPlugins = { const: constSimplification, number: numberSimplification, string: stringSimplification, object: objectSimplification, array: arraySimplification, ref: refSimplification, }; export function getBuiltInSimplificationPlugins(overrides) { const moreGeneralOverrides = overrides; return Object.entries(builtInSimplificationPlugins).map(([id, plugin]) => { return moreGeneralOverrides[id] ?? plugin; }); } //# sourceMappingURL=built-in-plugins.js.map