OpenAPI Specification

Fern | Import an OpenAPI specification to use with Fern

To use an OpenAPI spec, you can pass in the filepath or URL.

To pass in an OpenAPI spec from a filepath:

$npm install -g fern-api
>fern init --openapi <filepath to openapi>

Alternatively, to point to the URL of an OpenAPI spec:

$npm install -g fern-api
>fern init --openapi <url to openapi>

Fern will generate the following directory with your OpenAPI spec inside of it.

$fern/
>├─ fern.config.json
>└─ api/
> ├─ generators.yml
> └─ openapi/
> └─ openapi.json # <--- your openapi file

Run fern check to validate the OpenAPI spec. Resolve any errors. Having trouble? Reach out in the Fern Discord server.

If you’re having trouble understanding the errors, run the command fern write-definition. This command will convert your OpenAPI spec into a Fern Definition. Read more.

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