Skip to content

fix: use the sidebar base path rule when building info_path - #1651

Merged
sserrata merged 1 commit into
mainfrom
fix/info-path-base-path
Oct 9, 2026
Merged

sserrata merged 1 commit into
mainfrom
fix/info-path-base-path

Conversation

@sserrata

@sserrata sserrata commented Oct 9, 2026

Copy link
Copy Markdown
Member

Description

The infoPath calculation in index.ts stripped docPath from outputDir with outputDir.split(docPath), which matches a substring instead of a path prefix. #1368 fixed the same bug in the sidebar generator with a startsWith check, but the copy in index.ts was left behind.

outputDir docPath info_path before info_path after
docs/test/docspace docs docs/test//<infoId> docs/test/docspace/<infoId>
docs/api/docs-v2 docs docs/api//<infoId> docs/api/docs-v2/<infoId>
docs docs docs//<infoId> docs/<infoId>
docs/petstore docs docs/petstore/<infoId> unchanged

info_path feeds the API explorer's Authentication link (SecuritySchemes: /${infoPath}#authentication), so the affected layouts had a broken link.

Changes:

  • Move getBasePathFromOutput from sidebars/index.ts to sidebars/utils.ts (no logic change), so the sidebar IDs and info_path use the same rule.
  • Add getInfoPath() in index.ts, which joins the route base path, base path, and info ID, and skips empty segments.

Supersedes #1306. Thanks to @trofim24 for the original report and fix.

How Has This Been Tested?

  • New sidebars/utils.test.ts covers getBasePathFromOutput, including the substring cases above.
  • New getInfoPath cases in index.test.ts cover the table above, plus routeBasePath values of / and api/.
  • yarn test: 12 suites, 135 tests pass.
  • ESLint and Prettier are clean on the changed files. yarn lint reports the same 6 errors as main, all in theme files that this PR does not touch.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

🤖 Generated with Claude Code

The infoPath calculation split outputDir on docPath as a substring, so an
output dir such as "docs/test/docspace" produced "docs/test//<infoId>"
and broke the API explorer's Authentication link. Share the startsWith
helper from #1368 between the sidebar generator and infoPath, and skip
empty segments so a docs-root output dir no longer yields "//".

Supersedes #1306. Thanks to @trofim24 for the original report and fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 2.45 MB

ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 16.6 kB
demo/.docusaurus/globalData.json 83.8 kB
demo/.docusaurus/i18n.json 372 B
demo/.docusaurus/registry.js 121 kB
demo/.docusaurus/routes.js 115 kB
demo/.docusaurus/routesChunkNames.json 47.7 kB
demo/.docusaurus/site-metadata.json 1.58 kB
demo/build/assets/css/styles.********.css 218 kB
demo/build/assets/js/main.********.js 731 kB
demo/build/assets/js/runtime~main.********.js 27.3 kB
demo/build/index.html 100 kB
demo/build/petstore/add-pet/index.html 30 kB
demo/build/petstore/create-user/index.html 24.6 kB
demo/build/petstore/create-users-with-array-input/index.html 24.7 kB
demo/build/petstore/create-users-with-list-input/index.html 24.7 kB
demo/build/petstore/delete-order/index.html 24.6 kB
demo/build/petstore/delete-pet/index.html 24.8 kB
demo/build/petstore/delete-user/index.html 24.9 kB
demo/build/petstore/find-pets-by-status/index.html 25.4 kB
demo/build/petstore/find-pets-by-tags/index.html 26.1 kB
demo/build/petstore/get-inventory/index.html 23.9 kB
demo/build/petstore/get-order-by-id/index.html 24.8 kB
demo/build/petstore/get-pet-by-id/index.html 25.5 kB
demo/build/petstore/get-user-by-name/index.html 25 kB
demo/build/petstore/login-user/index.html 25.6 kB
demo/build/petstore/logout-user/index.html 24.3 kB
demo/build/petstore/new-pet/index.html 24.9 kB
demo/build/petstore/pet/index.html 23.2 kB
demo/build/petstore/place-order/index.html 24.1 kB
demo/build/petstore/schemas/apiresponse/index.html 25.3 kB
demo/build/petstore/schemas/cat/index.html 39.3 kB
demo/build/petstore/schemas/category/index.html 26.4 kB
demo/build/petstore/schemas/dog/index.html 39.7 kB
demo/build/petstore/schemas/honeybee/index.html 39.7 kB
demo/build/petstore/schemas/id/index.html 23.5 kB
demo/build/petstore/schemas/order/index.html 27.5 kB
demo/build/petstore/schemas/pet/index.html 39.3 kB
demo/build/petstore/schemas/tag/index.html 24.8 kB
demo/build/petstore/schemas/user/index.html 41.2 kB
demo/build/petstore/store/index.html 22.2 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 30.9 kB
demo/build/petstore/swagger-petstore-yaml/index.html 31.1 kB
demo/build/petstore/update-pet-with-form/index.html 24.9 kB
demo/build/petstore/update-pet/index.html 25.4 kB
demo/build/petstore/update-user/index.html 24.9 kB
demo/build/petstore/upload-file/index.html 24.8 kB
demo/build/petstore/user/index.html 22.8 kB

compressed-size-action

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 88c5e26):

https://docusaurus-openapi-36b86--pr1651-5nk36df9.web.app

(expires Fri, 16 Oct 2026 18:08:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

@sserrata
sserrata merged commit 00fcfd4 into main Oct 9, 2026
12 checks passed
@sserrata
sserrata deleted the fix/info-path-base-path branch October 9, 2026 19:53

This branch was successfully deployed

1 active deployment
preview — 88c5e269 Deployed Oct 9, 2026 by sserrata via Visual Diff #2388
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.

1 participant