> ## Documentation Index
> Fetch the complete documentation index at: https://omer-914cc1c6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 字段

> 为你的 API 或 SDK 参考文档设置参数

使用字段来记录 API 的参数与响应。字段分为两类：参数字段和响应字段。

<div id="parameter-field">
  ## 参数字段
</div>

`<ParamField>` 组件用于为你的 API 或 SDK 定义参数。添加一个 `ParamField` 会自动添加一个 [API 操作台](/zh/api-playground/overview)。

<ParamField path="param" type="string" required>
  参数字段示例
</ParamField>

```mdx theme={null}
<ParamField path="param" type="string" required>
  参数字段的示例
</ParamField>
```

<div id="properties">
  ### 属性
</div>

<ParamField body="query, path, body, or header" type="string">
  指明该参数属于 query、path、body 还是 header，后接
  参数名称。
</ParamField>

<ParamField body="type" type="string">
  参数值的预期类型。

  支持 `number`、`string`、`boolean`、`object`。

  数组可通过 `[]` 后缀定义，例如 `string[]`。
</ParamField>

<ParamField body="required" type="boolean">
  指示该参数是否为必填。
</ParamField>

<ParamField body="deprecated" type="boolean">
  指示该参数是否已废弃。
</ParamField>

<ParamField body="default" type="any">
  当请求值为空时使用的默认值。
</ParamField>

<ParamField body="placeholder" type="string">
  playground 输入框的占位文本。
</ParamField>

<ParamField body="children" type="string">
  参数说明（支持 Markdown）。
</ParamField>

<div id="response-field">
  ## 响应字段
</div>

`<ResponseField>` 组件用于定义 API 的返回值。

<ResponseField name="response" type="string" required>
  响应字段示例
</ResponseField>

```mdx theme={null}
<ResponseField name="response" type="string" required>
  响应字段示例
</ResponseField>
```

<div id="properties">
  ### 属性
</div>

<ResponseField name="name" type="string" required>
  响应值的名称。
</ResponseField>

<ResponseField name="type" type="string" required>
  响应值的预期类型。可以是任意字符串。
</ResponseField>

<ResponseField name="default" type="string">
  默认值。
</ResponseField>

<ResponseField name="required" type="boolean">
  指明该响应是否为必填。
</ResponseField>

<ResponseField name="deprecated" type="boolean">
  该字段是否已废弃。
</ResponseField>

<ResponseField name="pre" type="string[]">
  显示在字段名称之前的标签。
</ResponseField>

<ResponseField name="post" type="string[]">
  显示在字段名称之后的标签。
</ResponseField>
