Skip to main content
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
47%
Published
2 weeks ago (1.0.0)
function zValidator
zValidator<
T extends ZodSchema,
Target extends keyof ValidationTargets,
E extends Env,
P extends string,
In = z.input<T>,
Out = z.output<T>,
I extends Input = { in: HasUndefined<In> extends true ? [K in Target]?: K extends "json" ? In : HasUndefined<keyof ValidationTargets[K]> extends true ? [K2 in keyof In]?: ValidationTargets[K][K2] : [K2 in keyof In]: ValidationTargets[K][K2] : [K in Target]: K extends "json" ? In : HasUndefined<keyof ValidationTargets[K]> extends true ? [K2 in keyof In]?: ValidationTargets[K][K2] : [K2 in keyof In]: ValidationTargets[K][K2]; out: [K in Target]: Out; },
V extends I = I,
>
(
target: Target,
schema: T,
hook?: Hook<z.infer<T>, E, P>,
): MiddlewareHandler<E, P, V>

Type Parameters

T extends ZodSchema
Target extends keyof ValidationTargets
E extends Env
P extends string
In = z.input<T>
Out = z.output<T>
I extends Input = { in: HasUndefined<In> extends true ? [K in Target]?: K extends "json" ? In : HasUndefined<keyof ValidationTargets[K]> extends true ? [K2 in keyof In]?: ValidationTargets[K][K2] : [K2 in keyof In]: ValidationTargets[K][K2] : [K in Target]: K extends "json" ? In : HasUndefined<keyof ValidationTargets[K]> extends true ? [K2 in keyof In]?: ValidationTargets[K][K2] : [K2 in keyof In]: ValidationTargets[K][K2]; out: [K in Target]: Out; }
V extends I = I

Parameters

target: Target
schema: T
optional
hook: Hook<z.infer<T>, E, P>

Return Type

Add Package

deno add @nik-kita/hono-zod-middleware-monkey-patch

Import symbol

import { zValidator } from "@nik-kita/hono-zod-middleware-monkey-patch";

Add Package

npx jsr add @nik-kita/hono-zod-middleware-monkey-patch

Import symbol

import { zValidator } from "@nik-kita/hono-zod-middleware-monkey-patch";

Add Package

yarn dlx jsr add @nik-kita/hono-zod-middleware-monkey-patch

Import symbol

import { zValidator } from "@nik-kita/hono-zod-middleware-monkey-patch";

Add Package

pnpm dlx jsr add @nik-kita/hono-zod-middleware-monkey-patch

Import symbol

import { zValidator } from "@nik-kita/hono-zod-middleware-monkey-patch";

Add Package

bunx jsr add @nik-kita/hono-zod-middleware-monkey-patch

Import symbol

import { zValidator } from "@nik-kita/hono-zod-middleware-monkey-patch";