如何使用Swagger UI插件?
我正在研究一个项目,除其他外,它将自动为Python项目生成Swagger API。我注意到的一件事是,如果API需要curl
文本公开密码。由于到目前为止无法掩盖密码( https:// github。 com/swagger-api/swagger-ui/eskoy/5025 ),似乎最简单的事情就是简单地禁用curl
文本,以便我可以筛选我的Swagger API,而无需筛选我的Swagger Api暴露我的密码。
在另一期中( https://github.com/swagger.com/swagger-agger-appi/swagger-appi/swagger- ui/essess/5020 ),显示一个可以禁用卷曲文本的插件。
但是,我完全对如何实际导入和使用此插件感到困惑。关于如何编写插件的文档有很多文档,而没有关于如何导入它们的文档。我可以看到我可以使用 https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/ ,但我不知道如何将代码放在哪里。
I am working on a project that, among other things, automatically generates Swagger APIs for Python projects. One thing that I have noticed is that the curl
text exposes passwords if the API requires those. Since there's no way to mask the passwords as of now (https://github.com/swagger-api/swagger-ui/issues/5025), it seems like the easiest thing to do is to simply disable the curl
text so that I can screenshare my Swagger API without exposing my password.
In another issue (https://github.com/swagger-api/swagger-ui/issues/5020), a plugin is shown that can disable the curl text.
However, I'm totally stumped on how to actually import and use this plugin. There's lots of documentation about how to write plugins, and none on how to import them. I can see that I can load plugins using the plugins option in https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/, but I don't know how where to put the code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如海伦所提到的那样,您问题的答案取决于您的设置。但是,我会危害猜测您需要通过运行该应用程序的“捆绑”版本来配置
Swaggerui
对象。您可能会认为这是为Docker容器创建自定义entrypoint
。例如,您提供的链接显示了运行自定义版本的建议
Swaggerui
这些自定义是用JavaScript编写的,因此任何具有必要依赖项的旧HTML页面加载您编写的脚本以配置Swaggerui
都会回答“将代码放在哪里”的问题。详细信息将取决于您或未使用的任何框架。
As Helen alludes to, the answer to your question depends on your setup. However, I would hazard to guess that you will need to configure the
SwaggerUI
object by running an "unbundled" version of the app. You might think of this as creating a customentrypoint
to a docker container, say.For example, the link you provide shows suggestions for running a customised version of
SwaggerUI
. Those customisations are written in JavaScript, so any old HTML page with the necessary dependencies in place which loads the script you write to configureSwaggerUI
would answer the question of "where to put that code".The details would depend on any frameworks you are or are not using.