Zod 4 Beta out now

This is not my package update to announce, but recently Zod 4’s beta was announced:

…along with a swanky new docs site!

This might impact:

  • zodern:relay
  • jam:method
  • pmogollons:zod-schema
  • vazco/uniforms
  • EDIT: collections2?
  • and others…

I swear there was another package out there that recently introduced Zod support (I checked Collections2 and Autoform and it doesn’t seem to be them, maybe I’m imagining things) It was Collections2…

The breaking changes don’t look that severe, but I’m pretty sure a lot of refactoring was done.

Essentially performance, both in terms of runtime type checking and TypeScript type inference, should be improved. Some design ideas were adapted from Valibot to create a tree-shakeable API for frontends (probably would require jorgenvatle:vite at the moment to tree-shake properly?). And from the new docs it seems Standard Schema gets a few mentions which might be of interest in the Meteor community since we have usage split between meteor/check, simpl-schema, jam:easy-schema and zod (amongst others).

One thing I’m personally interested in is the new metadata registry + the inbuilt z.toJSONSchema() method :smiley: . As a community, we could use that as in jam:easy-schema to add JSON Schema validation to our MongoDB collections, and personally, I’m interested in somehow bolting validation and OpenAPI docs onto the meteor/webapp package.

5 Likes

Thanks for the heads up :+1:
I still have to look into it to figure out if there’re much work involved.

1 Like