@furystack/rest-service
Version:
Repository implementation for FuryStack
19 lines • 704 B
TypeScript
import type { Options } from 'ajv';
export declare class SchemaValidator<TSchema extends {
definitions: object;
}> {
private readonly schema;
private readonly ajv;
constructor(schema: TSchema, ajvOptions?: Options);
/**
* @param data The object to validate
* @param options Options for the schema validation
* @param options.schemaName The name of the type in the Schema Definitions
* @throws SchemaValidationError when the validation has been failed
* @returns true in case of validation success
*/
isValid<T>(data: any, options: {
schemaName: keyof TSchema['definitions'];
}): data is T;
}
//# sourceMappingURL=schema-validator.d.ts.map