Skip to content

Commit 927994e

Browse files
docs: Add x-fern-retries OpenAPI extension documentation
- Add x-fern-retries to extensions overview table - Create dedicated retries.mdx page with examples - Add retry behavior page to navigation - Document Python SDK-only support for retry configuration Co-Authored-By: [email protected] <[email protected]>
1 parent e2c67c2 commit 927994e

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

fern/products/api-def/api-def.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ navigation:
6666
path: ./openapi-pages/extensions/parameter-names.mdx
6767
- page: Property names
6868
path: ./openapi-pages/extensions/property-names.mdx
69+
- page: Retry behavior
70+
path: ./openapi-pages/extensions/retries.mdx
6971
- page: Schema names
7072
path: ./openapi-pages/extensions/schema-names.mdx
7173
- page: Server names

fern/products/api-def/openapi-pages/extensions/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The table below shows all available extensions and links to detailed documentati
2929
| [`x-fern-sdk-variables`](./sdk-variables) | Set common path parameters across all requests |
3030
| [`x-fern-parameter-name`](./parameter-names) | Customize parameter variable names |
3131
| [`x-fern-property-name`](./property-names) | Customize object property variable names |
32+
| [`x-fern-retries`](./retries) | Configure retry behavior for endpoints (Python SDK only) |
3233
| [`x-fern-type-name`](./schema-names) | Override auto-generated names for inline schemas |
3334
| [`x-fern-server-name`](./server-names) | Name your servers |
3435

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Retry behavior
3+
subtitle: Configure retry behavior for endpoints using `x-fern-retries` extension
4+
---
5+
6+
<Callout intent="info">
7+
The `x-fern-retries` extension is currently supported in Python SDKs only.
8+
</Callout>
9+
10+
The `x-fern-retries` extension allows you to configure retry behavior at the endpoint level in your OpenAPI specification. This gives you fine-grained control over how the generated SDK handles retries for specific endpoints, overriding any default retry configuration that end users may have set.
11+
12+
## Disable retries
13+
14+
To disable retries for a specific endpoint, set `disabled: true`:
15+
16+
```yaml title="openapi.yml" {4-5}
17+
paths:
18+
/plants/{plantId}:
19+
get:
20+
x-fern-retries:
21+
disabled: true
22+
operationId: get_plant
23+
parameters:
24+
- name: plantId
25+
in: path
26+
required: true
27+
schema:
28+
type: string
29+
```
30+
31+
When retries are disabled at the endpoint level, the generated SDK will not retry failed requests to that endpoint, regardless of the end user's SDK configuration.
32+
33+
## Use cases
34+
35+
The `x-fern-retries` extension is useful when you want to:
36+
37+
- **Disable retries for non-idempotent operations**: Prevent automatic retries on endpoints that shouldn't be retried, such as payment processing or order creation endpoints
38+
- **Override user configuration**: Ensure specific endpoints never retry, even if the end user has configured global retry settings in their SDK client
39+
- **Control retry behavior per endpoint**: Apply different retry strategies to different parts of your API based on their characteristics
40+
41+
## Example: Disable retries for a POST endpoint
42+
43+
In this example, we disable retries for a plant creation endpoint to prevent duplicate entries:
44+
45+
```yaml title="openapi.yml" {4-5}
46+
paths:
47+
/plants:
48+
post:
49+
x-fern-retries:
50+
disabled: true
51+
operationId: create_plant
52+
requestBody:
53+
required: true
54+
content:
55+
application/json:
56+
schema:
57+
type: object
58+
properties:
59+
name:
60+
type: string
61+
species:
62+
type: string
63+
responses:
64+
'201':
65+
description: Plant created successfully
66+
```
67+
68+
With this configuration, the generated Python SDK will enforce no retries on the `create_plant` method, regardless of the end user's retry configuration.

0 commit comments

Comments
 (0)