Adr*_*enW 6 yaml swagger swagger-2.0 swagger-editor
我正在为需要非常详细和干净的文档的未来公共 API 编写 Swagger 规范。有没有办法在swagger.yml文件中的其他位置引用/链接/指向另一个端点?
例如,这是我想要实现的目标:
paths:
/my/endpoint:
post:
tags:
- Some tag
summary: Do things
description: >
This endpoint does things.
See /my/otherEndpoint for stuff # Here I would like to have some kind of hyperlink
operationId: doThings
consumes:
- application/json
produces:
- application/json
parameters:
...
responses:
...
/my/otherEndpoint: # This is the endpoint to be referenced to
get:
...
Run Code Online (Sandbox Code Playgroud)
我发现这$ref
无济于事,因为它只是用引用的内容替换了自己。
Swagger 可以做这样的事情吗?
Hel*_*len 12
如果 Swagger UI配置了该选项,则它会为标记和操作提供永久链接deepLinking: true
。这些永久链接是基于标签名称和operationId
(或者如果没有operationId
- 基于端点名称和 HTTP 动词)生成的。
index.html#/tagName
index.html#/tagName/operationId
Run Code Online (Sandbox Code Playgroud)
您可以在 Markdown 标记中使用这些永久链接:
index.html#/tagName
index.html#/tagName/operationId
Run Code Online (Sandbox Code Playgroud)
笔记:
target="_blank"
) - 请参阅问题 #3473。<a href="#/tagName/operationId">foobar</a>
目前不起作用。 归档时间: |
|
查看次数: |
8766 次 |
最近记录: |