> 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.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJmMDA4ZWNjMi00MGU2LTRhODgtYmNkYi01YzI2MmI3MTg4OWQiLCJleHAiOjE3Nzg0OTMwMTIsImlhdCI6MTc3ODQ5MjcxMn0.A-LpyVN3n9QVzxgoVoy4_97rXMLMOrzIstJCdG5A6q8
>
> 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.

# 自定义参数名称

> 使用 `x-fern-parameter-name` 来自定义查询参数、请求头和路径参数的命名。

<Note>
  `x-fern-parameter-name` 扩展允许您在生成的 SDK 中自定义参数的变量名称。
</Note>

## 请求头

在下面的示例中，请求头 `X-API-Version` 在生成的 SDK 中被重命名为 `version`。这种重命名使 SDK 更具可读性。

```yaml {8}
paths:
  "/user":
    get:
      operationId: list_user
      parameters:
        - in: header
          name: X-API-Version
          x-fern-parameter-name: version
          schema:
            type: string
          required: true
```

## 查询参数

在下面的示例中，查询参数 `q` 在生成的 SDK 中被重命名为 `search_terms`。这种重命名使参数对最终用户更加友好。

```yaml {8}
paths:
  "/user/search":
    get:
      operationId: search_user
      parameters:
        - in: query
          name: q
          x-fern-parameter-name: search_terms
          schema:
            type: string
          required: false
```

## 路径参数

在下面的示例中，路径参数 `userId` 在生成的 SDK 中被重命名为 `id`。这种重命名使 SDK 更加简洁。

```yaml {8}
paths:
  "/user/{userId}":
    get:
      operationId: get_user
      parameters:
        - in: path
          name: userId
          x-fern-parameter-name: id
          schema:
            type: string
          required: false
```