Every byte, validated
External data is unpredictable. AI models return malformed JSON. Webhooks send unexpected shapes. APIs change without warning. WISEROWS validates everything at the boundary — bad data never reaches your UI.
safeParse, never parse
WISEROWS uses Zod's safeParse() for every piece of external data. Unlike parse(), which throws exceptions that can cascade into crashes, safeParse returns a result object. Invalid data triggers fallback defaults — your UI stays intact.
- safeParse returns {success, data} or {success, error} — never throws
- Invalid fields get safe defaults: empty arrays, zero values, placeholder text
- Validation errors logged to Sentry with full context
- Schema violations never propagate to the rendering layer
- Type-safe validated data — TypeScript infers the correct type
- Works with nested objects, arrays, unions, and discriminated unions
AI response validation
AI models are probabilistic — they don't always return the exact structure you requested. WISEROWS defines strict Zod schemas for every AI response type and validates before rendering. Malformed completions get cleaned, not displayed raw.
- Structured output validation for Gemini, OpenAI, and Anthropic
- Schema defines expected shape — title, body, tags, metadata
- Missing fields receive sensible defaults based on context
- Partial responses are completed with fallback values
- Invalid types coerced where possible (string "42" → number 42)
- Complete validation failures trigger retry with adjusted prompt
One file, all schemas
Every validation schema lives in one centralized file. No scattered validation logic, no duplicate rules, no inconsistencies. TypeScript types are inferred directly from Zod schemas — the validation rule and the type are always in sync.
- All schemas in validators.ts — single source of truth
- Types inferred with z.infer<typeof Schema> — never hand-written
- Compose schemas with .extend(), .pick(), .omit()
- Enums and constants defined once as Zod enums
- No raw string literals — everything references shared constants
- Schema changes propagate to all consumers automatically
Defense at every boundary
WISEROWS validates data at the moment it crosses a trust boundary — not deep inside the application where a failure would be catastrophic. This defense-in-depth approach means invalid data is caught at the earliest possible point.
- Webhook payloads validated on receipt — before any processing
- API request bodies validated in the handler — before database writes
- Integration sync data validated per-record — one bad record never stops the batch
- User form input validated client-side and server-side
- AI responses validated before display — never render raw model output
How it feels
You never see broken data.
An AI model returns JSON with a missing field? You see a sensible default. A webhook sends an unexpected shape? It gets cleaned and processed. A CSV import has malformed rows? Valid rows import, broken ones get flagged. Your interface always shows clean, validated data — because nothing unvalidated ever reaches it.
