Skip to content

fix(docs): build API doc fallback slugs the way docusaurus-openapi-docs does - #45897

Merged
villebro merged 1 commit into
apache:masterfrom
villebro:villebro/fix-api-docs-slug-fallback
Oct 30, 2026
Merged

villebro merged 1 commit into
apache:masterfrom
villebro:villebro/fix-api-docs-slug-fallback

Conversation

@villebro

Copy link
Copy Markdown
Member

SUMMARY

docs/scripts/generate-api-index.mjs and docs/scripts/generate-api-tag-pages.mjs link every endpoint to the page docusaurus-openapi-docs generates for it. They look the page slug up in the generated sidebar by label and fall back to a local slugify when the lookup misses. The plugin names pages with lodash kebabCase(summary), which splits letter/digit boundaries, so "OAuth2" becomes o-auth-2; the local fallback lowercases and joins it as oauth2. For most summaries the two agree, which is why the fallback looked equivalent.

The OAuth2 token endpoints added in #45676 are the first summaries where they differ. When the sidebar lookup misses (seen on Netlify deploy previews, e.g. #45404's), the API index and the Database tag page link to /developer-docs/api/list-oauth2-credential-metadata-for-a-database and two similar paths, while the generated pages are list-o-auth-2-..., and Docusaurus fails the build with "Docusaurus found broken links!".

This makes the fallback use lodash/kebabCase (already a direct docs dependency), the same algorithm the plugin uses, so fallback links always match the generated pages.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable.

TESTING INSTRUCTIONS

  • node -e "console.log(require('lodash/kebabCase')('List OAuth2 credential metadata for a database'))" prints list-o-auth-2-credential-metadata-for-a-database, the page name the plugin generates.
  • The docs deploy preview on this PR should build, and the API index's Database section should link to working OAuth2 token pages.
  • I couldn't run the full Docusaurus build locally, so the deploy preview is the real check.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…cs does

generate-api-index.mjs and generate-api-tag-pages.mjs link each endpoint to
the page docusaurus-openapi-docs generates, looking the slug up in the
generated sidebar and falling back to a local slugify. The plugin names pages
with lodash kebabCase, which splits letter/digit boundaries ("OAuth2" ->
"o-auth-2"), while the fallback produced "oauth2". When the sidebar lookup
missed, the OAuth2 token endpoints added in apache#45676 got links to pages that
don't exist and the Docusaurus broken-link check failed the build. Use
kebabCase for the fallback too.
@villebro
villebro marked this pull request as ready for review October 30, 2026 17:50
@netlify

netlify Bot commented Oct 30, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 2fd5897
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae4d8938439dd230170caf7
😎 Deploy Preview https://deploy-preview-45897--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@villebro
villebro requested a review from rusackas October 30, 2026 17:53
@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Oct 30, 2026

@madhushreeag madhushreeag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@villebro
villebro merged commit e95b7f6 into apache:master Oct 30, 2026
78 of 115 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants