Swagger WebApi 在构建时创建 json [英] Swagger WebApi create json on build

查看:13
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆