Skip to content

Commit 8d4dcf1

Browse files
committed
Update configuration.mdx based on issue #266
1 parent 7df5d66 commit 8d4dcf1

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

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

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,49 +20,67 @@ groups:
2020
## SDK Configuration Options
2121
2222
<ParamField path="additional_init_exports" type="array" default="null" required={false} toc={true}>
23+
Additional types to export in the package's __init__.py file.
2324
</ParamField>
2425
2526
<ParamField path="client" type="ClientConfiguration" default="ClientConfiguration()" required={false} toc={true}>
27+
Client-specific configuration options.
2628
</ParamField>
2729
2830
<ParamField path="default_bytes_stream_chunk_size" type="number" default="null" required={false} toc={true}>
2931
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>):`
3032
</ParamField>
3133

3234
<ParamField path="exclude_types_from_init_exports" type="bool" default="false" required={false} toc={true}>
35+
Whether to exclude types from the package's __init__.py exports.
3336
</ParamField>
3437

35-
<ParamField path="extra_dependencies" type="object" default="{}" required={false} toc={true}>
36-
If you want to add custom dependencies to your generated SDK, you can specify them using this configuration. For example, to add a dependency on boto3, your config would look like:
38+
<ParamField path="extension_headers" type="object" default="{}" required={false} toc={true}>
39+
Custom headers to include in every request made by the SDK client. For example:
40+
```yaml
41+
config:
42+
extension_headers:
43+
x-fern-sdk-variables:
44+
type: string
45+
description: "Template variables to be replaced in paths"
3746
```
47+
</ParamField>
48+
49+
<ParamField path="extra_dependencies" type="object" default="{}" required={false} toc={true}>
50+
Additional dependencies to include in the generated SDK package. For example:
51+
```yaml
3852
config:
3953
extra_dependencies:
4054
boto3: 1.28.15
4155
```
4256
</ParamField>
4357

4458
<ParamField path="extra_dev_dependencies" type="object" default="{}" required={false} toc={true}>
59+
Additional development dependencies to include in the generated SDK package.
4560
</ParamField>
4661

4762
<ParamField path="extras" type="object" default="{}" required={false} toc={true}>
63+
Optional feature packages to include in the SDK.
4864
</ParamField>
4965

5066
<ParamField path="flat_layout" type="bool" default="false" required={false} toc={true}>
67+
Whether to generate a flat directory structure instead of nested resources.
5168
</ParamField>
5269

5370
<ParamField path="follow_redirects_by_default" type="bool" default="true" required={false} toc={true}>
5471
Whether to follow redirects by default in HTTP requests.
5572
</ParamField>
5673

5774
<ParamField path="improved_imports" type="bool" default="true" required={false} toc={true}>
58-
Feature flag that improves imports in the Python SDK by removing nested `resources` directory
75+
Feature flag that improves imports in the Python SDK by removing nested `resources` directory.
5976
</ParamField>
6077

6178
<ParamField path="include_legacy_wire_tests" type="bool" default="false" required={false} toc={true}>
62-
Whether or not to include legacy wire tests in the generated SDK
79+
Whether to include legacy wire tests in the generated SDK.
6380
</ParamField>
6481

6582
<ParamField path="include_union_utils" type="bool" default="false" required={false} toc={true}>
83+
Whether to include utility functions for union types.
6684
</ParamField>
6785

6886
<ParamField path="inline_path_params" type="bool" default="false" required={false} toc={true}>
@@ -74,20 +92,22 @@ groups:
7492
</ParamField>
7593

7694
<ParamField path="package_name" type="string" default="null" required={false} toc={true}>
95+
Custom package name for the generated SDK.
7796
</ParamField>
7897

7998
<ParamField path="pydantic_config" type="SdkPydanticModelCustomConfig" default="SdkPydanticModelCustomConfig()" required={false} toc={true}>
99+
Configuration options for Pydantic model generation.
80100
</ParamField>
81101

82102
<ParamField path="pydantic_config.include_union_utils" type="bool" default="false" required={false} toc={true}>
83103
When enabled, the generator will output a Pydantic `__root__` class that will contain utilities to visit the union. For example, for the following union type:
84104

85-
```
105+
```yaml
86106
types:
87-
Shape:
88-
union:
89-
circle: Circle
90-
triangle: Triangle
107+
Shape:
108+
union:
109+
circle: Circle
110+
triangle: Triangle
91111
```
92112
you will get a generated `Shape` class that has a factory and visitor:
93113
```python
@@ -97,8 +117,8 @@ groups:
97117
# Visit every case in the union
98118
shape = get_shape()
99119
shape.visit(
100-
circle: lambda circle: do_something_with_circle(circle),
101-
triangle: lambda triangle: do_something_with_triangle(triangle),
120+
circle=lambda circle: do_something_with_circle(circle),
121+
triangle=lambda triangle: do_something_with_triangle(triangle),
102122
)
103123
```
104124

@@ -125,30 +145,33 @@ groups:
125145
</ParamField>
126146

127147
<ParamField path="pyproject_toml" type="string" default="null" required={false} toc={true}>
148+
Custom pyproject.toml content for the generated package.
128149
</ParamField>
129150

130151
<ParamField path="should_generate_websocket_clients" type="bool" default="false" required={false} toc={true}>
131152
Feature flag that enables generation of Python websocket clients.
132153
</ParamField>
133154

134155
<ParamField path="skip_formatting" type="bool" default="false" required={false} toc={true}>
156+
Whether to skip code formatting of the generated SDK.
135157
</ParamField>
136158

137159
<ParamField path="timeout_in_seconds" type="number | 'infinity'" default="60" required={false} toc={true}>
138160
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.
139161
</ParamField>
140162

141163
<ParamField path="use_api_name_in_package" type="bool" default="false" required={false} toc={true}>
164+
Whether to include the API name in the generated package name.
142165
</ParamField>
143166

144167
<ParamField path="use_inheritance_for_extended_models" type="bool" default="true" required={false} toc={true}>
145168
Whether to generate Pydantic models that implement inheritance when a model utilizes the Fern `extends` keyword.
146169
</ParamField>
147170

148171
<ParamField path="use_typeddict_requests" type="bool" default="false" required={false} toc={true}>
149-
Whether or not to generate `TypedDicts` instead of Pydantic Models for request objects.
172+
Whether to generate `TypedDicts` instead of Pydantic Models for request objects.
150173
</ParamField>
151174

152175
<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.
176+
Whether 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.
154177
</ParamField>

0 commit comments

Comments
 (0)