> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-mintlify-add-hello-world-quickstart-48843.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
<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">
  在 API 交互测试台中输入框的占位文本。
</ParamField>

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

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

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

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

```mdx
<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>
