fastify-type-provider-zod
Version:
Zod Type Provider for Fastify@5
31 lines (30 loc) • 1.22 kB
TypeScript
import { type FastifyErrorConstructor } from "@fastify/error";
import type { FastifyError } from "fastify";
import type { FastifySchemaValidationError } from "fastify/types/schema";
import type { z } from "zod/v4";
export declare const InvalidSchemaError: FastifyErrorConstructor<{
code: string;
}, [string]>;
declare const ZodFastifySchemaValidationErrorSymbol: symbol;
export type ZodFastifySchemaValidationError = FastifySchemaValidationError & {
[ZodFastifySchemaValidationErrorSymbol]: true;
};
declare const ResponseSerializationBase: FastifyErrorConstructor<{
code: string;
}, [{
cause: z.ZodError;
}]>;
export declare class ResponseSerializationError extends ResponseSerializationBase {
method: string;
url: string;
cause: z.ZodError;
constructor(method: string, url: string, options: {
cause: z.ZodError;
});
}
export declare function isResponseSerializationError(value: unknown): value is ResponseSerializationError;
export declare function hasZodFastifySchemaValidationErrors(error: unknown): error is Omit<FastifyError, "validation"> & {
validation: ZodFastifySchemaValidationError[];
};
export declare function createValidationError(error: z.ZodError): ZodFastifySchemaValidationError[];
export {};