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
Create beautiful documentation in under 5 minutes. Here's [an example!](https://petstore-openapi.docs.buildwithfern.com)
11
+
Create beautiful documentation in under 5 minutes using an OpenAPI/Swagger specification. Here's [an example!](https://petstore-openapi.docs.buildwithfern.com)
The OpenAPI specification is a language for defining a REST API. OpenAPI (3.x) was previously known as Swagger (2.x) and is a widely used standard for defining RESTful APIs. Fern supports both OpenAPI 3.x and Swagger 2.x.
32
+
31
33
### Step 1: Use this template
32
34
33
35
1. Click on the "Use this template" button. You must be logged into GitHub.
@@ -57,39 +59,53 @@ instances:
57
59
- url: petstore-openapi.docs.buildwithfern.com
58
60
```
59
61
60
-
61
62
### Step 4: Install the Fern CLI
62
63
63
64
Install the Fern CLI globally by running:
64
65
65
66
```bash
66
67
npm install -g fern-api
67
68
```
69
+
68
70
As this is a global command, you can run it from any location. The CLI commands in the following steps must be run from within your repository.
69
71
70
-
### Step 5 (Optional): Use an OpenAPI Specification
72
+
### Step 5: (Optional) Use your OpenAPI/Swagger specification
71
73
72
-
If you will be using [Fern Definitions](https://docs.buildwithfern.com/api-definition/fern-definition/overview) to describe your API, skip to [Step 6](#step-6-generate-your-documentation).
74
+
If you'd like to use the an example OpenAPI specificaton file, run:
73
75
74
-
If you will be using the [OpenAPI Specification](https://chat.openai.com/share/47bcc007-17d8-483a-ab5a-91c10c4a73e1) (OAS), follow these steps:
You can use a URL to an OAS file online, or you can use a local path. The file must be formatted as JSON or YAML.
89
-
90
94
Confirm that you see a new folder named `openapi` and that it contains the OAS file you specified, in YAML format.
91
95
92
-
### Step 6: Generate your documentation
96
+
*Note: Don't have an OpenAPI spec? Use Fern's simpler format to define your API.*[*Learn more*](https://github.com/fern-api/docs-starter-fern-definition)
97
+
98
+
### Step 6: Check that your OpenAPI specification is valid
99
+
100
+
Run the following command to check that your OpenAPI/Swagger specification is valid:
101
+
102
+
```bash
103
+
fern check
104
+
```
105
+
106
+
If you see errors, resolve them in your OpenAPI/Swagger specification file. If you need help, reach out in [Discord](https://discord.com/invite/JkkXumPzcG) or [via email](mailto:support@buildwithfern.com). We're here to help!
107
+
108
+
### Step 7: Generate your documentation
93
109
94
110
Generate and publish your documentation with the following command:
95
111
@@ -106,11 +122,8 @@ Once the documentation is generated, you will receive a URL where your documenta
106
122
│ ✓ petstore-openapi.docs.buildwithfern.com
107
123
└─
108
124
```
109
-
### Step 7: Customize your documentation
110
125
111
-
To update your API definitions:
112
-
- For [Fern Definitions](https://docs.buildwithfern.com/api-definition/fern-definition/overview), update the files in the `definition` folder.
113
-
- For OpenAPI Specification, update the file in the `openapi` folder. YAML and JSON file formats are supported.
126
+
### Step 8: Customize your documentation
114
127
115
128
Next, modify the markdown pages located in the `docs/pages` folder, such as the Welcome page.
116
129
@@ -122,7 +135,7 @@ To preview updates to your documentation before publishing changes, run `fern ge
122
135
123
136
Fern has a built-in component library for you to use. [Explore the components.](https://docs.buildwithfern.com/generate-docs/component-library/)
124
137
125
-
### Step 8: Set up a custom domain
138
+
### Step 9: Set up a custom domain
126
139
127
140
If you wish to use a custom subdomain like `https://docs.YOUR_ORGANIZATION.com` or a subpath like `https://YOUR_ORGANIZATION.com/docs`, you can subscribe to the [Starter plan](https://buildwithfern.com/pricing). Once subscribed, update `docs.yml` with the custom domain configuration:
128
141
@@ -131,7 +144,7 @@ If you wish to use a custom subdomain like `https://docs.YOUR_ORGANIZATION.com`
131
144
custom-domain: docs.petstore-openapi.com
132
145
```
133
146
134
-
### Step 9: Explore advanced features
147
+
### Step 10: Explore advanced features
135
148
136
149
For advanced documentation features and options, view the full [configuration docs](https://docs.buildwithfern.com/generate-docs/overview/configuration).
0 commit comments