目录
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文档。

本文介绍了如何使用Swashbuckle.AspNetCore.SwaggerGen为ASP.NET Core2 WebAPI生成在线文档。内容包括Swagger的作用、API文档的生成、注释说明的添加、调用API的实现、隐藏不想暴露的API以及接口按Tags分组的方法。

883

被折叠的 条评论
为什么被折叠?



