在 swagger-swashbuckle UI 中仅显示选定的控制器 [英] Show only selected controllers in swagger-swashbuckle UI

查看:37
本文介绍了在 swagger-swashbuckle UI 中仅显示选定的控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am currently using swagger in my project and i have more than 100 controllers there. I guess due to the large number of controller, swagger UI documentation page takes more than 5 min to load its controller. Is it possible to select specific controllers at the UI page and load options for them only? Or else there are other methods to load UI page faster? Help me!

推荐答案

您可以在任一控制器上使用 ApiExplorerSettings 来完全忽略控制器或方法.

you can use ApiExplorerSettings on either controller to ignore a controller completely or on a method.

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

这篇关于在 swagger-swashbuckle UI 中仅显示选定的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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