schemantic
Version:
A fully typed, extensible TypeScript type generator for FastAPI OpenAPI schemas
64 lines • 1.87 kB
TypeScript
/**
* Advanced Zod Validation Plugin
*
* Generates Zod schemas from OpenAPI specifications for runtime validation.
* Implements sophisticated type-level validation mapping with performance optimizations.
*
* Key Features:
* - Type-safe request/response validation pipelines
* - Performance-optimized validation caching
* - Branded type integration for compile-time safety
* - Runtime type guard generation
*
* Architecture:
* - Schema transformation with memoization
* - Lazy evaluation for expensive operations
* - Memory-efficient validation cache management
*/
import { SchemanticPlugin } from "../types/core";
type ZodType<T = unknown> = {
parse(data: unknown): T;
safeParse(data: unknown): {
success: true;
data: T;
} | {
success: false;
error: {
issues: Array<{
path: (string | number)[];
message: string;
code?: string;
}>;
};
};
pipe<U>(schema: ZodType<U>): ZodType<U>;
};
/**
* Advanced Zod Validation Plugin Implementation
*/
export declare const zodValidationPlugin: SchemanticPlugin;
export declare function memoizedValidation<T>(data: unknown, schema: ZodType<T>, cacheKey?: string, schemaVersion?: string): T;
/**
* Get performance statistics for the plugin
*/
export declare function getZodValidationPerformanceStats(): Record<string, {
avg: number;
min: number;
max: number;
count: number;
}>;
/**
* Clear performance metrics and caches
*/
export declare function clearZodValidationCaches(): void;
/**
* Get validation cache statistics for monitoring
*/
export declare function getValidationCacheStats(): {
size: number;
maxSize: number;
hitRate?: number;
averageAccessTime?: number;
};
export default zodValidationPlugin;
//# sourceMappingURL=zod-validation.d.ts.map