一、控制器描述
創建一個過濾器類 AuthTagDescriptions,內容如下:
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ZanLveCore { public class AuthTagDescriptions : IDocumentFilter { public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context) { swaggerDoc.Tags = new List<Tag> { new Tag{ Name="Common",Description="授權中心接口"}, }; } } }
更改Swagger配置文件
options.DocumentFilter<AuthTagDescriptions>();
效果: