Skip to content

docs(redirects): add /api-reference/latest/* → current dated version#46

Merged
riveign merged 2 commits into
mainfrom
docs/api-reference-latest-redirect
May 18, 2026
Merged

docs(redirects): add /api-reference/latest/* → current dated version#46
riveign merged 2 commits into
mainfrom
docs/api-reference-latest-redirect

Conversation

@riveign
Copy link
Copy Markdown
Contributor

@riveign riveign commented May 18, 2026

Summary

Adds a wildcard redirect from /api-reference/latest/:slug* to the latest stable dated API version (2026-02-18 today), and teaches scripts/generate-specs.mjs to derive that redirect from the live /versions endpoint on every generate run.

External consumers (merchant dashboard CTAs, support links, partner docs, ad-hoc bookmarks) can deep-link into the API reference using a stable, version-agnostic URL. On each future stable version cut, no docs.json hand-edit is needed — running pnpm generate picks up the new destination automatically.

Why a generator-derived redirect, not a hardcoded one?

The 24 dated nav entries in docs.json are already auto-generated from /versions. The redirect destination is the same kind of derived value, so it belongs in the generator alongside the nav. A hand-edit would have been a quiet drift risk: at the next version cut, the generator regenerates the nav, but the redirect would silently keep pointing at the old version unless someone remembered.

Changes

  • docs.json — adds the redirect entry (also reproducible by running pnpm generate against current /versions).
  • scripts/generate-specs.mjs — adds buildManagedRedirects(latestStableVersion), MANAGED_REDIRECT_SOURCES, and mergeRedirects(existing, latestStable). User-authored redirects (e.g. /guides/**) are preserved by source-key; only redirects in the managed set get re-derived. Wired into main() immediately after buildNavigation.

Test plan

  • Mintlify preview deployment builds.
  • https://<preview-url>/api-reference/latest/post-v1-merchants 301/302s to https://<preview-url>/api-reference/2026-02-18/post-v1-merchants (200).
  • https://<preview-url>/api-reference/latest/get-v1-merchants redirects similarly.
  • Existing /guides/**/custodians/** redirect still works (regression check).
  • Existing 2026-02-18/* direct URLs still resolve.
  • pnpm generate on main after merge produces zero diff against the merged docs.json redirect block (deterministic).

Follow-up

Companion dashboard PR in pay-merchant-experience swaps the /merchants empty-state "Read the Docs" CTA to https://docs.walletconnect.com/api-reference/latest/post-v1-merchants (tracked under WCPM-385). That PR is held until this one is merged + deployed.

Notes

  • mint dev does NOT process the redirects block locally. Verified existing /guides/** rule also 404s in dev. Verification only happens on the Mintlify hosted preview / production.
  • Verified locally that pnpm generate against current /versions (stable=[2026-02-18]) produces a zero-diff docs.json vs. the prior commit on this branch — proving the generator output matches the hand-edited redirect.
  • The next time the docs team runs pnpm generate for unrelated reasons, it will also pick up upstream OpenAPI spec drift in api/*.json. That drift was intentionally not included here (kept separate from the redirect prototype).

🤖 Generated with Claude Code

…-18/*

Allows external consumers (dashboard CTAs, support links) to deep-link
into the API reference with a stable, version-agnostic URL. On each
dated version cut, update only the destination here — consumers stay
put.

Note: mint dev does not process the `redirects` block; verification
happens on the Mintlify PR preview deployment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 18, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wc-pay-docs 🟢 Ready View Preview May 18, 2026, 1:27 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

…le version

Teaches the docs generator to write the /api-reference/latest/:slug*
redirect into docs.json on every `pnpm generate` run, with the
destination pulled from `stable[0]` of the live /versions endpoint.

User-authored redirects are preserved by source-key. Only redirects
whose source is in MANAGED_REDIRECT_SOURCES get re-derived.

This removes the manual edit step at version-cut time: the next
generate run after a stable version is promoted will pick up the new
destination automatically.

Verified by running `pnpm generate` against current /versions
(stable=[2026-02-18]) — produces the same docs.json redirect block as
the prior hand-edit (zero diff vs the previous commit on this branch).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@riveign riveign merged commit 8c267cb into main May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants