@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
24 lines • 1.18 kB
TypeScript
import type { JSONSchema7 } from 'json-schema';
import type { BatchValidationResult } from './errors.js';
/** Schema validator with compilation caching */
export declare class SchemaValidator {
private cache;
/** Get or compile validator for schema */
private getValidator;
/** Clear cached validator (call when schema changes) */
clearCache(cacheKey: string): void;
/** Validate data against schema */
validate(data: unknown, schema: JSONSchema7, field: 'input' | 'groundTruth', cacheKey: string): void;
/** Validate multiple items, returning valid/invalid split */
validateBatch(items: Array<{
input: unknown;
groundTruth?: unknown;
}>, inputSchema: JSONSchema7 | null | undefined, outputSchema: JSONSchema7 | null | undefined, cacheKeyPrefix: string, maxErrors?: number): BatchValidationResult;
/** Format Zod errors to FieldError array */
private formatErrors;
}
/** Get or create validator instance */
export declare function getSchemaValidator(): SchemaValidator;
/** Create new validator (for testing) */
export declare function createValidator(): SchemaValidator;
//# sourceMappingURL=validator.d.ts.map