Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Zod 4 supports converting a Zod schema to JSON-Schema (natively, this has always been possible with 3rd-party libs).

One key difference is preprocessing/refine. With Zod, you can provide a callback before running validation, which is super useful and can't be represented in JSON. This comes in handy more often than you'd think - e.g converting MM/DD/YYYY to DD/MM/YYYY before validating as date.



Does it support the other way around too? I'd live to ditch AJV.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: