feat(docs): polish default Redoc theme — Inter + JetBrains Mono, optional override#3687
Conversation
…onal override Closes #3686. Default Redoc theme now ships Inter (body + headings) + JetBrains Mono (code), tighter sidebar spacing, no uppercase group items, refined right panel. Logo populated from config.app.url (+ optional config.app.logo). Downstream can deep-merge their own theme via config.docs.redocTheme without devkit edits. Tests cover (1) default theme markers in served HTML and (2) override deep-merge applied.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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 selected for processing (2)
✨ 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 #3687 +/- ##
==========================================
+ Coverage 89.61% 89.62% +0.01%
==========================================
Files 139 139
Lines 4736 4744 +8
Branches 1482 1488 +6
==========================================
+ Hits 4244 4252 +8
Misses 385 385
Partials 107 107
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the default /api/docs Redoc rendering to use a more polished baseline theme (typography + layout tweaks), adds optional per-project theme overrides via config deep-merge, and injects an optional info.x-logo into the served OpenAPI spec based on config.app.*.
Changes:
- Add devkit default Redoc theme (Inter + JetBrains Mono, tighter sidebar, darker right panel) and deep-merge
config.docs.redocTheme. - Inject
info.x-logointo the OpenAPI spec whenconfig.app.urlis present (with optionalconfig.app.logo). - Add unit tests validating theme markers/override propagation and
x-logobehavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/services/express.js | Adds default Redoc theme + optional deep-merge override, injects info.x-logo, and passes theme/CSS into Redoc options. |
| lib/services/tests/express.docs.unit.tests.js | Adds unit tests covering HTML markers for theme defaults/overrides and x-logo injection into /api/spec.json. |
| /** | ||
| * Build a mock Express app that captures responses for /api/docs and /api/spec.json | ||
| */ | ||
| const buildMockApp = () => { | ||
| const routes = {}; | ||
| const app = { | ||
| get: (path, handler) => { | ||
| routes[path] = handler; | ||
| }, | ||
| _routes: routes, | ||
| }; | ||
| return app; | ||
| }; |
| /** | ||
| * Trigger the /api/docs route and capture the HTML sent | ||
| */ | ||
| const callDocsRoute = (app) => { | ||
| const handler = app._routes['/api/docs']; | ||
| if (!handler) throw new Error('/api/docs route not registered'); | ||
| let html = null; | ||
| const res = { | ||
| type: jest.fn(), | ||
| send: (body) => { | ||
| html = body; | ||
| }, | ||
| }; | ||
| handler({}, res); | ||
| return html; | ||
| }; |
| /** | ||
| * Trigger the /api/spec.json route and capture the JSON spec served | ||
| */ | ||
| const callSpecRoute = (app) => { | ||
| const handler = app._routes['/api/spec.json']; | ||
| if (!handler) throw new Error('/api/spec.json route not registered'); | ||
| let spec = null; | ||
| const res = { json: (body) => { spec = body; } }; | ||
| handler({}, res); | ||
| return spec; | ||
| }; |
| hideDownloadButton: true, | ||
| hideSchemaTitles: true, | ||
| expandResponses: '200,201', | ||
| theme, | ||
| customCss: redocCustomCss, |
| expandResponses: '200,201', | ||
| theme, | ||
| customCss: redocCustomCss, | ||
| }, |
Summary
config.app.url(href) + optionalconfig.app.logo(url) viainfo.x-logoconfig.docs.redocTheme— zero devkit edits requiredCloses #3686.
Test plan
config.app.url, url fromconfig.app.logo)config.app.urlabsent (regression guard)config.docs.redocThemeoverride reaching served HTML (deep-merge verified)