4 ms·
Python keeps the types at runtime, that's why no TypeScript framework will have a developer experience anywhere near something like FastAPI.
by adhamsalama 2y ago
Python keeps the types at runtime, that's why no TypeScript framework will have a developer experience anywhere near something like FastAPI.
- code_biologist 2y agoFirst party runtime types would be nice, but zod has become pretty much the standard answer for projects that need it. Not complicated.
- adhamsalama 2y agoTell me how to have automatic documentation and validation like FastAPI using anything in Node.js and I will use it immediately. Note: NestJS isn't it.
- code_biologist 2y agoDo OpenAPI Swagger docs count? That seems to be the route a ton of the ecosystem takes. 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`.
- BoorishBears 2y agoIt's doable if you really want to: https://docs.nestjs.com/openapi/cli-plugin#overview https://docs.nestjs.com/openapi/cli-plugin#overview (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-validation https://docs.nestjs.com/techniques/validation#auto-validatio...)
- adhamsalama 2y agoI do use this. It's not as seamless as using FastAPI. Also not as type-safe as FastAPI. 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.