如何在 Servicestack 的 Swagger UI 中隐藏端点? [英] How can I hide endpoints from Swagger UI in Servicestack?
本文介绍了如何在 Servicestack 的 Swagger UI 中隐藏端点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是 ServiceStack 3.9.59.0 的 Swagger 插件.我的 ServiceStack API 中有一些端点,例如/selfchecknode,我不想在 Swagger UI 中显示这些端点.
I'm using the Swagger plugin for ServiceStack 3.9.59.0. I have a few endpoints, for example /selfchecknode, in my ServiceStack API that I don't want to show up in the Swagger UI.
是否有一种声明方式,也许是通过合同属性,我可以使用它来隐藏特定端点,使其不显示在 Swagger 中?
Is there a declarative way, perhaps via a contract attribute, that I can use to hide specific endpoints from showing up in Swagger?
推荐答案
安全文档 展示如何限制对 ServiceStack 的可见性和访问.因此,您可以使用以下命令将其隐藏起来,使其不可见:
The Security docs show how you can restrict visibility and access to ServiceStack. So you can hide it from being visible externally with:
[Restrict(VisibleInternalOnly = true)]
public class InternalAdmin { }
这篇关于如何在 Servicestack 的 Swagger UI 中隐藏端点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文