by adhamsalama · 1y ago · 0 comments
(Also doable without a compiler step, but since it's TS one more compiler step isn't the end of the world: https://docs.nestjs.com/techniques/validation#auto-validatio...)
You can simply type a class variable as an int while the validation decorator works on a completely different type. It's an illusion of type safety.
Note: NestJS isn't it.
trpc, ts-rest, and express-zod-api all explicitly build on zod and can do validation + Swagger UI generation.
hono looks like it doesn't do that by default, but single-source-of-truth validation + Swagger UI are available as middleware via `@hono/zod-openapi`.