Kaizen
Browse modulesFormsforms/sharedTypes

Type Alias: FormatValidators

type FormatValidators = Record<string, z.ZodType<string>>;

Defined in: shared/forms/build-zod-schema.ts:29

Registry mapping field.format strings to caller-supplied validators. Each entry is applied as a refinement on string-like fields (text, textarea, phone, number, and falls through for email/url where the built-in validator already runs first).

The package ships no formats of its own. Consumers bring what they need:

import { z } from "zod";
import { buildZodSchema } from "@the-kaizen-labs/taproot/forms/shared";

const formats = {
  zipcode: z.string().regex(/^\d{5}(-\d{4})?$/, "Invalid zip code"),
  phone: z.string().regex(/^\+?[\d\s()-]{7,}$/, "Invalid phone number"),
};

const schema = buildZodSchema(fields, { formats });