跳到导航

端点响应代码片段

以 Markdown 格式查看

使用 <EndpointResponseSnippet> 组件从你的 API 参考中引用端点响应。

使用方法

Response
{
"turns": [
{
"role": "user",
"content": "string"
}
],
"citations": [
"string"
],
"sources": [
{
"url": "string",
"title": "string"
}
]
}
Markdown
<EndpointResponseSnippet endpoint="POST /chat/{domain}" />

引用特定示例

1

在你的规范中设置示例名称

openapi.yml
paths:
/pet/{petId}:
put:
summary: Get a pet
operationId: pets_get
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
examples:
ExampleWithMarkley:
summary: This is an example of a Pet
value:
name: Markley
id: 44
2

直接引用示例

Markdown
<EndpointResponseSnippet
endpoint="GET /pet/{petId}"
example="ExampleWithMarkley"
/>

属性

endpoint
stringRequired

要显示的端点,格式为 METHOD /path(例如 POST /chat/{domain})。如果你的 API 使用命名空间,请在前面添加命名空间和 ::(例如 payments::POST /chat/{domain})。

example
string

要显示的特定示例名称。如果示例包含 summary 或 docs 字段,请使用该值。

highlight
number | number[]

代码片段中要高亮显示的行号。接受单个数字、数字数组或范围(例如 {[1-3, 5]})。