Skip to content

Commit 3199aab

Browse files
committed
add info about specifying section display names
1 parent d6ca6fb commit 3199aab

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

fern/products/api-def/api-def.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ navigation:
5858
- page: SDK method names
5959
path: ./openapi-pages/extensions/method-names.mdx
6060
slug: method-names
61+
- page: Tag display names
62+
path: ./openapi-pages/extensions/tag-display-name.mdx
6163
- page: Parameter names
6264
path: ./openapi-pages/extensions/parameter-names.mdx
6365
- page: Property names

fern/products/api-def/openapi-pages/extensions/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The table below shows all available extensions and links to detailed documentati
1818
| [`x-fern-bearer`](/api-definitions/openapi/authentication#bearer-security-scheme) | Customize bearer authentication parameter names and environment variables |
1919
| [`x-fern-availability`](./availability) | Mark availability status (beta, generally-available, deprecated) |
2020
| [`x-fern-base-path`](./base-path) | Set base path prepended to all endpoints |
21+
| [`x-displayName`](./tag-display-names) | Specify how tag names display in your API Reference |
2122
| [`x-fern-enum`](./enum-descriptions-and-names) | Add descriptions and custom names to enum values |
2223
| [`x-fern-examples`](./request-response-examples) | Associate request and response examples |
2324
| [`x-fern-global-headers`](./global-headers) | Configure headers used across all endpoints |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Tag display names
3+
description: Customize how tag names appear in your API Reference using the `x-displayName` extension
4+
---
5+
6+
By default, tag names from your OpenAPI specification become section names in your API Reference. Use the `x-displayName` extension to control how these section names display in your generated documentation. This is helpful for controlling capitalization and creating user-friendly names.
7+
8+
You can set display names directly in your spec or in an overrides file.
9+
10+
```yaml title="openapi.yml"
11+
tags:
12+
- name: task
13+
x-displayName: Tasks
14+
- name: billing-and-payments
15+
x-displayName: Billing and Payments
16+
```
17+
18+
<Note>
19+
Alternatively, you can rename sections directly in your [`docs.yml` file](/api-references/customize-api-reference-layout#renaming-sections).
20+
</Note>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,30 @@ To reference an endpoint, you can use either:
9696

9797
## Customizing the API Reference
9898

99+
### Renaming sections
100+
101+
To override the display name of a section (created from tags in your API spec),
102+
you can use the `section` property in your `docs.yml` and reference the original
103+
tag name using `referenced-packages`.
104+
105+
```yaml title="docs.yml" {4-6}
106+
navigation:
107+
- api: API Reference
108+
layout:
109+
- section: "User" # New display name
110+
referenced-packages:
111+
- user-endpoint # Original tag name from your spec
112+
contents: []
113+
- section: "Plant"
114+
referenced-packages:
115+
- plant
116+
contents: []
117+
```
118+
<Note>
119+
You can alternatively customize tag display names directly in your spec (or `overrides.yml` file) using the [`x-displayName` extension (OpenAPI)](/api-definitions/openapi/extensions/tag-display-names) or the [`display-name` parameter (Fern Definition)](/api-definitions/ferndef/endpoints/overview#display-name)
120+
</Note>
121+
122+
99123
### Flattening sections
100124
To remove the API Reference title and display the section contents, set `flattened` to `true`.
101125

0 commit comments

Comments
 (0)