diff --git a/fern/products/fern-def/pages/export-openapi.mdx b/fern/products/fern-def/pages/export-openapi.mdx index cf5b99cd..60800a62 100644 --- a/fern/products/fern-def/pages/export-openapi.mdx +++ b/fern/products/fern-def/pages/export-openapi.mdx @@ -1,23 +1,52 @@ ---- -title: Export from Fern Definition to OpenAPI -description: Export your Fern Definition files to OpenAPI using Fern's OpenAPI generator. ---- - -To prevent lock-in to the Fern Definition format, we provide a generator that will export your Fern Def files to OpenAPI 3.1. -This lets you switch to using OpenAPI at any time, or use your API definition with OpenAPI tools. -To convert your Fern Definition to OpenAPI, use the `fern-openapi` generator. - -Update your `generators.yml` file: - - -```yaml -- name: fernapi/fern-openapi - version: 0.0.31 - config: - format: yaml # options are yaml or json - output: - location: local-file-system - path: ../openapi # relative path to output location -``` - - +--- +title: Export from Fern Definition to OpenAPI +description: Export your Fern Definition files to OpenAPI using Fern's CLI or generator. +--- + +There are two ways to export your Fern Definition to OpenAPI: + +## Using the CLI (Recommended) + +The simplest way to export your Fern Definition to OpenAPI is using the `fern export` command: + + +```bash +fern export --format openapi +``` + + +By default, this exports OpenAPI files in YAML format to the `generated/openapi` directory. You can customize the output format and location using flags: + + + The output format: `yaml` (default) or `json` + + + + The output directory path (default: `generated/openapi`) + + +## Using the Generator + +For more advanced configuration options, you can also use the `fern-openapi` generator. Update your `generators.yml` file: + + +```yaml +- name: fernapi/fern-openapi + version: 0.0.31 + config: + format: yaml # options are yaml or json + output: + location: local-file-system + path: ../openapi # relative path to output location +``` + + +Then run: + + +```bash +fern generate +``` + + +Both methods prevent lock-in to the Fern Definition format by allowing you to export to OpenAPI 3.1 at any time. This lets you switch to using OpenAPI or use your API definition with OpenAPI-compatible tools. \ No newline at end of file