feat(docs): replace Scalar with Redoc for /api/docs UI#3466
feat(docs): replace Scalar with Redoc for /api/docs UI#3466PierreBrisorgueil merged 1 commit intomasterfrom
Conversation
Swap @scalar/express-api-reference for redoc-express so /api/docs renders the merged OpenAPI spec with Redoc's three-panel layout — cleaner for a consumer-facing API reference. Spec assembly, guides loader, YAML merge, and config injection are unchanged; Redoc consumes /api/spec.json by URL instead of inline content. Equivalents for Scalar's hideModels behavior are provided via redocOptions: hideDownloadButton, hideSchemaTitles, expandResponses. Refs #3464
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 23 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3466 +/- ##
=======================================
Coverage 85.82% 85.82%
=======================================
Files 115 115
Lines 2914 2914
Branches 807 807
=======================================
Hits 2501 2501
Misses 327 327
Partials 86 86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR swaps the API docs UI at /api/docs from Scalar to Redoc while keeping the existing OpenAPI spec assembly and /api/spec.json endpoint unchanged.
Changes:
- Replace
@scalar/express-api-referencewithredoc-express. - Update
initSwaggerto mount Redoc at/api/docsusingspecUrl: '/api/spec.json'and Redoc UI options. - Update tests and migration notes to reflect the Redoc UI.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Removes Scalar dependency and adds redoc-express. |
| package-lock.json | Updates lockfile to reflect dependency swap. |
| lib/services/express.js | Replaces Scalar middleware with Redoc handler mounted on /api/docs. |
| lib/helpers/guides.js | Updates comments referencing Scalar → Redoc (no functional change). |
| modules/core/tests/core.integration.tests.js | Renames Scalar docs test descriptions to Redoc. |
| modules/core/tests/core.unit.tests.js | Updates unit assertion to match /api/docs being mounted via app.get. |
| MIGRATIONS.md | Adds a migration entry documenting the UI swap for downstream projects. |
Summary
@scalar/express-api-referencewithredoc-expressfor the/api/docsUI./api/spec.jsonhandler are unchanged — Redoc consumes the spec by URL instead of inline content.hideModelsbehavior:hideDownloadButton,hideSchemaTitles,expandResponses: '200,201'passed viaredocOptions.Redoc is a mature, widely-used OSS lib (MIT) with a cleaner three-panel layout better suited to a consumer-facing API reference. No try-it-out panel, which this API does not need (API-key-gated, programmatic use).
Closes #3464
Changes
package.json—@scalar/express-api-referenceremoved,redoc-expressaddedlib/services/express.js— mountredoc({ title, specUrl, redocOptions })viaapp.get('/api/docs', …)(redoc-express exposes a plain handler); comments updatedlib/helpers/guides.js— comments updated (Scalar → Redoc); behavior unchangedmodules/core/tests/core.integration.tests.js—describe('Redoc API reference', …)rename; assertions untouchedmodules/core/tests/core.unit.tests.js— adjustinitSwaggermount assertion to matchapp.get('/api/docs', …)MIGRATIONS.md— "Redoc replaces Scalar" entry above the existing Scalar-replaces-swagger-ui blockTest plan
npm run lintgreennpm run test:coverage— 769/769 passing, coverage thresholds unchanged/api/docsreturns 200 +text/htmlwith Redoc container, script fromunpkg.com/redoc@^2.5.2,Redoc.init("/api/spec.json", { hideDownloadButton, hideSchemaTitles, expandResponses })/api/spec.jsonstill returns 200 + OpenAPI 3.0.0 withinfo.title/serversinjected from configDownstream impact
Zero. Each downstream project picks up the change via
/update-stack— no project-side YAML, config, or CSP tweaks required.