fern write-definition

fern write-definition will convert your OpenAPI specification into a Fern Definition. A pre-requisite is a folder within your Fern directory named openapi that contains a json or yml file.

When ran successfully, this command produces no output in the command line, and creates a new folder within your fern directory called definition.


$fern write-definition
1 fern/
2 ├─ fern.config.json
3 ├─ generators.yml
4 └─ openapi/
5 └─ openapi.json
6+ └─ definition/ <--- your Fern Definition
7+ └─ api.yml
8+ └─ __package__.yml

If you have an openapi folder and a definition folder, Fern defaults to reading your OpenAPI specification. Remove the openapi folder if you’d like to use your Fern Definition as an input to Fern’s generators.