Hacker News new | ask | show | jobs
by coffexx 2309 days ago
We have a few TypeScript projects where I work at, one of them in particular had to ingest data from a large number of our internal APIs and do some crunching with it.

Validation of this data was essential, the crunching was complicated, and we wanted to be able to make assumptions about the data through the type system to make the code simpler.

We found JSONSchema validation was a perfect fit for this purpose (via ajv). In all the overhead of maintaining JSONSchema files was much lower than we thought it would be, and it even exposed some bugs in our internal APIs that we patched up at the same time.

I do wish there was a nice way to generate that sort of validation code directly from a TypeScript interface though.