tekir
All Packages
Securityv0.1.5

@tekir/validator

Request validation middleware with Zod integration.

Installation

$bun add @tekir/validator

Features

  • Works with Zod, Yup, Valibot, or plain functions
  • validate() middleware for route-level validation
  • ValidationError with per-field error messages
  • 422 status code with structured JSON errors
  • Async schema support via parseAsync

Quick Example

TypeScript
import { validate } from '@tekir/validator'
import { z } from 'zod'

const schema = z.object({
  email: z.string().email(),
  password: z.string().min(6),
})

app.router.post('/register', [validate(schema)], handler)

Changelog

v0.1.5LatestSeptember 16, 2026
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.4July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.3July 16, 2026
  • Validation middleware supports safeParse and safeParseAsync schemas and commits transformed request data only after the full validation succeeds.
v0.1.2June 13, 2026
  • Validated data is now written to the context only after every source has passed, so a failure on one source can no longer leave a partially-validated request in place.
  • An unrecognized schema shape now throws (fail-closed) instead of silently passing the request through unvalidated.
  • Valibot schema detection is now reliable and ordered ahead of Zod, fixing a dead branch.
  • Found and fixed with Fable.
v0.1.0April 1, 2026
  • Initial release

Other Security packages