Does anyone know why we decided to go with zod for the new validators?
We were using joi before - and still pretty extensively in the whole codebase - but I guess there must have been some drawbacks to that?
Is it mostly just about typing and zod providing properly typed objects and schemas?
I'm wondering if it wouldn't make sense to switch everything over to something natively compatible with JSON Schema like https://github.com/sinclairzx81/typebox.
That way it should be a lot simpler to generate an overall config schema for editor autocompletion and also to have a single standardized way of generating reference docs.
I guess what it doesn't have is the functionality to validate, parse and convert in one go, which is quite nice.
07/20/2023, 3:14 PM
Zod is very much a considered choice, but I'll confess I had no idea typebox existed. It also seems fine by me, not sure without a deeper dive whether it's worth moving from Zod. It is possible (via 3rd party libraries) to convert Zod schemas to JSON Schemas, even though it's not explicitly designed to map cleanly across.
Joi is basically a non-starter for a public SDK because it is not at all designed for TypeScript and requires separate typing, which is awful DX. And even internally, it's an endless source of bugs because of the separate typing.
If we do want to switch from zod to typebox, now would be the time 🙂 In looking into it, I'd want to make sure we're able to refine types and customize to some degree.