Skip to navigation

Customize parameter names

View as Markdown

The x-fern-parameter-name extension allows you to customize the variable names of parameters in your generated SDKs.

Headers

In the example below, the header X-API-Version is renamed to version in the generated SDK. The rename makes the SDK more human readable.

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

Query parameters

In the example below, the query parameter q is renamed to search_terms in the generated SDK. The rename makes the parameter more approachable for end users.

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

Path parameters

In the example below, the path parameter userId is renamed to id in the generated SDK. The rename makes the SDK less verbose.

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

Renaming a path parameter is also how you resolve a naming collision. A path parameter can’t share a name with another request property (a body property, query parameter, or header), including after camelCase normalization. fern check reports these collisions; set x-fern-parameter-name on the path parameter to rename it and resolve the collision.