如何使用Swagger UI插件?

发布于 2025-02-06 02:41:35 字数 948 浏览 2 评论 0原文

我正在研究一个项目,除其他外,它将自动为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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随波逐流 2025-02-13 02:41:35

正如海伦所提到的那样,您问题的答案取决于您的设置。但是,我会危害猜测您需要通过运行该应用程序的“捆绑”版本来配置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 custom entrypoint 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 configure SwaggerUI would answer the question of "where to put that code".

The details would depend on any frameworks you are or are not using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文