Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger WebApi create json on build

Is there any way to create the swagger json during the build task of my web api? I want to use the json to feed it into a code generator and generate a typescript definition file.

Any help is more than welcome!

like image 457
Domenic Avatar asked Oct 22 '15 14:10

Domenic


1 Answers

You can use the NSwag command line tools like this:

nswag.exe webapi2swagger /assembly:"path/to/assembly.dll" /output:"path/to/swagger.json"

This generates a Swagger specification with for all controllers in the given DLL.

For more information read this page.

like image 117
Rico Suter Avatar answered Oct 18 '22 19:10

Rico Suter