zod-express-middleware icon indicating copy to clipboard operation
zod-express-middleware copied to clipboard

Usage of safeParseAsync()

Open v4ssili opened this issue 2 years ago • 2 comments

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?

v4ssili avatar Jan 27 '23 12:01 v4ssili

@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

pshaddel avatar Apr 06 '23 14:04 pshaddel

thank you @pshaddel that's awesome!

v4ssili avatar Apr 07 '23 11:04 v4ssili