Skip to content

Support Zod v4 in zod-form-data#430

Merged
airjp73 merged 11 commits into
airjp73:mainfrom
chungweileong94:zod-v4
Apr 15, 2025
Merged

Support Zod v4 in zod-form-data#430
airjp73 merged 11 commits into
airjp73:mainfrom
chungweileong94:zod-v4

Conversation

@chungweileong94
Copy link
Copy Markdown
Contributor

@chungweileong94 chungweileong94 commented Apr 11, 2025

Support Zod v4 in zod-form-data, mostly type fixes.

TODOs

  • Fix tests

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
remix-validated-form-docs-v2 ❌ Failed (Inspect) Apr 15, 2025 3:29am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
remix-validated-form ⬜️ Ignored (Inspect) Visit Preview Apr 15, 2025 3:29am

@chungweileong94 chungweileong94 changed the title Support Zod v4 Support Zod v4 in zod-form-data Apr 11, 2025
@airjp73
Copy link
Copy Markdown
Owner

airjp73 commented Apr 11, 2025

Thanks for starting this! I hadn't realized it was already in beta.

The mini package looks pretty nice, too. I wonder if we would end up with a cleaner zod-form-data API if we added a set of helpers for that, too. (just thinking out loud -- we shouldn't do any of that in this PR).

@chungweileong94
Copy link
Copy Markdown
Contributor Author

The mini package looks pretty nice, too. I wonder if we would end up with a cleaner zod-form-data API if we added a set of helpers for that, too. (just thinking out loud -- we shouldn't do any of that in this PR).

I'm actually thinking about something even simpler where we could just provide a helper to parse the formdata to object upfront, just like how TRPC did with the recent formdata support https://github.com/trpc/trpc/blob/main/packages/server/src/unstable-core-do-not-import/http/formDataToObject.ts. With that the library might ended up something really light.

@airjp73
Copy link
Copy Markdown
Owner

airjp73 commented Apr 11, 2025

I'm actually thinking about something even simpler where we could just provide a helper to parse the formdata to object upfront, just like how TRPC did with the recent formdata support https://github.com/trpc/trpc/blob/main/packages/server/src/unstable-core-do-not-import/http/formDataToObject.ts. With that the library might ended up something really light.

The main utility of the library (for me at least) are helpers like zfd.checkbox & zfd.repeatable, rather than the FormData-to-object conversion itself (though that's important, too). I mostly use it in combination with RVF, which already does that anyway.

I'm definitely down to export a function to just do the conversion, but coming up with a nice api for the helpers is mainly where my thinking is at here.

@airjp73
Copy link
Copy Markdown
Owner

airjp73 commented Apr 13, 2025

I published 3.0.0-alpha.0 with the contents of this PR. I think there are a few more things I need to finish up before I can actually release this. But I am hoping to finish this up before the full release of v4.

@chungweileong94
Copy link
Copy Markdown
Contributor Author

Just bump to the latest Zod beta release. All the tests are green now.

@chungweileong94 chungweileong94 marked this pull request as ready for review April 14, 2025 02:58
@airjp73
Copy link
Copy Markdown
Owner

airjp73 commented Apr 15, 2025

Thanks for the work you put into this! I published the most recent changes as 3.0.0-alpha.1.

@airjp73 airjp73 merged commit 76c554e into airjp73:main Apr 15, 2025
2 of 4 checks passed
@chungweileong94 chungweileong94 deleted the zod-v4 branch April 15, 2025 14:04
airjp73 added a commit that referenced this pull request Apr 19, 2025
This reverts commit 76c554e, reversing
changes made to a5a5cfe.
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

Successfully merging this pull request may close these issues.

2 participants