You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/api-def/pages/project-structure.mdx
+60-2Lines changed: 60 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ fern/
18
18
└─ spec-file.yml # API definition file
19
19
```
20
20
21
+
You can optionally add an `overrides.yml` file to further customize your API definition.
22
+
21
23
### `fern.config.json file`
22
24
23
25
Every fern folder has a single `fern.config.json` file. This file stores the organization and
@@ -38,8 +40,9 @@ determinism.
38
40
The `generators.yml` file includes information about where your API definition file is located. It also [configures the SDKs](/sdks/overview/github) you're generating for your API.
39
41
40
42
```yaml title="generators.yml"
41
-
api:
42
-
path: ./path/to/openapi.yml
43
+
api:
44
+
specs:
45
+
- openapi: spec-file.yml
43
46
```
44
47
45
48
### API definition file
@@ -48,6 +51,61 @@ api:
48
51
49
52
For the other specification formats ([OpenAPI](/api-definitions/openapi/overview), [AsyncAPI](/api-definitions/asyncapi/overview), [OpenRPC](/api-definitions/openrpc/overview), and [gRPC](/api-definitions/grpc/overview)), you'll have a single self-contained specification file.
50
53
54
+
### `overrides.yml` file (optional)
55
+
56
+
Beyond the core files, you can optionally customize your API definition using overrides. A separate `overrides.yml` file allows you to customize your API definition without modifying the original spec file. This is useful when:
57
+
58
+
* Your API specification is auto-generated from server code
59
+
* You need different configurations for SDKs versus documentation
60
+
61
+
When you run `fern generate`, Fern combines your original API specification with the overrides file.
62
+
63
+
To use overrides, [create an `overrides.yml` file](/api-definitions/openapi/extensions/method-names) in the folder that contains your API definition:
64
+
65
+
```bash {6}
66
+
fern/
67
+
├─ fern.config.json
68
+
├─ generators.yml
69
+
└─ spec-folder/
70
+
├─ spec-file.yml
71
+
└─ overrides.yml
72
+
```
73
+
74
+
Reference your overrides file in your `generators.yml`:
75
+
76
+
```yaml title="generators.yml"
77
+
api:
78
+
specs:
79
+
- openapi: spec-file.yml
80
+
overrides: ./overrides.yml
81
+
```
82
+
83
+
<Accordion title="Separate overrides for SDKs and Docs">
84
+
85
+
For separate SDK and documentation configurations, you can use different override files in separate folders with their own `generators.yml` files. Both `generators.yml` files can be identical except for pointing to different override files.
Copy file name to clipboardExpand all lines: fern/products/sdks/github-setup.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,10 @@ See the [`generators.yml` reference page](/sdks/reference/generators-yml) for co
78
78
79
79
For information on how to structure your API definition files, see [Project structure (API Definitions)](/api-definitions/overview/project-structure).
80
80
81
+
### Optional: `overrides.yml` file
82
+
83
+
You can optionally add an `overrides.yml` file to customize your API definition without modifying the original spec file. For more information, see [Project structure (API Definitions)](/api-definitions/overview/project-structure#overrides).
84
+
81
85
## Child repository structure
82
86
83
87
Each SDK has its own repository with the following structure:
0 commit comments