Swagger UI 是否有路径的永久链接? [英] Does Swagger UI have permalinks for paths?

查看:22
本文介绍了Swagger UI 是否有路径的永久链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以链接到 Swagger UI 中显示的特定路径,例如下图中的 /work/2.1?

Is it possible to link to a specific path displayed in Swagger UI, such as to /work/2.1 on the image below?

我想从外部网页链接到各个路径.

I want to link to individual paths from an external web page.

推荐答案

是的,Swagger UI 有 永久链接 用于操作和标签.要获得永久链接,请展开操作或标记并复制地址栏中的 URL.永久链接如下所示:

Yes, Swagger UI has permalinks for operations and tags. To get a permalink, expand an operation or tag and copy the URL in the address bar. Permalinks look like this:

index.html#/tagName
index.html#/tagName/operationId

当有人在浏览器中打开这样的固定链接时,相应的标签或操作会自动展开,并在需要时滚动到顶部.示例:
https://petstore.swagger.io/#/store/getInventory

When someone opens such a permalink in a browser, the corresponding tag or operation is automatically expanded and also scrolled to the top if needed. Example:
https://petstore.swagger.io/#/store/getInventory

在 Swagger UI 2.2 中,默认启用永久链接.

In Swagger UI 2.2 permalinks are enabled by default.

如果您使用 UI 3.x,则需要 3.0.19 或更高版本,并且需要将 deepLinking: true 添加到 index.html<中的 Swagger UI 初始化代码中/代码>:

If you use UI 3.x, you need version 3.0.19 or later, and you need to add deepLinking: true to the Swagger UI init code in your index.html:

const ui = SwaggerUIBundle({
  url: "http://petstore.swagger.io/v2/swagger.json",
  deepLinking: true,  // <------

这篇关于Swagger UI 是否有路径的永久链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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