> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI5Mjk2ZWFiZC01YmFkLTRiMDMtOTJhOS1lNjE5NTllMmYxZDciLCJleHAiOjE3NzgyNjQzOTksImlhdCI6MTc3ODI2NDA5OX0.uQFRDQT4RGdTWK07f2WxpUpb2Ey6DpQZ24UoobLFcQI
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 端点模式片段

> 从 API Reference 引用端点模式

`<EndpointSchemaSnippet>` 组件显示来自 API Reference 的端点模式。默认情况下，它渲染完整的模式，或者您可以使用 `selector` 属性来显示特定部分，如请求体、响应、路径参数或查询参数。

要按名称显示任何类型定义（不限于端点模式），请使用 [`<Schema>`](/learn/docs/writing-content/components/schema) 组件。

<Note>
  尚不支持富 Markdown 字段描述，将显示为纯文本。请参见下面的[请求路径](#request-path)示例。
</Note>

## 用法

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" />

```

## 变体

### 完整请求

将 `request` 作为选择器传递将仅渲染请求模式。

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request" />
```

### 请求路径

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.path" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.path" />
```

### 请求查询

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.query" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.query" />
```

### 请求体

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.body" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="request.body" />
```

### 完整响应

将 `response` 作为选择器传递将仅渲染响应模式。

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="response" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="response" />
```

### 响应体

<div>
  <div>
    <EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="response.body" />
  </div>
</div>

```jsx Markdown
<EndpointSchemaSnippet endpoint="POST /chat/{domain}" selector="response.body" />
```

## 属性

<ParamField path="endpoint" type="string" required={true}>
  要显示的端点，格式为 `METHOD /path`（例如，`POST /chat/{domain}`）。如果您的 API 使用[命名空间](/learn/api-definitions/overview/project-structure#combined-sdks-from-multiple-apis)，请在前面加上命名空间和 `::`（例如，`payments::POST /chat/{domain}`）。
</ParamField>

<ParamField path="selector" type="string" required={false}>
  选择要显示的端点模式的特定部分。支持的值：`request`、`request.path`、`request.query`、`request.body`、`response`、`response.body`。
</ParamField>