-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where misconfigured directory could cause unhelpful error m…
…essage (#4206)
- Loading branch information
Showing
14 changed files
with
186 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
fern/pages/api-definition/introduction/what-is-the-fern-folder.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
title: The Fern Folder | ||
description: Describes the Fern folder structure | ||
--- | ||
|
||
Configuring fern starts with the `fern` folder. The fern folder contains your API definitions, | ||
generators, and your CLI version. | ||
|
||
## Directory Structure | ||
|
||
When you run `fern init`, your Fern folder will be initialized with the following files: | ||
```yaml | ||
fern/ | ||
├─ fern.config.json | ||
├─ generators.yml | ||
└─ definition/ | ||
├─ api.yml | ||
└─ imdb.yml | ||
``` | ||
|
||
If you want to intialize Fern with an OpenAPI spec, run `fern init --openapi path/to/openapi` instead. | ||
```yaml | ||
fern/ | ||
├─ fern.config.json | ||
├─ generators.yml | ||
└─ openapi/ | ||
├─ openapi.yml | ||
``` | ||
|
||
### `fern.config.json` | ||
|
||
Every fern folder has a single `fern.config.json` file. This file stores the organization and | ||
the version of the Fern CLI that you are using. | ||
|
||
```json | ||
{ | ||
"organization": "imdb", | ||
"version": "0.31.2" | ||
} | ||
``` | ||
|
||
Every time you run a fern CLI command, the CLI downloads itself at the correct version to ensure | ||
determinism. | ||
|
||
<Note>To upgrade the CLI, run `fern upgrade`. This will update the version field in `fern.config.json` </Note> | ||
|
||
### `generators.yml` | ||
|
||
The `generators.yml` file includes information about which generators you are using, where each package gets published, | ||
as well as configuration specific to each generator. | ||
|
||
Every `generators.yml` file contains groups of generators. In the example below, we have a group called `public` which | ||
generates Python + TypeScript SDKs. | ||
```yaml | ||
groups: | ||
public: | ||
generators: | ||
- name: fernapi/fern-python-sdk | ||
version: 3.0.0 | ||
output: | ||
location: pypi | ||
package-name: imdb | ||
token: ${PYPI_TOKEN} | ||
github: | ||
repository: imdb/imdb-python | ||
config: | ||
client_class_name: imdb | ||
- name: fernapi/fern-typescript-node-sdk | ||
version: 0.31.0 | ||
output: | ||
location: npm | ||
package-name: imdb | ||
token: ${NPM_TOKEN} | ||
github: | ||
repository: imdb/imdb-node | ||
config: | ||
namespaceExport: imdb | ||
``` | ||
## Multiple APIs | ||
The Fern folder is capable of housing multiple API definitions. Instead of placing your API definition | ||
at the top-level, you can nest them within an `apis` folder. | ||
|
||
```yaml | ||
fern/ | ||
├─ fern.config.json | ||
├─ generators.yml | ||
└─ apis/ | ||
└─ imdb/ | ||
├─ generators.yml | ||
└─ openapi/ | ||
├─ openapi.yml | ||
└─ disney/ | ||
├─ generators.yml | ||
└─ openapi/ | ||
├─ openapi.yml | ||
``` |
16 changes: 9 additions & 7 deletions
16
packages/cli/ete-tests/src/tests/validate/__snapshots__/validate.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 1 addition & 20 deletions
21
packages/cli/ete-tests/src/tests/validate/fixtures/docs/fern/docs.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,2 @@ | ||
instances: | ||
- url: dummy.docs.buildwithfern.com | ||
|
||
tabs: | ||
help: | ||
display-name: Help Center | ||
icon: "fa-solid fa-cube" | ||
navigation: | ||
- tab: help | ||
layout: | ||
- section: Dummy Section | ||
contents: | ||
- page: Dummy Page | ||
path: ./dummy-page.mdx | ||
title: Dummy | Documentation | ||
colors: | ||
accentPrimary: "#a3d3ff" | ||
logo: | ||
dark: logo.png | ||
href: https://www.dummy.com/ | ||
favicon: favicon.ico | ||
- url: ferndevtest.docs.dev.buildwithfern.com |
6 changes: 6 additions & 0 deletions
6
packages/cli/ete-tests/src/tests/validate/fixtures/no-api/fern/definition/other.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
types: | ||
MyType: MissingType | ||
errors: | ||
MyError: | ||
type: string | ||
status-code: 400 |
2 changes: 2 additions & 0 deletions
2
packages/cli/ete-tests/src/tests/validate/fixtures/no-api/fern/docs.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
instances: | ||
- url: ferndevtest.docs.dev.buildwithfern.com |
4 changes: 4 additions & 0 deletions
4
packages/cli/ete-tests/src/tests/validate/fixtures/no-api/fern/fern.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "*", | ||
"organization": "fern" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/cli/ete-tests/src/tests/validate/fixtures/no-generator/fern/apis/api1/api.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: simple-api |
4 changes: 4 additions & 0 deletions
4
packages/cli/ete-tests/src/tests/validate/fixtures/no-generator/fern/fern.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "*", | ||
"organization": "fern" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters