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

36 lines (35 loc) 1.42 kB
import type { JSONSchema } from '../json-schema/index.js'; import type { Options } from '../options/index.js'; /** * Tries to determine whether the provided schema accepts any JSON value. In * that case, the schema would be equivalent to the `true` or `{}` schema. * * @returns The [limitations](https://github.com/jobohner/json-schema-describes-subset/blob/v0.4.0/docs/README.md#limitations) concerning false negative * `null` results apply here. * * @example 🚧TODO🚧 * * @remarks Use cases * * Can't think of any 🤷‍♂️. This function was created only because it was so easy * to do so. * */ export declare function schemaDescribesUniverse(schema: JSONSchema, options?: Options | undefined): boolean | null; /** * Tries to determine whether the provided schemas accept the exact same set of * data values. * * @returns The [limitations](https://github.com/jobohner/json-schema-describes-subset/blob/v0.4.0/docs/README.md#limitations) concerning false negative * `null` results apply here. * * @example 🚧TODO🚧 * * @remarks Use cases * * One possible use case could be: If you are creating a tool that transforms a * JSON Schema to another representation (like {@link toDNF}), this function * could be useful to help create tests. * */ export declare function schemasAreEquivalent(schemaA: JSONSchema, schemaB: JSONSchema, options?: Options | undefined): boolean | null;