Skip to content

Commit d2e5577

Browse files
authored
(cli, api definitions) Document fern api update, make small adjustments to OpenAPI automation page (#879)
1 parent a65a067 commit d2e5577

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

fern/products/api-def/openapi-pages/automation.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Automatically pull your latest OpenAPI spec from a publicly available URL into y
88
## Setup
99
<Steps>
1010
<Step title="Configure the origin URL">
11-
Add the origin field to your generators.yml to specify where your OpenAPI spec is hosted:
11+
Add the `origin` field to your `generators.yml` to specify where your OpenAPI spec is hosted:
12+
1213
```yml title="generators.yml"
1314
api:
1415
specs:
@@ -18,8 +19,9 @@ Automatically pull your latest OpenAPI spec from a publicly available URL into y
1819
```
1920
</Step>
2021
<Step title="Add the GitHub Action">
21-
Create `.github/workflows/sync-openapi.yml` in your repository:
22-
```yml
22+
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.
23+
24+
```yml title=".github/workflows/sync-openapi.yml"
2325
name: Sync OpenAPI Specs # can be customized
2426
on: # additional custom triggers can be configured
2527
workflow_dispatch: # Manual trigger
@@ -57,4 +59,4 @@ This creates daily pull requests with any API spec updates. To change the freque
5759

5860
## Other use cases
5961

60-
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.
62+
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.

fern/products/cli-api-reference/pages/commands.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ hideOnThisPage: true
1313
| [`fern login`](#fern-login) | Login to Fern CLI via GitHub or Google |
1414
| [`fern logout`](#fern-logout) | Log out of the Fern CLI |
1515
| [`fern export`](#fern-export) | Export an OpenAPI spec for your API |
16+
| [`fern api update`](#fern-api-update) | Manually update your OpenAPI spec |
1617

1718
## Documentation Commands
1819

@@ -566,4 +567,24 @@ hideOnThisPage: true
566567
Use `--include-major` to include major version upgrades. Major versions are skipped by default to prevent breaking changes.
567568

568569
</Accordion>
570+
<Accordion title="fern api update">
571+
Pulls the latest OpenAPI spec from the specified `origin` in `generators.yml` and
572+
updates the local spec. Alternatively, you can [automate this process by setting up a GitHub Action](/api-definitions/openapi/sync-your-open-api-specification).
573+
574+
<CodeBlock title="terminal">
575+
```bash
576+
fern api update [--api <api>]
577+
```
578+
</CodeBlock>
579+
580+
### api
581+
582+
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.
583+
584+
<CodeBlock title="terminal">
585+
```bash
586+
fern api update --api public-api
587+
```
588+
</CodeBlock>
589+
</Accordion>
569590
</AccordionGroup>

fern/products/sdks/reference/generators-yml-reference.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ api:
195195
</ParamField>
196196
197197
<ParamField path="origin" type="string" toc={true}>
198-
URL of the API definition origin for polling updates.
198+
URL of the API definition origin for pulling updates.
199199
</ParamField>
200200
201201
<ParamField path="overrides" type="string" toc={true}>

fern/snippets/openapi-specs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ api:
2222
</ParamField>
2323
2424
<ParamField path="origin" type="string" toc={true}>
25-
URL of the API definition origin for polling updates.
25+
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).
2626
</ParamField>
2727
2828
<ParamField path="overrides" type="string" toc={true}>

0 commit comments

Comments
 (0)