-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
How can I specify the format? #95
Comments
From what I can tell there's no native way to do that in Zod. You can open an issue or a PR in the Zod repo to add something like |
I'd convert these to binary: z.instanceof(File)
z.instanceof(Buffer)
z.instanceof(Blob) |
There's no way to serialize an instanceof check unfortunately, and you're not describing the serialized data with that schema anyway. The base64 route is probably your best bet still |
Added a PR over at Zod for a base64 check. I guess we'll see how that goes :) colinhacks/zod#3047 |
Hello! A solution to this is now available as of 3.23.0. Since the schema is interpreted to represent the serialized data you can use |
Hey Stefan, this is great! Finally we can represent this type with Zod! |
I want to specify a file upload format like described in https://swagger.io/docs/specification/describing-request-body/file-upload/ which needs to be
binary
. Is it possible to do this?The text was updated successfully, but these errors were encountered: