在 Swagger 中实施搜索 UI
Implement search in Swagger UI
我遇到了在使用本地主机的 Swagger UI 中实施搜索的问题。
我一直在网上搜索,但没有找到答案。
我的问题是:"Is it possible to implement search in the Swagger UI, so people can search for a path of the API?"
提前致谢!
目前 swagger-ui 没有 ui 搜索选项。但作为解决方案,您有 2 个选择。
- 默认情况下 swagger-ui 根据路径列出 api 的集合(由 api 代码上的 @Api() 注释)。在下面的示例中,它根据 2 条路径(价格检查和 pdp 详细信息)列出了 apis。
2.You 可以明确告诉 swagger-ui 只显示特定路径下列出的 apis。在下面的示例中,它显示 api 仅在价格检查下列出。
为此,您必须使用 swagger 配置该路径文档。
有关 swagger 注释的更多信息,请参阅 this。
更新:
In- built swagger-ui search 现已可用。
我在 Google 个群组的官方 Swagger 社区页面上收到了答案。
他们在 github 上推荐了以下页面,而这正是我要找的。这是 Swagger UI.
中非常漂亮的搜索实现
https://github.com/swagger-api/swagger-ui/pull/2116
无论如何感谢您回答我的问题!
githubswagger search 中有一个存储库,可以跨项目搜索 API 并通过 command(ctrl)+F 在 swagger 文档中搜索 API。
我遇到了在使用本地主机的 Swagger UI 中实施搜索的问题。
我一直在网上搜索,但没有找到答案。
我的问题是:"Is it possible to implement search in the Swagger UI, so people can search for a path of the API?"
提前致谢!
目前 swagger-ui 没有 ui 搜索选项。但作为解决方案,您有 2 个选择。
- 默认情况下 swagger-ui 根据路径列出 api 的集合(由 api 代码上的 @Api() 注释)。在下面的示例中,它根据 2 条路径(价格检查和 pdp 详细信息)列出了 apis。
2.You 可以明确告诉 swagger-ui 只显示特定路径下列出的 apis。在下面的示例中,它显示 api 仅在价格检查下列出。
有关 swagger 注释的更多信息,请参阅 this。
更新:
In- built swagger-ui search 现已可用。
我在 Google 个群组的官方 Swagger 社区页面上收到了答案。
他们在 github 上推荐了以下页面,而这正是我要找的。这是 Swagger UI.
中非常漂亮的搜索实现https://github.com/swagger-api/swagger-ui/pull/2116
无论如何感谢您回答我的问题!
githubswagger search 中有一个存储库,可以跨项目搜索 API 并通过 command(ctrl)+F 在 swagger 文档中搜索 API。