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

12 lines 472 B
import { AllOfSchema } from '../atomic-schema/index.js'; import { isJSONSchema } from '../json-schema/index.js'; import { isArrayOf } from '../utils/type-guards/index.js'; export const allOfExtraction = { extract: ({ schema: { allOf }, split }) => { if (!isArrayOf(isJSONSchema)(allOf) || allOf.length === 0) { return true; } return new AllOfSchema(allOf.map((schema) => split(schema))); }, }; //# sourceMappingURL=all-of.js.map