Usage with Conform library (raw FormData input)
Kamahl19 opened this issue · 4 comments
Hey, thanks for the great library. I would like to use it together with the Conform library which is a great alternative to react-hook-form. However Conform library does its own transformation of FormData to json and schema validation (https://conform.guide/api/zod/parseWithZod).
I suppose I would need something like .input(undefined, { type: 'raw' })
which would simply pass the unprocessed input to the handler. There I would use the FormData and pass it to the Conform library.
I would appreciate this solution as well.
I'm curious if .input(z.custom<FormData>())
would work instead of raw?
@IdoPesok That's a good point but it's not enough. Due to this line
zsa/packages/zsa/src/zod-safe-function.ts
Line 726 in 5e1fbc7
raw
type to bypass that.
If you see a value in this, I would be happy to make a PR, whatever we agree on. I guess you might have a better idea to solve this, maybe something more idiomatic than raw
.