Skip to content

Commit dea4743

Browse files
committed
add overlay/embed info to asyncapi and openrpc
1 parent 4903a7c commit dea4743

File tree

5 files changed

+81
-76
lines changed

5 files changed

+81
-76
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ navigation:
4848
path: ./openapi-pages/extensions/examples.mdx
4949
- page: Global headers
5050
path: ./openapi-pages/extensions/global-headers.mdx
51-
- page: Ignoring schemas or endpoints
51+
- page: Ignoring elements
5252
path: ./openapi-pages/extensions/ignore.mdx
5353
- page: SDK method names
5454
path: ./openapi-pages/extensions/method-names.mdx
@@ -109,7 +109,7 @@ navigation:
109109
path: ./asyncapi-pages/extensions/error-handling.mdx
110110
- page: Request + response examples
111111
path: ./asyncapi-pages/extensions/examples.mdx
112-
- page: Ignoring operations, channels, or schemas
112+
- page: Ignoring elements
113113
path: ./asyncapi-pages/extensions/ignore.mdx
114114
- page: SDK method names
115115
path: ./asyncapi-pages/extensions/method-names.mdx
@@ -168,7 +168,7 @@ navigation:
168168
path: ./openrpc-pages/extensions/error-handling.mdx
169169
- page: Request + response examples
170170
path: ./openrpc-pages/extensions/examples.mdx
171-
- page: Ignoring methods or schemas
171+
- page: Ignoring elements
172172
path: ./openrpc-pages/extensions/ignore.mdx
173173
- page: SDK method names
174174
path: ./openrpc-pages/extensions/method-names.mdx
@@ -231,7 +231,7 @@ navigation:
231231
path: ./grpc-pages/extensions/error-handling.mdx
232232
- page: Request + response examples
233233
path: ./grpc-pages/extensions/examples.mdx
234-
- page: Ignoring services, methods, or messages
234+
- page: Ignoring elements
235235
path: ./grpc-pages/extensions/ignore.mdx
236236
- page: SDK method names
237237
path: ./grpc-pages/extensions/method-names.mdx

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Overview of AsyncAPI extensions
33
description: Learn about Fern's AsyncAPI extensions for generating higher-quality SDKs
44
---
55

6-
Fern supports a variety of AsyncAPI extensions that enhance your API specification and generate higher-quality SDKs.
6+
Fern supports a variety of AsyncAPI extensions that enhance your API specification and generate higher-quality SDKs. You can apply these extensions in two ways: by overlaying them in separate override files or by embedding them directly in your AsyncAPI specification.
77

88
## Available extensions
99

@@ -22,4 +22,6 @@ The table below shows all available extensions and links to detailed documentati
2222

2323
<Note title="Request a new extension">
2424
If there's an extension you want that doesn't already exist, file an [issue](https://github.com/fern-api/fern/issues/new) to start a discussion about it.
25-
</Note>
25+
</Note>
26+
27+
<Markdown src="/snippets/overlay-embed-extensions.mdx" />

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

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -29,72 +29,7 @@ The table below shows all available extensions and links to detailed documentati
2929
If there's an extension you want that doesn't already exist, file an [issue](https://github.com/fern-api/fern/issues/new) to start a discussion about it.
3030
</Note>
3131

32-
## Overlaying extensions
33-
34-
Overlaying extensions allows you to keep your original OpenAPI specification clean while adding Fern-specific customizations in a separate file. This approach is ideal when you're using multiple tools that consume your OpenAPI spec, or when you want to maintain a pristine source specification.
35-
36-
To use overlays, specify an overrides file in your `generators.yml` configuration.
37-
38-
The example below shows how to overlay SDK naming extensions. The first tab shows the `generators.yml` configuration that references an overrides file, the second tab contains the overrides file with Fern extensions, and the third tab shows the final result when the extensions are applied to your original OpenAPI specification.
39-
40-
<CodeBlocks>
41-
```yaml title="generators.yml" {3}
42-
api:
43-
path: ./openapi/openapi.yaml
44-
overrides: ./openapi/overrides.yaml
45-
default-group: sdk
46-
groups:
47-
sdk:
48-
generators:
49-
- name: fernapi/fern-python-sdk
50-
version: 2.2.0
51-
```
52-
53-
```yaml title="overrides.yml" {4-5}
54-
paths:
55-
/users:
56-
get:
57-
x-fern-sdk-group-name: users
58-
x-fern-sdk-method-name: get
59-
```
60-
61-
```yaml title="Overlaid OpenAPI" {4-5}
62-
paths:
63-
/users:
64-
get:
65-
x-fern-sdk-group-name: users
66-
x-fern-sdk-method-name: get
67-
summary: Get a list of users
68-
description: Retrieve a list of users from the system.
69-
responses:
70-
'200':
71-
description: Successful response
72-
'500':
73-
description: Internal Server Error
74-
```
75-
76-
</CodeBlocks>
77-
78-
## Embedding extensions
79-
80-
Instead of using overlay files, you can embed Fern extensions directly within your OpenAPI specification or source code. This approach is useful when you want to keep extensions close to your API definitions or when using frameworks that support custom extensions.
81-
82-
### Direct embedding in OpenAPI
83-
84-
You can add Fern extensions directly to your OpenAPI specification:
85-
86-
```yaml title="openapi.yml"
87-
paths:
88-
/users:
89-
get:
90-
x-fern-sdk-group-name: users
91-
x-fern-sdk-method-name: listUsers
92-
x-fern-availability: generally-available
93-
summary: Get a list of users
94-
responses:
95-
'200':
96-
description: Successful response
97-
```
32+
<Markdown src="/snippets/overlay-embed-extensions.mdx" />
9833

9934
### FastAPI
10035

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: Overview of OpenRPC extensions
33
description: Learn about Fern's OpenRPC extensions for generating higher-quality SDKs
44
---
55

6-
Fern supports a variety of OpenRPC extensions that enhance your API specification and generate higher-quality SDKs.
7-
8-
The table below shows all available extensions and links to detailed documentation for each one.
6+
Fern supports a variety of OpenRPC extensions that enhance your API specification and generate higher-quality SDKs. You can apply these extensions in two ways: by overlaying them in separate override files or by embedding them directly in your OpenRPC specification.
97

108
## Available extensions
119

10+
The table below shows all available extensions and links to detailed documentation for each one.
11+
1212
| Extension | Description |
1313
| --- | --- |
1414
| [`x-fern-ignore`](./ignore) | Skip reading specific methods or schemas |
@@ -25,4 +25,6 @@ The table below shows all available extensions and links to detailed documentati
2525

2626
<Note title="Request a new extension">
2727
If there's an extension you want that doesn't already exist, file an [issue](https://github.com/fern-api/fern/issues/new) to start a discussion about it.
28-
</Note>
28+
</Note>
29+
30+
<Markdown src="/snippets/overlay-embed-extensions.mdx" />
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
## Overlaying extensions
2+
3+
Overlaying extensions allows you to keep your original API specification clean while adding Fern-specific customizations in a separate file. This approach is ideal when you're using multiple tools that consume your API spec, or when you want to maintain a pristine source specification.
4+
5+
To use overlays, specify an overrides file in your `generators.yml` configuration.
6+
7+
The example below shows how to overlay SDK naming extensions. The first tab shows the `generators.yml` configuration that references an overrides file, the second tab contains the overrides file with Fern extensions, and the third tab shows the final result when the extensions are applied to your original API specification.
8+
9+
<CodeBlocks>
10+
```yaml title="generators.yml" {3}
11+
api:
12+
path: ./spec-folder/spec-file.yaml
13+
overrides: ./spec-folder/overrides.yaml # Reference your overrides file
14+
default-group: sdk
15+
groups:
16+
sdk:
17+
generators:
18+
- name: fernapi/fern-python-sdk
19+
version: 2.2.0
20+
```
21+
22+
```yaml title="overrides.yml" {4-5}
23+
paths:
24+
/users:
25+
get:
26+
x-fern-sdk-group-name: users
27+
x-fern-sdk-method-name: get
28+
```
29+
30+
```yaml title="Overlaid spec" {4-5}
31+
paths:
32+
/users:
33+
get:
34+
x-fern-sdk-group-name: users
35+
x-fern-sdk-method-name: get
36+
summary: Get a list of users
37+
description: Retrieve a list of users from the system.
38+
responses:
39+
'200':
40+
description: Successful response
41+
'500':
42+
description: Internal Server Error
43+
```
44+
45+
</CodeBlocks>
46+
47+
## Embedding extensions
48+
49+
Instead of using overlay files, you can embed Fern extensions directly within your API specification or source code. This approach is useful when you want to keep extensions close to your API definitions or when using frameworks that support custom extensions.
50+
51+
### Direct embedding
52+
53+
You can add Fern extensions directly to your API specification:
54+
55+
```yaml title="spec-file.yml" {4-6}
56+
paths:
57+
/users:
58+
get:
59+
x-fern-sdk-group-name: users
60+
x-fern-sdk-method-name: listUsers
61+
x-fern-availability: generally-available
62+
summary: Get a list of users
63+
responses:
64+
'200':
65+
description: Successful response
66+
```

0 commit comments

Comments
 (0)