Skip to content

Commit 1e80cf5

Browse files
authored
Document availability for sections, pages, versions, and APIs (#769)
1 parent f12fa24 commit 1e80cf5

File tree

8 files changed

+105
-8
lines changed

8 files changed

+105
-8
lines changed

fern/products/api-def/ferndef-pages/availability.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ title: Availability in Fern Definition
33
description: Add availability to Fern Definition API services, endpoints, types, or properties to indicate their release status.
44
---
55

6-
You can add `availability` to an endpoint, type, or property within your Fern Definition.
6+
You can add `availability` to an endpoint, type, or property within your Fern Definition. You can configure the `availability` of sections in your API reference documentation in your [`docs.yml` file](/learn/docs/configuration/what-is-docs-yml).
7+
8+
## Endpoints, types, and properties
79

810
Availability can be:
911
- `in-development` which means it is being worked on; will show a `Beta` tag
1012
- `pre-release` which means it is available; will show a `Beta` tag
1113
- `deprecated` which means it will be removed in the future; will show a `Deprecated` tag
1214
- `generally-available` which means it is stable and available for use; will show a `GA` tag
1315

14-
## Endpoint
16+
### Endpoint
1517

1618
<CodeBlock title="pet.yml">
1719
```yaml {6}
@@ -36,7 +38,7 @@ In Fern Docs, this will look like:
3638
![Screenshot showing a deprecated tag next to an endpoint in API Reference docs](https://fern-image-hosting.s3.amazonaws.com/endpoint-deprecated.png)
3739
</Frame>
3840
39-
## Type
41+
### Type
4042
4143
<CodeBlock title="pet.yml">
4244
```yaml {15}
@@ -69,7 +71,7 @@ In Fern Docs, this will look like:
6971
![Screenshot showing a beta tag next to a type in API Reference docs](https://fern-image-hosting.s3.amazonaws.com/type-beta.png)
7072
</Frame>
7173
72-
## Property
74+
### Property
7375
7476
<CodeBlock title="pet.yml">
7577
```yaml {12}
@@ -94,3 +96,7 @@ In Fern Docs, this will look like:
9496
<Frame>
9597
![Screenshot showing a deprecated tag next to a type's property in API Reference docs](https://fern-image-hosting.s3.amazonaws.com/property-deprecated.png)
9698
</Frame>
99+
100+
## Sections
101+
102+
<Markdown src="/snippets/availability.mdx" />

fern/products/api-def/openapi-pages/extensions/availability.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ title: Availability
33
description: Mark endpoint availability status using `x-fern-availability` extension
44
---
55

6-
The `x-fern-availability` extension is used to mark the availability of an endpoint. The availability information propagates into the generated Fern Docs website as visual tags.
6+
The `x-fern-availability` extension is used to mark the availability of an endpoint within your OpenAPI definition. The availability information propagates into the generated Fern Docs website as visual tags.
7+
8+
You can configure the `availability` of sections in your API reference documentation in your [`docs.yml` file](/learn/docs/configuration/what-is-docs-yml).
9+
10+
## Endpoint
711

812
The options are:
913

@@ -24,4 +28,8 @@ This renders as:
2428
2529
<Frame caption="A deprecated endpoint">
2630
![Screenshot of API Reference endpoint with tag showing deprecated](https://fern-image-hosting.s3.amazonaws.com/fern/x-fern-availability-example.png)
27-
</Frame>
31+
</Frame>
32+
33+
## Section
34+
35+
<Markdown src="/snippets/availability.mdx" />

fern/products/docs/pages/api-references/customize-api-ref.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ You can hide an endpoint from the API reference by setting `hidden` to `true`. T
176176
</Tabs>
177177

178178
### Adding custom sections
179-
You can add arbitrary folders in the sidebar by adding a `section` to your API Reference layout. A section can comprise entire groups of endpoints, individual endpoints, or even just Markdown pages. Sections can be customized by adding properties like a `icon`, `summary`, `slug` (or `skip-slug`), and `contents`.
179+
You can add arbitrary folders in the sidebar by adding a `section` to your API Reference layout. A section can comprise entire groups of endpoints, individual endpoints, or even just Markdown pages. Sections can be customized by adding properties like a `icon`, `summary`, `slug` (or `skip-slug`), `availability`, and `contents`.
180180

181181
<Tabs>
182182
<Tab title="OpenAPI Specification">
@@ -240,3 +240,23 @@ navigation:
240240
- link: Link Title
241241
href: http://google.com
242242
```
243+
244+
### Adding availability
245+
246+
You can set the availability for the entire API reference or for specific sections. Options are: `stable`, `generally-available`, `in-development`, `pre-release`, `deprecated`, or `beta`.
247+
248+
```yaml title="docs.yml" {3, 6}
249+
navigation:
250+
- api: API Reference
251+
availability: generally-available
252+
layout:
253+
- section: My Section
254+
availability: beta
255+
icon: flower
256+
contents:
257+
# endpoints here
258+
```
259+
260+
When you set availability for a section, all endpoints in that section will inherit the section-level availability unless explicitly overridden in your API definition.
261+
262+
<Warning>You can't set availability for individual endpoints in `docs.yml`. Endpoint availability must be configured directly in your API definition. Learn more about availability for [OpenAPI](/learn/api-definitions/openapi/extensions/availability) or [Fern Definition](/learn/api-definitions/ferndef/availability).</Warning>

fern/products/docs/pages/api-references/generate-api-ref.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ navigation:
2121
| `api` (required) | Title of the API Reference Section |
2222
| `api-name` | Name of the API we are referencing, if there are [multiple APIs](#include-more-than-one-api-reference) |
2323
| `audiences` | List of [audiences](/docs/api-references/audiences) that determines which endpoints, schemas, and properties are displayed in your API Reference |
24+
| `availability` | Set the [availability status](/learn/docs/api-references/customize-api-reference-layout#adding-availability) for the entire API Reference or specific sections |
2425
| `display-errors` | Displays error schemas in the API References |
2526
| `snippets` | Enable [generated SDK code snippets](/learn/api-reference/snippets/get) in your API Reference |
2627
| `summary` | Relative path to the Markdown file; the summary is displayed at the top of the API section |

fern/products/docs/pages/navigation/overview.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,32 @@ navigation:
9797
path: ./pages/also-hidden.mdx
9898
```
9999

100+
### Section and page availability
101+
102+
You can set availability for individual pages or entire sections. When you set availability for a section, all pages within that section inherit the same availability unless explicitly overridden at the page level.
103+
104+
Options are: `stable`, `generally-available`, `in-development`, `pre-release`, `deprecated`, or `beta`.
105+
106+
```yaml Availability {3, 11, 14}
107+
navigation:
108+
- section: Developer Resources
109+
availability: generally-available
110+
contents:
111+
- page: Code Examples # Inherits generally-available
112+
path: ./pages/code-examples.mdx
113+
- page: CLI Tools # Inherits generally-available
114+
path: ./pages/cli-tools.mdx
115+
- page: Testing Framework
116+
path: ./pages/testing-framework.mdx
117+
availability: beta # Overrides section-level availability
118+
- page: Performance Monitoring
119+
path: ./pages/performance-monitoring.mdx
120+
availability: in-development # Overrides section-level availability
121+
```
122+
<Note>
123+
If you have different versions of your docs, section and page availability should be set in [the `.yml` files that define the navigational structure for each version](/learn/docs/configuration/versions#define-your-versions).
124+
</Note>
125+
100126
## Section overviews
101127

102128
To add an overview page to a section, add a `path` property to the section.

fern/products/docs/pages/navigation/products.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ In the below example, Product A is **unversioned** and Product B is **versioned*
143143
The top-level `doc.yml` configuration for a Fern Docs website containing two products, one unversioned and one versioned, might look something like this:
144144

145145
<CodeBlock title="docs.yml">
146-
```yaml {2, 8, 13-17}
146+
```yaml {2, 8, 13-19}
147147
products:
148148
- display-name: Product A # unversioned
149149
path: ./products/product-a.yml
@@ -159,8 +159,10 @@ products:
159159
versions: # optional
160160
- display-name: Latest
161161
path: ./products/product-b/latest.yml
162+
availability: beta
162163
- display-name: V2
163164
path: ./products/product-b/v2.yml
165+
availability: ga
164166
```
165167
</CodeBlock>
166168

fern/products/docs/pages/navigation/versions.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ versions:
104104
path: ./versions/v2-1.yml
105105
```
106106
</CodeBlock>
107+
</Step>
108+
<Step title="Indicate availability">
109+
110+
You can optionally set the availability status for each version. Options are `deprecated`, `ga`, `stable`, and `beta`.
111+
112+
<CodeBlock title="docs.yml">
113+
```yaml {4}
114+
versions:
115+
- display-name: v2.2
116+
path: ./versions/v2-2.yml
117+
availability: beta
118+
- display-name: v2.1
119+
path: ./versions/v2-1.yml
120+
availability: stable
121+
```
122+
</CodeBlock>
123+
124+
Version availability is distinct from [section and page availability](/learn/docs/configuration/navigation#section-and-page-availability), with different options. If you want to set section and page availability, do so in your version-specific `yml` files.
125+
107126
</Step>
108127
<Step title="Remove extra navigation from docs.yml">
109128

fern/snippets/availability.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
You can set the availability for the entire API reference or for specific sections in your `docs.yml` configuration. Options are: `stable`, `generally-available`, `in-development`, `pre-release`, `deprecated`, or `beta`.
2+
3+
When you set the availability of a section, all of the endpoints in that section are automatically marked with that availability unless explicitly set otherwise.
4+
5+
```yaml title="docs.yml" {3, 6}
6+
navigation:
7+
- api: API Reference
8+
availability: generally-available
9+
layout:
10+
- section: My Section
11+
availability: beta
12+
icon: flower
13+
contents:
14+
# endpoints here
15+
```

0 commit comments

Comments
 (0)