c# - 在 swagger-swashbuckle UI 中仅显示选定的 Controller

标签 c# swagger swagger-ui swashbuckle

我目前在我的项目中使用 swagger,并且那里有超过 100 个 Controller 。我猜由于 Controller 数量较多,swagger UI 文档页面需要超过 5 分钟才能加载其 Controller 。是否可以在 UI 页面选择特定 Controller 并仅为它们加载选项? 或者还有其他方法可以更快地加载 UI 页面吗? 帮助我!

最佳答案

您可以在任一 Controller 上使用 ApiExplorerSettings 来完全忽略 Controller ,也可以在方法上使用 ApiExplorerSettings。

[ApiExplorerSettings(IgnoreApi = true)]
public class MyController
{
    [ApiExplorerSettings(IgnoreApi = true)]
    public string MyMethod
    {
      ...
    }
}

关于c# - 在 swagger-swashbuckle UI 中仅显示选定的 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41757920/

相关文章:

java - Swagger ui 显示重复的模型变量

c# - 如何使 C# 类的 Object 属性可选?

asp.net - ASP.NET Web Api 中的 Swashbuckle 被嵌套 Controller 混淆

c# - Swagger 2.0 不支持 : Multiple operations with path 'api/Client' and method 'GET'

rest - 使用Swagger将数组指定为参数

swagger - Azure Functions 和 Swagger UI - 如何在 swagger UI 中显示查询字符串参数?

c# - 使用 LINQ to SQL 简单级联删除自引用表

c# - 在没有窗口的 WPF 应用程序中处理命令

c# - Identity 2.1.0 中未找到 SigninManager 类

java - 无法使用 Springfox 2.9.2 从 Swagger-UI 发送授权 token