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 { AnyOfSchema } from '../atomic-schema/index.js'; import { isJSONSchema } from '../json-schema/index.js'; import { isArrayOf } from '../utils/type-guards/index.js'; export const anyOfExtraction = { extract: ({ schema: { anyOf }, split }) => { if (!isArrayOf(isJSONSchema)(anyOf) || anyOf.length === 0) { return true; } return new AnyOfSchema(anyOf.map((schema) => split(schema))); }, }; //# sourceMappingURL=any-of.js.map