Swagger-ui 锚链接到模型定义 [英] Swagger-ui anchor link to model definitions

查看:50
本文介绍了Swagger-ui 锚链接到模型定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过锚点直接访问通过 swagger-ui 的模型定义?

Is it possible to access a model definition of via swagger-ui directly via an anchor?

在示例页面 http://petstore.swagger.io/ 我看到锚适用于一组端点,例如http://petstore.swagger.io/#/pet.

In the example page http://petstore.swagger.io/ I see that the anchor works for a groups of endpoints, e.g. http://petstore.swagger.io/#/pet.

将鼠标悬停在模型描述上会显示一个锚点(例如 Category 模型的 #/definitions/Category),但是http://petstore.swagger.io/#/definitions/Category 不带我在那里.

Hovering the mouse over a model description shows me an anchor (e.g. #/definitions/Category for the Category model), but http://petstore.swagger.io/#/definitions/Category does not bring me there.

如果我检查元素,我会看到一个指向锚 pet 的真实链接:

If I inspect the elements, I see a real link to anchor pet:

<a class="nostyle" href="#/pet"><span>pet</span></a>

而对于 Category 这是一个 model-hint:

while for Category this is a model-hint:

<span class="model-hint">#/definitions/Category</span>

所以我想知道是否支持锚定模型..

So I wonder if anchoring models is supported at all..

推荐答案

Swagger UI 不支持模式/模型的永久链接.有一个现有的功能请求:
https://github.com/swagger-api/swagger-ui/issues/1369

Swagger UI does not support permalinks for schemas/models. There's an existing feature request:
https://github.com/swagger-api/swagger-ui/issues/1369

这篇关于Swagger-ui 锚链接到模型定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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