Skip to content

docs(api): hide models sidebar in Scalar reference#3459

Merged
PierreBrisorgueil merged 1 commit intomasterfrom
chore/scalar-hide-models
Apr 13, 2026
Merged

docs(api): hide models sidebar in Scalar reference#3459
PierreBrisorgueil merged 1 commit intomasterfrom
chore/scalar-hide-models

Conversation

@PierreBrisorgueil
Copy link
Copy Markdown
Contributor

@PierreBrisorgueil PierreBrisorgueil commented Apr 13, 2026

Summary

  • Pass hideModels: true to the Scalar apiReference middleware mounted at /api/docs in lib/services/express.js.
  • The public docs no longer expose the Models sidebar tree (Mongoose-derived shapes, error envelopes, intermediate DTOs). Endpoint schemas are still documented inline on each route — the Models section just leaked implementation detail without helping API consumers.
  • Stack-side default: every downstream project benefits without extra config.

Verification

  • hideModels option confirmed against the installed version of @scalar/express-api-reference (0.9.7). The config type is HtmlRenderingConfiguration re-exported from @scalar/core, and node_modules/@scalar/types/dist/api-reference/api-reference-configuration.d.ts declares hideModels: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>> — option name and typing both valid.
  • Out of scope (kept for a later PR per one-fix-per-PR rule): theme changes, hiddenClients trimming, customCss, layout tuning.

Test plan

  • npm run lint — green
  • npm test — 499/499 unit tests passing
  • Manual sanity check of the diff (one-line addition)
  • CI green on PR
  • CodeRabbit review clean

Closes #3458

Summary by CodeRabbit

  • Documentation
    • API reference documentation now hides models in the rendered interface, providing a streamlined view at /api/docs.

Pass `hideModels: true` to the Scalar apiReference middleware so the
public `/api/docs` no longer exposes the internal Models tree
(Mongoose-derived shapes, error envelopes, intermediate DTOs). Schemas
are still documented inline on each endpoint — the Models section just
leaks implementation detail without helping API consumers.

Stack-side default — every downstream project benefits without extra
config.

Closes #3458
Copilot AI review requested due to automatic review settings April 13, 2026 10:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 905491d5-7cd4-4473-87f4-3c77640acf6d

📥 Commits

Reviewing files that changed from the base of the PR and between ec216ba and 358488d.

📒 Files selected for processing (1)
  • lib/services/express.js

Walkthrough

A single configuration option was added to the Scalar API reference UI to hide the Models section by default, preventing exposure of internal schema details in the public-facing API documentation at /api/docs.

Changes

Cohort / File(s) Summary
Scalar API Configuration
lib/services/express.js
Added hideModels: true option to apiReference() configuration to hide the Models sidebar in the Scalar API documentation UI.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding hideModels configuration to hide the models sidebar in the Scalar API reference documentation.
Description check ✅ Passed The description covers the summary, verification details, and test plan. Most required template sections are addressed, though the formal Scope, Validation checklist, and Guardrails sections are not strictly formatted per template.
Linked Issues check ✅ Passed The PR fully addresses the core objective from issue #3458 by adding hideModels: true to the apiReference config, preventing internal schema exposure while keeping endpoint documentation inline.
Out of Scope Changes check ✅ Passed The change is a single-line addition to express.js configuration that directly implements the linked issue requirement. No unrelated or out-of-scope modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/scalar-hide-models

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Scalar API reference UI configuration to avoid exposing internal schema/model details in the public docs, while keeping endpoint-level request/response schemas visible inline.

Changes:

  • Pass hideModels: true to the Scalar apiReference middleware mounted at /api/docs.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (3cc434c) to head (358488d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3459   +/-   ##
=======================================
  Coverage   85.81%   85.81%           
=======================================
  Files         115      115           
  Lines        2911     2911           
  Branches      805      805           
=======================================
  Hits         2498     2498           
  Misses        327      327           
  Partials       86       86           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil PierreBrisorgueil merged commit 5e91cec into master Apr 13, 2026
9 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the chore/scalar-hide-models branch April 13, 2026 10:41
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.

docs(api): hide schemas/models in Scalar reference by default

2 participants