使用Swashbuckle.AspNetCore.SwaggerGen 生成 ASP.NET Core2 WebAPI 在线文档

目录

Swagger的作用

怎么生成API文档

怎么生成文档中的注释说明?

文档中去调用API

隐藏想隐藏的API

接口分组


Swagger的作用

在我们开发WebAPI 时 通常需要为调用我们API的客户端提供说明文档。Swager 就是这样的一个 工具,它能生成漂亮的API文档和提供在线调用的页面。

 

Swashbuckle.AspNetCore 中分为3个组件,我们可以使用其中一个或多个。

Package Description
Swashbuckle.AspNetCore.Swagger Exposes SwaggerDocument objects as a JSON API. It expects an implementation of ISwaggerProvider to be registered which it queries to retrieve Swagger document(s) before returning as serialized JSON
Swashbuckle.AspNetCore.SwaggerGen Injects an implementation of ISwaggerProvider that can be used by the above component. This particular implementation automatically generates SwaggerDocument(s) from your routes, controllers and models
Swashbuckle.AspNetCore.SwaggerUI Exposes an embedded version of the swagger-ui. You specify the API endpoints where it can obtain Swagger JSON and it uses them to power interactive docs for your API

 

本文使用Swashbuckle.AspNetCore.SwaggerGen 3.0 版本来生成API文档。

怎么生成API文档

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值