Swagger WebApi在构建时创建json [英] Swagger WebApi create json on build
本文介绍了Swagger WebApi在构建时创建json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Web API的构建任务期间,有什么方法可以创建swagger json吗?我想使用json将其输入代码生成器并生成一个打字稿定义文件.
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.
欢迎任何帮助!
推荐答案
您可以使用 NSwag 命令行工具:
You can use the NSwag command line tools like this:
nswag.exe webapi2swagger /assembly:"path/to/assembly.dll" /output:"path/to/swagger.json"
这将为给定DLL中的所有控制器生成一个Swagger规范.
This generates a Swagger specification with for all controllers in the given DLL.
有关更多信息,请阅读此页面.
这篇关于Swagger WebApi在构建时创建json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文