|
| 1 | +<Accordion title="Option 3: Fern Definition"> |
1 | 2 | 1. Initialize the Fern folder using the Fern Definition by running the following command: |
2 | 3 |
|
3 | | - ```bash |
4 | | - fern init --organization <YourOrganization> |
5 | | - ``` |
| 4 | + ```bash |
| 5 | + fern init --organization <YourOrganization> |
| 6 | + ``` |
6 | 7 |
|
7 | | - <Info> |
8 | | - `--organization <YourOrganization>` configures your organization name in `fern.config.json`. This is required in order to successfully generate your SDK. |
9 | | - </Info> |
| 8 | + <Info> `--organization <YourOrganization>` configures your organization |
| 9 | + name in `fern.config.json`. This is required in order to successfully |
| 10 | + generate your SDK. </Info> |
10 | 11 |
|
11 | | - This creates a `fern` folder in your current directory with the Fern Definition. |
| 12 | + This creates a `fern` folder in your current directory with the Fern Definition. |
12 | 13 |
|
13 | | - ```bash |
14 | | - fern/ |
15 | | - ├─ fern.config.json # root-level configuration |
16 | | - ├─ generators.yml # generators you're using |
17 | | - └─ definition/ |
18 | | - ├─ api.yml # API-level configuration |
19 | | - └─ imdb.yml # endpoints, types, and errors |
20 | | - ``` |
| 14 | + ```bash |
| 15 | + fern/ |
| 16 | + ├─ fern.config.json # root-level configuration |
| 17 | + ├─ generators.yml # generators you're using |
| 18 | + └─ definition/ |
| 19 | + ├─ api.yml # API-level configuration |
| 20 | + └─ imdb.yml # endpoints, types, and errors |
| 21 | + ``` |
21 | 22 |
|
22 | | - <Note> |
23 | | - `imdb.yml` contains an example movies API. If you’re just generating an SDK for test purposes, you can leave this file as it is. To generate an SDK for your own API instead of the example movies API, replace `imdb.yml` with your own endpoints, types, and errors before proceeding with the rest of this page. |
24 | | - </Note> |
| 23 | + <Note> `imdb.yml` contains an example movies API. If you’re just |
| 24 | + generating an SDK for test purposes, you can leave this file as it is. To |
| 25 | + generate an SDK for your own API instead of the example movies API, |
| 26 | + replace `imdb.yml` with your own endpoints, types, and errors before |
| 27 | + proceeding with the rest of this page. </Note> |
25 | 28 |
|
26 | | - {/* TODO: show want generators.yml looks like, link out to configuration.md */} |
| 29 | + {/* TODO: show what generators.yml looks like, link out to configuration.md */} |
| 30 | + |
| 31 | + 1. Add the config option `outputSourceFiles: true` to |
| 32 | + `generators.yml`. This ensures your SDK contains source files in |
| 33 | + your designated language instead of compiled output. |
| 34 | + |
| 35 | + ```yaml {11-12} |
| 36 | + # yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json |
| 37 | + default-group: local |
| 38 | + groups: |
| 39 | + local: |
| 40 | + generators: |
| 41 | + - name: fernapi/fern-typescript-node-sdk |
| 42 | + output: |
| 43 | + location: local-file-system |
| 44 | + path: ../sdks/typescript |
| 45 | + version: <Markdown src="/snippets/version-number.mdx"/> |
| 46 | + config: |
| 47 | + outputSourceFiles: true |
| 48 | + ``` |
| 49 | +
|
| 50 | + <Note>`fern init` creates a default configuration that includes the |
| 51 | + TypeScript Node SDK generator. The `local` group containing this |
| 52 | + generator only generates if you run fern generate without specifying a |
| 53 | + group, or if you explicitly target it with `fern generate --group |
| 54 | + local`. In subsequent steps, you'll add an additional generator for your |
| 55 | + preferred SDK language.</Note> |
0 commit comments