Skip to content

Zod v4 Beta Support #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kylekirkby opened this issue Apr 12, 2025 · 5 comments
Open

Zod v4 Beta Support #173

kylekirkby opened this issue Apr 12, 2025 · 5 comments

Comments

@kylekirkby
Copy link

Hi all,

Any chance anyone has put any thought into supporting Zod v4 considering the awesome perf boost that v4 offers

It would be great to get this project a beta version out which implements the breaking changes introduced in v4.

https://v4.zod.dev/v4

Cheers!

Kyle

@tadhglewis
Copy link

Is this needed as Zod natively supports JSON schema now? https://v4.zod.dev/json-schema

@StefanTerdell
Copy link
Owner

I was hoping to use v4 to break away from the major/minor-lockstep versioning into actual semver, and refactor the entire project with some much needed breaking changes, but as tadhglewis mentioned the native support kinda makes that project moot. On the other hand, v4 is still in beta, and I'm not actually sure what level of customization etc. the built-in functionality offers. In other words, there might be a raison d'être for a separate library like this, but we'll have to wait and see.

In the meantime I won't be putting any of my time or energy into it.

@AndrewIngram
Copy link

It might be useful just as a compat step to make upgrading easier, i.e. it'd be nice to be able to upgrade Zod without upgrading all the places we currently use zod-to-json-schema (at the same time). But appreciate that's not exactly a strong motivation for you to put work in here.

@colinhacks
Copy link
Contributor

I strongly encourage you to bump the version and continue maintaining this! Many people will want a hassle-free migration path, while also getting the perf benefits of Zod 4. The new z.toJSONSchema is a totally different set of options. I'm trying to keep it extremely minimal, and point people towardsoverride for the vast majority of customization needs.

Ultimately there aren't a ton of changes in terms of schema types & internal structure so I don't think a refactor would be too painful. 😅

@wenerme
Copy link

wenerme commented Apr 18, 2025

xref colinhacks/zod#4074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants