Zod schema validation wrapper

A Simple Wrapper Around Zod

December 2025 Article

I love working with Zod. It's been great for catching runtime validation issues and keeping our types in sync with actual data.

But after using it across a few projects, we ran into some practical issues. We didn't have a consistent way to log errors when validation failed, and sometimes we needed to temporarily disable strict validation in certain parts of the app without losing visibility into what was breaking.

What I built

I created a simple wrapper around Zod that gives us two things: consistent error logging and the ability to conditionally turn off validation when needed.

That's it. It's a thin layer that wraps Zod's parse methods, logs errors to our monitoring system (Sentry in our case), and respects some config flags for when we need validation turned off.

Why this helps

Every Zod error now gets logged consistently, so we can see exactly what's breaking and where. When we need to temporarily disable validation in certain scenarios, we can do that while still tracking what would have failed. This has been especially useful for legacy code that needs gradual improvement and for our QA environment where we don't want validation errors completely blocking testing.

Nothing fancy, just a practical solution for keeping error visibility while having more control over when validation actually blocks things.