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).
39 lines (38 loc) • 1.35 kB
TypeScript
import { AtomicSchemaObject, type LogicalCombinationOfLiterals } from '../../atomic-schema/index.js';
import type { ExtractionPlugin, ConjunctionSchema, SimplificationPluginArguments } from '../../plugin/index.js';
export declare class MinimumAtomicSchema extends AtomicSchemaObject {
readonly minimum: number;
constructor(minimum: number);
negate(): LogicalCombinationOfLiterals;
toJSONSchema(): {
minimum: number;
};
}
export declare class MaximumAtomicSchema extends AtomicSchemaObject {
readonly maximum: number;
constructor(maximum: number);
negate(): LogicalCombinationOfLiterals;
toJSONSchema(): {
maximum: number;
};
}
export declare const numberExtraction: ExtractionPlugin;
export type NumberConjunctionSchema = {
minimum?: number;
maximum?: number;
multipleOf?: number;
allOf?: ({
not: {
multipleOf: number;
};
} | {
not: {
const: number;
};
})[];
};
export declare const numberSimplification: {
readonly appliesToJSONSchemaType: "number";
readonly mergeableKeywords: ["minimum", "maximum", "multipleOf"];
readonly simplify: ({ atomicSchemasByConstructor, negatedAtomicSchemasByConstructor, validateConst, }: SimplificationPluginArguments) => ConjunctionSchema<NumberConjunctionSchema>;
};