Skip to content

API Explorer: show a version notice on older and unreleased pages - #4977

Merged
reakaleek merged 20 commits into
mainfrom
api-version-notices-5a2531d0
Nov 20, 2026
Merged

reakaleek merged 20 commits into
mainfrom
api-version-notices-5a2531d0

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Older-major and unreleased API pages now show their version under the page title and link to the same page in the newest major.

Affects: API reference

Prompt summary: Implement docs-eng-team#1218. A reader on an older, end-of-life, or unreleased API page sees which version it is and can reach the newest major. The warning sits next to the title, not in a strip at the top.

Why

A reader who lands on /v8 or /next from search cannot tell they are not on the current version. The version selector shows it, but only after the reader opens it. The RFC page types table asks for a notice on these pages, next to the title and without a top strip.

Closes elastic/docs-eng-team#1218

What

Notice per page type

An older major shows a Version 8 label and a link to the same page in the newest major. The link goes to the newest major's landing page when the page does not exist there. /next shows an Unreleased warning with the same link. Versionless pages and the numbered copy of the newest major show nothing.

Placement

The Unreleased warning sits directly under the H1, on its own row, on operation, landing, group, schema, topic and structural pages. The older-major label and link sit there too, except on operation pages, where they join the badges row as Version 8 and Latest: v9. That keeps the title next to its request line. The intro and outro Markdown pages are left out because they are not versioned content.

Markup and style

The label reuses the title badge, with a new Warning tone next to Danger. Both looks get styles: the legacy one in api-docs.css and the design-system one in api-reference.css.

Previews

Two style-guide previews, api-operation-older-major and api-operation-next, show both notices. The preview version switcher now lists Next, v9 (latest) and v8, as the generator builds it.

Verify

mise run test
mise run serve
# /api/elasticsearch/v8/operation/operation-search: "Version 8" and a link to the versionless page
# /api/elasticsearch/next/operation/operation-search: "Unreleased" warning and a link
# /api/elasticsearch/ and /api/elasticsearch/v9/: no notice

Out of scope: the end-of-life notice. The page type does not exist yet (#1229). Adding it is one new case in ApiVersionNotices.For.

🤖 Generated with Claude Code

reakaleek and others added 4 commits November 20, 2026 03:13
An older major names its version and the unreleased tree warns that it can change. Both link to the same page in the newest major, or to its landing page. Each switcher item now carries its moniker, so the notice finds the newest major without parsing labels.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A reader on an older major or on /next now sees which version the page belongs to, with a link to the same page in the newest major. The notice is a pill and a link under the H1, not a banner, so it does not compete with the page. The newest major and its numbered copy show nothing, because the version selector already says latest.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The style guide gains an operation page in an older major and one in the unreleased version. The API Explorer docs say which notice each version shows and where its link goes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
`_VersionNotice` now takes the view model and returns nothing when the page has no notice, so each view makes one call instead of an `@if` block. `ApiVersionNotices.For` checks the page type before it scans the version items.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 20, 2026 02:25
@reakaleek
reakaleek requested a review from technige November 20, 2026 02:25
@github-actions

Copy link
Copy Markdown
Contributor

The notice was a block between the title and the request line, so it pushed them about 70px apart. It now sits in the title row and wraps under the title when the row is full, which keeps the 16px step to the request line.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
reakaleek and others added 3 commits November 20, 2026 07:13
The versionless URL belongs to the newest major the API declares, but the switcher lists only the trees that rendered. When that major failed to load, an older page named itself as "the latest version". The notice now looks up the declared newest major, keeps the page's own version, and drops the link when that tree did not render.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The lorem API is not served, so the "View the latest version" link on the two notice previews led nowhere. Each version in the preview switcher now links to the preview of the same operation in that version.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The notice sits in the title row and wraps under the title when the row is full. The docs said "under the title", which stopped being true when the notice moved into the row. They also state what the link does when the newest major did not render.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The notice sat beside a short title and slipped below a long one, so its place changed with the title and the window width. It now takes its own row under the title on every page type. The docs say so.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment thread docs/data/openapi/api-explorer.md Resolved
The notice link ended in a text arrow that matched neither look of the docs landing page. It now uses that page's arrow: the inline glyph in the legacy look and the shared `arrow_right` icon in the design-system look.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
On an operation page the `Version 8` label and the link to the latest version now sit with the other badges, so the title stays next to its request line. The `Unreleased` warning stays under the title, and pages without a badges row keep both notices under the title.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
reakaleek and others added 8 commits November 20, 2026 08:34
An API with no numeric major serves `main` at the versionless URL, so an older tree such as `/vbeta` told readers to "View the latest version (Next)". Only a numeric version is a release to link to. Without one the notice keeps its label and has no link. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The unit tests pass the declared newest major to the notice directly. A generator case with an unreadable v9 now checks the wiring end to end: the v8 badges and the `/next` and v8 landing notices render without a link to the latest version. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The docs said the notice appears on every page type. Hand-written `children:` Markdown pages show none, even under `/v8/` or `/next/`, so a missing notice there does not mean the latest version. The docs now name generated API pages and call out the exception. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The preview tests passed if the arrow was removed or the icon name misspelled, and the generator snapshots cover only the legacy glyph. A verified snapshot of the `/next` preview notice now holds the link text and the arrow icon in one anchor. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The link text already says what the link does, and the icon has no label, so a screen reader could announce an unlabeled graphic. The arrow now sits in an `aria-hidden` wrapper, as the legacy glyph already does. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The old preview test looked for the destination and the label anywhere on the page, and the version switcher already links to the same preview, so it passed even if the notice link pointed elsewhere. A verified snapshot of the badges row now holds the label and its destination in one anchor. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The exported previews are sibling files in `preview/`, but their links to one another still pointed at the dev-server route, so the version picker and the notice link led outside the archive. The export now rewrites a preview-to-preview link to the sibling file. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The HTML tests still pass if a stylesheet puts the notice beside a short title again. A journey test now opens older and unreleased API pages at 375, 1280 and 1680px, in the legacy look and in the design-system look through the style-guide previews, and checks that the notice starts below the title. With the notice beside the title, the group page fails at 1280px and 1680px. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The journeys workflow fails its planning job when a test class is not in exactly one shard, so the new `ApiVersionNoticeTests` stopped every browser journey from running. It joins the other API page tests in `api-examples`. Raised in review by Libra.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek merged commit 4845abc into main Nov 20, 2026
44 checks passed
@reakaleek
reakaleek deleted the api-version-notices-5a2531d0 branch November 20, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant