Skip to content

refactor(apidoc): replace legacy viewer calls with dictionary lookup - #720

Open
yangjj-iso wants to merge 2 commits into
apache:masterfrom
yangjj-iso:fix/7592-remove-dead-apidoc
Open

yangjj-iso wants to merge 2 commits into
apache:masterfrom
yangjj-iso:fix/7592-remove-dead-apidoc

Conversation

@yangjj-iso

@yangjj-iso yangjj-iso commented Oct 13, 2026 •

Copy link
Copy Markdown

Related to apache/shenyu#7592.
Companion backend removal and embedded dashboard update: apache/shenyu#7603

The API documentation page still calls /apidoc/getDocMenus for debug environments, although its API/tag tree already uses the database-backed /api and /tag endpoints. Read environments from the existing /shenyu-dict/all/apidocEnv endpoint instead, preserving the enabled-entry filter and the field mapping expected by the debug UI. Remove the obsolete menu-tree transformation and the unused getDocMenus / getDocItem request helpers.

Why the existing page and menu remain

The current ApiDoc page hosts working API/tag management, API details, Swagger import, and request debugging. SearchApi loads its tree independently through getRootTag / getApi, and contains the Swagger import dialog. Deleting the page and menu as originally proposed in apache/shenyu#7592 would also remove those working features. This change removes the legacy endpoint dependency while preserving the existing page, menu, import entry point, and debug environments.

The new dictionary endpoint already exists on the backend, so this frontend change can be deployed before removal of ApiDocController.

Validation

  • npm test -- src/routes/Document: 6 suites, 21 tests passed, including coverage for enabled/disabled environment entries, an empty environment list, and API-detail/mock loading.
  • ESLint passed for all three changed files.
  • NODE_OPTIONS='--openssl-legacy-provider --max-old-space-size=6144' npm run build: passed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open findings
What changed in this PR

Refactors the ApiDoc UI to stop calling legacy /apidoc/* endpoints for debug environments and instead load environments via the existing dictionary endpoint, while keeping the rest of the ApiDoc functionality intact.

Changes:

  • Replaced legacy getDocMenus usage with fetchShenYuDictByType({ type: "apidocEnv" }) and mapped enabled entries into the debug UI’s expected envProps shape.
  • Removed obsolete request helpers (getDocMenus, getDocItem) from the services layer.
  • Added Jest coverage ensuring enabled/disabled env filtering works and API detail/mock loading remains functional.
File Description
src/​services/​api.js Removes legacy apidoc request helpers now replaced by dictionary lookup.
src/​routes/​Document/​ApiDoc.js Loads debug environments from dictionaries and maps them into envProps.
src/​routes/​Document/​ApiDoc.test.js Adds tests covering env filtering/mapping and ensuring API detail/mock still load.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/routes/Document/ApiDoc.js Outdated
Comment thread src/routes/Document/ApiDoc.test.js

This branch has not been deployed

No deployments
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