Paste a segment track JSON payload and get a Zod z.object schema you can run inside your handler. Same shape walker as the TypeScript-mode page, but the output is a runtime-validated schema with .optional() on missing fields and z.union for nullables.
Segment track calls land in your warehouse via a destination — a parse at the destination catches a marketing team renaming a property (order_id vs orderId, total vs revenue) before the rename corrupts your fact table.
Segment Functions and warehouse destinations are JavaScript but server-side; Zod's wider ecosystem (drizzle-zod for the warehouse insert, zod-form-data for the dashboard form that edits the schema) compounds beyond just the parse. The output is a copy-paste-runnable z.object using only standard Zod primitives (z.string, z.number, z.array, z.union, .optional). Drop it into your handler, run schema.parse(body), and the rest of your code consumes a strongly typed value with no ambient unknowns.