3 ms·
I think the idea is that you validate the data once, on an API level. You don't need to validate the same data again after the initial inspection. In our team
by sakarisson 6y ago
I think the idea is that you validate the data once, on an API level. You don't need to validate the same data again after the initial inspection.
In our team we use io-ts to validate all of our endpoints, but simple type guards could achieve the same goal.
https://github.com/gcanti/io-ts https://github.com/gcanti/io-ts
- adriancooney 6y agoRuntypes is another excellent alternative. Highly recommend. https://github.com/pelotom/runtypes https://github.com/pelotom/runtypes
- Lunrtick 6y agoI've also been using Zod for the same purpose - they've got a nice comparison section that included io-ts https://github.com/colinhacks/zod#comparison https://github.com/colinhacks/zod#comparison