Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating swagger docs from typescript interfaces

I'm using swager-jsdoc to document all the DTOs of the app.

I was wondering is there any way to generate the swagger docs automatically from typescript interfaces.

I have a lot of them in the project and also a lot of mongoose schemas and models. It is getting tedious to keep them in sync. On the other hand I do not want to use the swagger generation tools. I prefer the bottom-up approach.

Cheers

like image 478
Adrian Moisa Avatar asked Dec 01 '18 12:12

Adrian Moisa


1 Answers

Yes, you can easily generate Swagger and OpenAPI documents from your TypeScript types by using tsoa. The readme contains all of the setup information that you would need to start using it. It's compatible with express, hapi, koa, and more:

https://github.com/lukeautry/tsoa


(Full Transparency: I am one of the maintainers of tsoa. But I was first a consumer of tsoa and I find it to be a great product... that's why I asked to help maintain it! :) )

like image 198
GreeneCreations Avatar answered Sep 29 '22 00:09

GreeneCreations