Skip to content

Commit 3197a8e

Browse files
committed
Update configuration.mdx based on issue #266
1 parent 17fd532 commit 3197a8e

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

fern/products/sdks/overview/python/configuration.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,30 @@ groups:
1515
config:
1616
package_name: "your_package"
1717
client:
18-
class_name: "YourClient"
18+
class_name: "YourClient"
19+
```
20+
21+
## Extension Headers
22+
23+
You can configure SDK variables in your OpenAPI spec using the `x-fern-sdk-variables` extension. These variables will be injected into the SDK client constructor.
24+
25+
For example, to add a `project_id` variable that gets automatically injected into path parameters:
26+
27+
```yaml
28+
components:
29+
x-fern-sdk-variables:
30+
project_id:
31+
type: string
32+
description: The ID of the project
33+
pattern: "^proj_[a-zA-Z0-9]+$"
34+
```
35+
36+
The variable will be available in the client constructor:
37+
38+
```python
39+
from my_package import Client
40+
41+
client = Client(project_id="proj_123")
1942
```
2043

2144
## SDK Configuration Options
@@ -72,7 +95,6 @@ groups:
7295
</ParamField>
7396

7497
<ParamField path="package_name" type="string" default="null" required={false} toc={true}>
75-
7698
Specifies the Python package name that users will import your generated client
7799
from.
78100

@@ -112,8 +134,8 @@ groups:
112134
# Visit every case in the union
113135
shape = get_shape()
114136
shape.visit(
115-
circle: lambda circle: do_something_with_circle(circle),
116-
triangle: lambda triangle: do_something_with_triangle(triangle),
137+
circle=lambda circle: do_something_with_circle(circle),
138+
triangle=lambda triangle: do_something_with_triangle(triangle),
117139
)
118140
```
119141

0 commit comments

Comments
 (0)