Using OpenAPI
Importing OpenAPI
Already have an OpenAPI? No problem.
To use an OpenAPI spec, run the command below.
npm install -g fern-api
fern init --openapi <filepath to openapi>
You can also point to a URL
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.
If there are no errors, you can run fern generate.