node-blaze
Version:
Bindings to blaze, high-performance C++ JSON Schema validator
31 lines • 1.05 kB
TypeScript
type Schema = object;
type ObjectToValidate = unknown;
type ValidationResult = {
valid: boolean;
errors: {
message: string;
instanceLocation: string;
evaluatePath: string;
schemaLocation: string;
}[];
};
export declare class Blaze {
#private;
/**
* Complies JSON Schema, cache internally compiled instructions, and then
* validates some value against provided JSON Schema.
* @param schema JSON Schema to compile.
* @returns Validation function.
*/
compile(schema: Schema): (objToValidate: ObjectToValidate) => ValidationResult;
/**
* Complies JSON Schema, cache internally compiled instructions,
* function that should be invoked with object to validate.
* @param schema JSON Schema to compile.
* @param objToValidate Value that should be validated.
* @returns `true` if validation pass, otherwise `false`.
*/
validate(schema: Schema, objToValidate: ObjectToValidate): ValidationResult;
}
export {};
//# sourceMappingURL=blaze.d.ts.map