Skip to content

Commit 881cd64

Browse files
committed
Create others.mdx based on issue #266
1 parent 407b095 commit 881cd64

File tree

1 file changed

+83
-0
lines changed
  • fern/products/openapi-definition/pages/extensions

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: "Other Extensions"
3+
description: "Details on other common OpenAPI extensions used with Fern"
4+
---
5+
6+
Fern supports several OpenAPI extensions that provide additional functionality when generating SDKs and documentation. Here is a comprehensive list of extension headers:
7+
8+
## x-fern-sdk-variables
9+
10+
Allows you to define variables that can be passed to the generated SDK client constructor. These variables will be automatically injected into API paths.
11+
12+
```yaml
13+
components:
14+
x-fern-sdk-variables:
15+
project_id:
16+
type: string
17+
description: "The project ID for the API"
18+
pattern: "^proj_[a-zA-Z0-9]+$"
19+
```
20+
21+
## x-fern-sdk-group-name
22+
23+
Groups related endpoints together in the generated SDK under a single namespace/class.
24+
25+
```yaml
26+
paths:
27+
/users:
28+
get:
29+
x-fern-sdk-group-name: "users"
30+
```
31+
32+
## x-fern-sdk-method-name
33+
34+
Specifies a custom method name to use in the generated SDK instead of the default operation ID.
35+
36+
```yaml
37+
paths:
38+
/users:
39+
get:
40+
x-fern-sdk-method-name: "list"
41+
```
42+
43+
## x-fern-pagination
44+
45+
Configures pagination handling for list endpoints.
46+
47+
```yaml
48+
paths:
49+
/users:
50+
get:
51+
x-fern-pagination:
52+
cursor: "$request.after"
53+
next_cursor: "$response.page_info.end_cursor"
54+
results: "$response.data"
55+
```
56+
57+
## x-fern-sdk-return-value
58+
59+
Specifies which part of the response should be returned by the SDK method.
60+
61+
```yaml
62+
paths:
63+
/users/{id}:
64+
get:
65+
x-fern-sdk-return-value: "data"
66+
```
67+
68+
## x-fern-ignore
69+
70+
Excludes an endpoint or schema from SDK generation.
71+
72+
```yaml
73+
paths:
74+
/internal/metrics:
75+
get:
76+
x-fern-ignore: true
77+
```
78+
79+
These extensions help customize how Fern generates SDKs from your OpenAPI specification while maintaining standard OpenAPI compatibility.
80+
81+
<Note>
82+
When using these extensions, make sure to validate that your OpenAPI specification remains valid according to the OpenAPI specification.
83+
</Note>

0 commit comments

Comments
 (0)