Parameter Names

Use x-fern-parameter-name to customize SDK parameter names for JSON-RPC method parameters

By default, Fern uses the parameter names from your OpenRPC method definitions as SDK parameter names. You can customize these using the x-fern-parameter-name extension.

Customize parameter names

Use x-fern-parameter-name to specify custom parameter names for method parameters:

openrpc.yml
1methods:
2 - name: user.create
3 summary: Create a new user
4 params:
5 - name: user_data
6 schema:
7 type: object
8 properties:
9 email_address:
10 type: string
11 format: email
12 x-fern-parameter-name: email
13 full_name:
14 type: string
15 x-fern-parameter-name: name
16 date_of_birth:
17 type: string
18 format: date
19 x-fern-parameter-name: dateOfBirth
20 required:
21 - email_address
22 - full_name
23 x-fern-parameter-name: userData
24 required: true
25 result:
26 name: user
27 schema:
28 $ref: '#/components/schemas/User'

This generates SDK methods with cleaner parameter names:

1// Instead of user_data with email_address, full_name, date_of_birth
2await client.user.create({
3 userData: {
4 email: "john@example.com",
5 name: "John Doe",
6 dateOfBirth: "1990-01-15"
7 }
8});

Language-specific parameter names

You can specify different parameter names for different programming languages:

openrpc.yml
1methods:
2 - name: order.search
3 summary: Search for orders
4 params:
5 - name: search_criteria
6 schema:
7 type: object
8 properties:
9 customer_id:
10 type: string
11 x-fern-parameter-name:
12 python: customer_id
13 typescript: customerId
14 go: CustomerID
15 java: customerId
16 csharp: CustomerId
17 order_status:
18 type: string
19 enum: [pending, processing, shipped, delivered]
20 x-fern-parameter-name:
21 python: order_status
22 typescript: orderStatus
23 go: OrderStatus
24 java: orderStatus
25 csharp: OrderStatus
26 x-fern-parameter-name:
27 python: search_criteria
28 typescript: searchCriteria
29 go: SearchCriteria
30 java: searchCriteria
31 csharp: SearchCriteria
32 required: true
33 result:
34 name: orders
35 schema:
36 type: array
37 items:
38 $ref: '#/components/schemas/Order'

Nested parameter naming

Customize parameter names for nested objects:

openrpc.yml
1methods:
2 - name: payment.process
3 summary: Process a payment
4 params:
5 - name: payment_data
6 schema:
7 type: object
8 properties:
9 payment_method:
10 type: object
11 x-fern-parameter-name: paymentMethod
12 properties:
13 card_number:
14 type: string
15 x-fern-parameter-name: cardNumber
16 expiry_date:
17 type: string
18 x-fern-parameter-name: expiryDate
19 cvv:
20 type: string
21 billing_address:
22 type: object
23 x-fern-parameter-name: billingAddress
24 properties:
25 street_address:
26 type: string
27 x-fern-parameter-name: streetAddress
28 postal_code:
29 type: string
30 x-fern-parameter-name: postalCode
31 amount:
32 type: number
33 currency:
34 type: string
35 enum: [USD, EUR, GBP]
36 x-fern-parameter-name: paymentData
37 required: true
38 result:
39 name: paymentResult
40 schema:
41 $ref: '#/components/schemas/PaymentResult'

Array parameter naming

Handle array parameters with custom naming:

openrpc.yml
1methods:
2 - name: bulk.createUsers
3 summary: Create multiple users
4 params:
5 - name: user_list
6 schema:
7 type: array
8 items:
9 type: object
10 properties:
11 email_addr:
12 type: string
13 format: email
14 x-fern-parameter-name: email
15 user_name:
16 type: string
17 x-fern-parameter-name: username
18 required:
19 - email_addr
20 - user_name
21 x-fern-parameter-name: users
22 minItems: 1
23 maxItems: 100
24 required: true
25 result:
26 name: createdUsers
27 schema:
28 type: array
29 items:
30 $ref: '#/components/schemas/User'

Optional parameter naming

Customize names for optional parameters with defaults:

openrpc.yml
1methods:
2 - name: report.generate
3 summary: Generate a report
4 params:
5 - name: report_type
6 schema:
7 type: string
8 enum: [daily, weekly, monthly, yearly]
9 x-fern-parameter-name: reportType
10 required: true
11 - name: output_format
12 schema:
13 type: string
14 enum: [pdf, csv, json, excel]
15 default: pdf
16 x-fern-parameter-name: format
17 required: false
18 description: Output format (defaults to PDF)
19 - name: include_charts
20 schema:
21 type: boolean
22 default: true
23 x-fern-parameter-name: includeCharts
24 required: false
25 description: Include charts in the report
26 - name: date_range
27 schema:
28 type: object
29 properties:
30 start_date:
31 type: string
32 format: date
33 x-fern-parameter-name: startDate
34 end_date:
35 type: string
36 format: date
37 x-fern-parameter-name: endDate
38 x-fern-parameter-name: dateRange
39 required: false
40 description: Optional date range filter
41 result:
42 name: report
43 schema:
44 $ref: '#/components/schemas/Report'

Positional parameter naming

For methods using positional parameters, customize the generated parameter names:

openrpc.yml
1methods:
2 - name: math.calculate
3 summary: Perform mathematical calculation
4 paramStructure: by-position
5 params:
6 - schema:
7 type: number
8 description: First operand
9 x-fern-parameter-name: operandA
10 - schema:
11 type: number
12 description: Second operand
13 x-fern-parameter-name: operandB
14 - schema:
15 type: string
16 enum: [add, subtract, multiply, divide]
17 description: Operation to perform
18 x-fern-parameter-name: operation
19 result:
20 name: result
21 schema:
22 type: number

This generates cleaner SDK interfaces:

1// Instead of unnamed positional parameters
2await client.math.calculate(10, 5, "add");
3
4// With named parameters
5await client.math.calculate({
6 operandA: 10,
7 operandB: 5,
8 operation: "add"
9});

Using custom parameter names ensures consistent naming conventions across your SDK while maintaining compatibility with your existing JSON-RPC method signatures.