Swagger UI - 添加禁用 "try it out" 按钮的 curl 示例
Swagger UI - Add curl example with the "try it out" button disabled
我正在使用 Swagger UI 为自定义 REST API 创建文档。
我禁用了“试用”按钮,因为我不想要它,但我很想显示每个请求的 curl 命令。
有没有办法在不激活“试用”按钮的情况下显示它?或者也许在 YAML 文件中添加一些内容,以显示另一个 div 其中包含自定义文本?
Is there a way to show it without activating the "try it out" button?
没有。 Swagger UI 的 curl 命令生成器取决于“试用”可用性,因为命令是根据用户在“试用”期间指定的特定参数值生成的。
Or maybe add something in the YAML file that shows one more div with custom text in it?
您可以使用 description
操作字段添加详细信息,例如代码示例。说明支持 Markdown 富文本格式。
paths:
/something:
get:
summary: Get something
description: >-
Detailed description goes here.
And here's some code:
curl https://example.com/something -H "Accept: application/json"
responses:
200:
description: Successful response
我正在使用 Swagger UI 为自定义 REST API 创建文档。
我禁用了“试用”按钮,因为我不想要它,但我很想显示每个请求的 curl 命令。
有没有办法在不激活“试用”按钮的情况下显示它?或者也许在 YAML 文件中添加一些内容,以显示另一个 div 其中包含自定义文本?
Is there a way to show it without activating the "try it out" button?
没有。 Swagger UI 的 curl 命令生成器取决于“试用”可用性,因为命令是根据用户在“试用”期间指定的特定参数值生成的。
Or maybe add something in the YAML file that shows one more div with custom text in it?
您可以使用 description
操作字段添加详细信息,例如代码示例。说明支持 Markdown 富文本格式。
paths:
/something:
get:
summary: Get something
description: >-
Detailed description goes here.
And here's some code:
curl https://example.com/something -H "Accept: application/json"
responses:
200:
description: Successful response