diff --git a/fern/products/api-def/ferndef-pages/export-openapi.mdx b/fern/products/api-def/ferndef-pages/export-openapi.mdx index cf5b99cd4..3c1016842 100644 --- a/fern/products/api-def/ferndef-pages/export-openapi.mdx +++ b/fern/products/api-def/ferndef-pages/export-openapi.mdx @@ -3,21 +3,16 @@ 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. +To prevent lock-in to the Fern Definition format, you can export your API definition to OpenAPI 3.1 at any time [using the `fern export` command](/cli-api-reference/cli-reference/commands#fern-export). -Update your `generators.yml` file: +If you have multiple APIs defined in your `fern/apis/` folder, use `--api` to specify which API to export. - -```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 -``` - + + ```bash + fern export path/to/openapi.yml + fern export path/to/openapi.json + # Specify API to export + fern export --api public-api path/to/openapi.yml + ``` + \ No newline at end of file diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index 8437abd49..d6529d649 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -12,6 +12,7 @@ hideOnThisPage: true | [`fern upgrade`](#fern-upgrade) | Update Fern CLI & generators to latest versions | | [`fern login`](#fern-login) | Login to Fern CLI via GitHub or Google | | [`fern logout`](#fern-logout) | Log out of the Fern CLI | +| [`fern export`](#fern-export) | Export an OpenAPI spec for your API | ## Documentation Commands @@ -140,6 +141,33 @@ hideOnThisPage: true + + + Use `fern export` to generate an OpenAPI spec for your API. + + This command is useful when you've defined your API in a format other than OpenAPI (such as the [Fern Definition](/api-definitions/ferndef/overview)) and need to export it as an OpenAPI spec for integration with other tools or services. + + + + ```bash + fern export [--api ] path/to/openapi.yml + fern export [--api ] path/to/openapi.json + ``` + + + ### api + + Use `--api` to specify which API to export when you have multiple APIs defined in your `fern/apis/` folder. + + + ```bash + fern export --api public-api path/to/openapi.yml + fern export --api public-api path/to/openapi.json + ``` + + + + Use `fern generate` to run the Fern compiler and create SDKs for your API. diff --git a/fern/products/sdks/snippets/initialize-fern-folder-intro.mdx b/fern/products/sdks/snippets/initialize-fern-folder-intro.mdx index 7f9cd4b86..857cc241c 100644 --- a/fern/products/sdks/snippets/initialize-fern-folder-intro.mdx +++ b/fern/products/sdks/snippets/initialize-fern-folder-intro.mdx @@ -1,5 +1,5 @@ You can initialize your fern folder with either a Fern Definition or OpenAPI specification. - You can always convert a Fern Definition to OpenAPI or OpenAPI to a Fern Definition later on. + You can always convert a [Fern Definition to OpenAPI](/api-definitions/ferndef/export-openapi) or OpenAPI to a Fern Definition later on. \ No newline at end of file