Aquila169 / zod-express-middleware

Express middleware to validate requests using zod schema's.
MIT License
82 stars 13 forks source link

Usage of safeParseAsync() #10

Open v4ssili opened 1 year ago

v4ssili commented 1 year ago

Hello, we're aiming to use async transformation steps in the zod validation within the middleware and we're getting the following error:

"message": "Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead."

https://github.com/colinhacks/zod#async-transforms

Would it be possible to enhance the processRequestBody etc. functions to allow for those async zod parse calls? or add new ones that use the safeParseAsync function from zod?

pshaddel commented 1 year ago

@v4ssili In case you still did not find a work around I forked it and fixed this issue and some others. Check it out: https://github.com/pshaddel/zod-express

v4ssili commented 1 year ago

thank you @pshaddel that's awesome!