5 ms·
We're currently evaluating both Zod and ArkType as a replacement for earlier JSON schema validations. The thing I can't get over with Zod is the syntax is _so_
by neilpa 1y ago
We're currently evaluating both Zod and ArkType as a replacement for earlier JSON schema validations. The thing I can't get over with Zod is the syntax is _so_ different from defining TS types.
Are there reasons to go with Zod over ArkType?
- CharlieDigital 1y agoYou might like Typia better. I recently put together a deck for this after some investigation: https://docs.google.com/presentation/d/1fToIKvR7dyvQS1AAtp4YuSwN6qi2kj_GBoIEJioWyTM/edit?usp=sharing https://docs.google.com/presentation/d/1fToIKvR7dyvQS1AAtp4Y...
- fkyoureadthedoc 1y agoOn the ArkType website they talk about speed and DX, but no mention of bundle size. I assume, and maybe this is an unfair assumption, that's because it's bad. I haven't come across ArkType until just now, but I was just checking out Valibot today because it's got a small bundle size.
- rafram 1y agohttps://bundlephobia.com/package/arktype@2.1.20 https://bundlephobia.com/package/arktype@2.1.20: 38.3 KB https://bundlephobia.com/package/zod@3.24.4 https://bundlephobia.com/package/zod@3.24.4: 64.3 KB https://bundlephobia.com/package/valibot@1.1.0 https://bundlephobia.com/package/valibot@1.1.0: 84.1 KB
- colinmcd 1y agoThese numbers don't reflect anything useful. This is the total size of the code in the package, most of which will be tree-shaken. In Zod's case, the package now contains three independent sub-libraries. I recommend plugging a script into bundlejs.com[0] to see bundle size numbers for a particular script [0] https://bundlejs.com https://bundlejs.com
- petesergeant 1y agoEveryone else is using Zod so the LLMs understand it well, there’s a big ecosystem, it’s unlikely to disappear overnight, and new hires may well already use it. It’s the boring solution.
- satvikpendem 1y agoWe also chose ArkType after evaluating Zod, Valibot, and Effect Schema, among others. It seemed to have the best developer experience while also being much faster. It also supports the Standard Schema project which I believe Effect Schema does not fully support.
- bjacobso 1y agoI believe Effect Schema fully supports Standard Schema, the issue is that it supports much more than Standard Schema, so not all schemas will work and thus provide compile time errors.
- satvikpendem 1y agoYes that's correct, it's more powerful but we wanted to maintain full compatibility just for the future as well. But if you're all in on the Effect ecosystem, it's quite nice.
- sesm 1y agoDoes ArkType support generating data from schema?
- mapcars 1y agoCould you elaborate on how exactly do you use these? I was assuming its for some kind of contract testing, but there are mentions of bundle size, is it used on fetching data to fail early if the format is wrong, something like that?