Skip to content

Commit d3ab793

Browse files
committed
Update configuration.mdx based on issue #266
1 parent 2b72ca9 commit d3ab793

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

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

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@ groups:
1111
local:
1212
generators:
1313
- name: fernapi/fern-python
14-
version: 0.7.1
14+
version: 4.24.0
1515
config:
1616
client:
1717
class_name: "YourClient"
1818
```
1919
2020
## SDK Configuration Options
2121
22-
<ParamField path="additional_init_exports" type="array" default="null" required={false} toc={true}>
23-
</ParamField>
24-
2522
<ParamField path="client" type="ClientConfiguration" default="ClientConfiguration()" required={false} toc={true}>
23+
Client configuration options including SDK variable support through `x-fern-sdk-variables` in OpenAPI specs.
2624
</ParamField>
2725

2826
<ParamField path="default_bytes_stream_chunk_size" type="number" default="null" required={false} toc={true}>
2927
The chunk size to use (if any) when processing a response bytes stream within `iter_bytes` or `aiter_bytes` results in: `for chunk in response.iter_bytes(chunk_size=<default_bytes_stream_chunk_size>):`
3028
</ParamField>
3129

3230
<ParamField path="exclude_types_from_init_exports" type="bool" default="false" required={false} toc={true}>
31+
Whether to exclude types from __init__ exports
3332
</ParamField>
3433

3534
<ParamField path="extra_dependencies" type="object" default="{}" required={false} toc={true}>
@@ -41,13 +40,8 @@ groups:
4140
```
4241
</ParamField>
4342

44-
<ParamField path="extra_dev_dependencies" type="object" default="{}" required={false} toc={true}>
45-
</ParamField>
46-
47-
<ParamField path="extras" type="object" default="{}" required={false} toc={true}>
48-
</ParamField>
49-
5043
<ParamField path="flat_layout" type="bool" default="false" required={false} toc={true}>
44+
Whether to use a flat directory layout for generated code
5145
</ParamField>
5246

5347
<ParamField path="follow_redirects_by_default" type="bool" default="true" required={false} toc={true}>
@@ -62,9 +56,6 @@ groups:
6256
Whether or not to include legacy wire tests in the generated SDK
6357
</ParamField>
6458

65-
<ParamField path="include_union_utils" type="bool" default="false" required={false} toc={true}>
66-
</ParamField>
67-
6859
<ParamField path="inline_path_params" type="bool" default="false" required={false} toc={true}>
6960
If true, treats path parameters as named parameters in endpoint functions.
7061
</ParamField>
@@ -74,9 +65,11 @@ groups:
7465
</ParamField>
7566

7667
<ParamField path="package_name" type="string" default="null" required={false} toc={true}>
68+
Custom package name for the generated SDK
7769
</ParamField>
7870

7971
<ParamField path="pydantic_config" type="SdkPydanticModelCustomConfig" default="SdkPydanticModelCustomConfig()" required={false} toc={true}>
72+
Configuration options for Pydantic model generation
8073
</ParamField>
8174

8275
<ParamField path="pydantic_config.include_union_utils" type="bool" default="false" required={false} toc={true}>
@@ -101,8 +94,6 @@ groups:
10194
triangle: lambda triangle: do_something_with_triangle(triangle),
10295
)
10396
```
104-
105-
When enabled, the python generator will not run Black formatting in the generated code. Black is slow so this can potentially speed up code generation quite a bit.
10697
</ParamField>
10798

10899
<ParamField path="pydantic_config.version" type="'v1' | 'v2' | 'both' | 'v1_on_v2'" default="both" required={false} toc={true}>
@@ -124,21 +115,16 @@ groups:
124115
<Warning>This changes your declared python dependency, which is not meant to be done often if at all. This is a last resort if any dependencies force you to change your version requirements.</Warning>
125116
</ParamField>
126117
127-
<ParamField path="pyproject_toml" type="string" default="null" required={false} toc={true}>
128-
</ParamField>
129-
130118
<ParamField path="should_generate_websocket_clients" type="bool" default="false" required={false} toc={true}>
131119
Feature flag that enables generation of Python websocket clients.
132120
</ParamField>
133121
134-
<ParamField path="skip_formatting" type="bool" default="false" required={false} toc={true}>
135-
</ParamField>
136-
137122
<ParamField path="timeout_in_seconds" type="number | 'infinity'" default="60" required={false} toc={true}>
138123
By default, the generator generates a client that times out after 60 seconds. You can customize this value by providing a different number or setting to `infinity` to get rid of timeouts.
139124
</ParamField>
140125

141126
<ParamField path="use_api_name_in_package" type="bool" default="false" required={false} toc={true}>
127+
Whether to include the API name in the generated package name
142128
</ParamField>
143129

144130
<ParamField path="use_inheritance_for_extended_models" type="bool" default="true" required={false} toc={true}>
@@ -149,6 +135,31 @@ groups:
149135
Whether or not to generate `TypedDicts` instead of Pydantic Models for request objects.
150136
</ParamField>
151137

152-
<ParamField path="use_typeddict_requests_for_file_upload" type="bool" default="false" required={false} toc={true}>
153-
Whether or not to generate TypedDicts instead of Pydantic Models for file upload request objects. Note that this flag was only introduced due to an oversight in the `use_typeddict_requests` flag implementation; it should be removed in the future.
138+
<ParamField path="x-fern-sdk-variables" type="object" default="{}" required={false} toc={true}>
139+
An extension field in OpenAPI specs that allows you to define variables for your SDK client. These variables will be available in the generated client constructor. Variables must be defined in the components section of your OpenAPI spec:
140+
141+
```yaml
142+
components:
143+
x-fern-sdk-variables:
144+
project_id:
145+
type: string
146+
description: "The project ID"
147+
pattern: "^proj_[a-zA-Z0-9]+$"
148+
```
149+
150+
Once defined, you can reference these variables in your path parameters with the `x-fern-sdk-variable` extension:
151+
152+
```yaml
153+
/v1/connect/{project_id}/accounts:
154+
parameters:
155+
- name: project_id
156+
in: path
157+
required: true
158+
schema:
159+
type: string
160+
pattern: "^proj_[a-zA-Z0-9]+$"
161+
x-fern-sdk-variable: project_id
162+
```
163+
164+
The generated SDK will handle injecting these variables into API calls automatically when they are provided to the client constructor.
154165
</ParamField>

0 commit comments

Comments
 (0)