1. Import an existing API
  2. OpenAPI

To use an OpenAPI spec with Fern, add it to your API’s definition/ folder.

├─ fern.config.json
└─ api/
  ├─ generators.yml
  └─ definition/
    └─ openapi.json # <--- also supports openapi.yml

Run fern check to validate the OpenAPI spec.

If there are no errors, you can run fern generate.

Convert OpenAPI to a Fern Definition

If you’d rather maintain a Fern Definition instead of OpenAPI, then you can run a one-time conversion.

npm install -g fern-api
fern init --openapi <path to openapi>