Thanks! Sure - let me get this right - tsoa generates a swagger spec for an API written in nodejs/TypeScript? And then one could use the same TypeScript types on the frontend in order to avoid a mismatch?
Yup, but tsoa additionally does validation at runtime so that the data that comes in is exactly what the types say. Think of it as an automatic io-ts for every route on your NodeJS service! :)
It keeps the garbage data out so your types are never a lie. And it saves tons of code.
Great article. Would you mind also adding
tsoa
to the list of codegen tools?Thanks! Sure - let me get this right -
tsoa
generates a swagger spec for an API written innodejs/TypeScript
? And then one could use the same TypeScript types on the frontend in order to avoid a mismatch?Yup, but tsoa additionally does validation at runtime so that the data that comes in is exactly what the types say. Think of it as an automatic io-ts for every route on your NodeJS service! :)
It keeps the garbage data out so your types are never a lie. And it saves tons of code.
Sounds great! I almost feel it's a shame we have our API in F# :)
I've added a sentence about tsoa, thanks again for the tip!