From 1fb39bfb518eae086b4481f87f4494edbac7838f Mon Sep 17 00:00:00 2001 From: Devin Logan Date: Thu, 18 Sep 2025 12:51:12 -0400 Subject: [PATCH] document fern api update --- .../api-def/openapi-pages/automation.mdx | 10 +++++---- .../cli-api-reference/pages/commands.mdx | 21 +++++++++++++++++++ .../reference/generators-yml-reference.mdx | 2 +- fern/snippets/openapi-specs.mdx | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/fern/products/api-def/openapi-pages/automation.mdx b/fern/products/api-def/openapi-pages/automation.mdx index b4986eea6..8258c8420 100644 --- a/fern/products/api-def/openapi-pages/automation.mdx +++ b/fern/products/api-def/openapi-pages/automation.mdx @@ -8,7 +8,8 @@ Automatically pull your latest OpenAPI spec from a publicly available URL into y ## Setup - Add the origin field to your generators.yml to specify where your OpenAPI spec is hosted: + Add the `origin` field to your `generators.yml` to specify where your OpenAPI spec is hosted: + ```yml title="generators.yml" api: specs: @@ -18,8 +19,9 @@ Automatically pull your latest OpenAPI spec from a publicly available URL into y ``` - Create `.github/workflows/sync-openapi.yml` in your repository: - ```yml + Create `.github/workflows/sync-openapi.yml` in your repository. This action uses [`fern api update`](/cli-api-reference/cli-reference/commands#fern-api-update) to pull the latest version of your OpenAPI spec from the `origin` field in your `generators.yml` file. + + ```yml title=".github/workflows/sync-openapi.yml" name: Sync OpenAPI Specs # can be customized on: # additional custom triggers can be configured workflow_dispatch: # Manual trigger @@ -57,4 +59,4 @@ This creates daily pull requests with any API spec updates. To change the freque ## Other use cases -If your OpenAPI spec lives in a different repository (rather than at a public URL), you can sync it to your Fern folder using cross-repository sync. See the [sync-openapi GitHub Action README](https://github.com/fern-api/sync-openapi) for this and other advanced configurations. +If your OpenAPI spec lives in a different repository (rather than at a public URL), you can sync it to your Fern folder using explicit file mappings. See the [sync-openapi GitHub Action README](https://github.com/fern-api/sync-openapi) for this and other advanced configurations. diff --git a/fern/products/cli-api-reference/pages/commands.mdx b/fern/products/cli-api-reference/pages/commands.mdx index 527580e9e..10febd0d8 100644 --- a/fern/products/cli-api-reference/pages/commands.mdx +++ b/fern/products/cli-api-reference/pages/commands.mdx @@ -13,6 +13,7 @@ hideOnThisPage: true | [`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 | +| [`fern api update`](#fern-api-update) | Manually update your OpenAPI spec | ## Documentation Commands @@ -566,4 +567,24 @@ hideOnThisPage: true Use `--include-major` to include major version upgrades. Major versions are skipped by default to prevent breaking changes. + + Pulls the latest OpenAPI spec from the specified `origin` in `generators.yml` and + updates the local spec. Alternatively, you can [automate this process by setting up a GitHub Action](/api-definitions/openapi/sync-your-open-api-specification). + + + ```bash + fern api update [--api ] + ``` + + + ### api + + Use `--api` to specify the API to update if there are multiple specs with a defined `origin` in `generators.yml`. If you don't specify an API, all OpenAPI specs with an `origin` will be updated. + + + ```bash + fern api update --api public-api + ``` + + diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index 921814914..cded12e7b 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -195,7 +195,7 @@ api: - URL of the API definition origin for polling updates. + URL of the API definition origin for pulling updates. diff --git a/fern/snippets/openapi-specs.mdx b/fern/snippets/openapi-specs.mdx index 7bb11b54b..7c364addb 100644 --- a/fern/snippets/openapi-specs.mdx +++ b/fern/snippets/openapi-specs.mdx @@ -22,7 +22,7 @@ api: - URL of the API definition origin for polling updates. + URL of the API definition origin for pulling updates. For instructions on how to set up automatic syncing, refer to [Sync your OpenAPI specification](/learn/api-definitions/openapi/sync-your-open-api-specification).