honojs / middleware

monorepo for Hono third-party middleware/helpers/wrappers
https://hono.dev
421 stars 144 forks source link

Middleware & zod validator problem #743

Open amit548 opened 1 week ago

amit548 commented 1 week ago

image

I am trying to add prop value from middleware but when I use zValidator middleware to validate the param I found c.get & c.set showing some errors, I do the same without zValidator and I found c.get & c.set works well, I did not understand what wrong.

image

The defined types are missing after using zValidator for middleware.

amit548 commented 1 week ago

image

And also I want to clarify that I cannot use c.req.valid("param") so I did use c.req.param("vendor")

amit548 commented 1 week ago

image

image

And I also tried the hook way, but showing this type of error

amit548 commented 1 week ago

image

Well I created a normal middleware and it works, but looking for some solution for zValidator

yusukebe commented 1 week ago

This is a known issue. Related to https://github.com/honojs/hono/issues/3202