Re:Parse, Don't Validate – In a Language That Doesn't Want Y...
by sheept on Tuesday June 30, 2026 @11:21AM
(#48734027)
What you're doing is essentially what Zod is designed to avoid. If you tolerate needing a separate build step more than having to define types with Zod's syntax, then it makes sense not to use Zod since it's not made for you.
[ Parent
| on HN ]
Re:Parse, Don't Validate – In a Language That Doesn't Want Y...
by Xenoamorphous on Tuesday June 30, 2026 @11:54AM
(#48734538)
To me the build step is a good thing. It's a simple script in npm, and it means I only keep what I need (the JSON Schema, which I don't need at dev time) in runtime and whatever package generates those schemas out of TS types can remain as a dev dependency.
zod can't be a dev only dependency, and you have to deal with breaking changes and maybe switching to a completely different library in a few years (joi, with a syntax very similar to zod's, was very popular a while ago too).
Re:Parse, Don't Validate – In a Language That Doesn't Want Y...
by Lvl999Noob on Tuesday June 30, 2026 @12:17PM
(#48734901)
How would you use zod as a dev-only dependency? The whole point there is to be a parser. If you remove it from runtime then you are not parsing the production payloads, which is the exact place where you do need to parse them.