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/openapi-pages/overview.mdx
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@ title: What is an OpenAPI Specification?
3
3
description: OpenAPI is a standard for documenting REST APIs
4
4
---
5
5
6
-
The OpenAPI Specification (OAS) is a framework used by developers to document REST APIs. The specification
6
+
The OpenAPI Specification (OAS) is a framework used by developers to document REST APIs. The specification is
7
7
written in JSON or YAML and contains all of your endpoints, parameters, schemas, and authentication schemes.
8
8
Fern is compatible with the latest OAS release, which is currently [v3.1.1](https://spec.openapis.org/#openapi-specification).
9
9
10
10
Below is an example of an OpenAPI file:
11
11
12
-
```yaml openapi.yml
12
+
```yamltitle="openapi.yml" maxLines=10
13
13
openapi: 3.0.2
14
14
info:
15
15
title: Petstore - OpenAPI 3.0
@@ -101,8 +101,46 @@ components:
101
101
name: api_key
102
102
in: header
103
103
```
104
+
## Best practices
104
105
105
-
## Setup your fern folder
106
+
Follow these best practices to ensure your OpenAPI specification generates high-quality SDKs and documentation:
107
+
108
+
- **Organize with proper project structure.** Follow the instructions at [Project structure](/api-definitions/overview/project-structure) to clearly organize the directories that contain your definition and other related files.
109
+
- **Add `operationId` to endpoints.** Include a clear `operationId` for each endpoint to control the function names generated in your SDKs. (Or use [extensions to customize group and method names](/api-definitions/openapi/extensions/method-names).)
110
+
- **Reference schemas instead of inlining.** Define reusable schemas in the `components/schemas` section and reference them with `$ref`. This promotes consistency, reduces duplication, and makes maintenance easier.
111
+
<Accordion title="Example of referencing schemas">
- **Use overrides and Fern extensions for customization.** Customize your specification using Fern [extensions](/api-definitions/openapi/extensions/overview) housed in an [overrides file](/api-definitions/overview/overrides). This lets you modify generation behavior without changing your core OpenAPI definition.
140
+
141
+
Once your OpenAPI spec follows these practices, you're ready to set up your fern folder.
142
+
143
+
## Set up your fern folder
106
144
107
145
<Info> Considering options to generate an OpenAPI spec? Get live support [here](https://fern-community.slack.com/join/shared_invite/zt-2dpftfmif-MuAegl8AfP_PK8s2tx350Q%EF%BB%BF#/shared-invite/email) </Info>
0 commit comments