-
-
Notifications
You must be signed in to change notification settings - Fork 35
docs: add Scalar example #2846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add Scalar example #2846
Conversation
WalkthroughA new section has been added to the README under "Integration and Documentation," detailing how to serve OpenAPI documentation using Scalar. The section includes installation instructions for the Scalar package and an example of integrating its middleware into an Express app. No code or API changes were made. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
README.md (1)
1142-1170: Clarify wheredocumentationis coming from in the example snippetThe snippet assumes the existence of a
documentationinstance that exposesgetSpecAsJson(), but the README never establishes that variable. Readers who copy-paste will hit a “documentationis not defined” error.Consider briefly showing (or linking to) the earlier “Creating a documentation” section and assigning the variable explicitly:
-import { createConfig } from "express-zod-api"; +import { createConfig, Documentation } from "express-zod-api"; // <-- bring Documentation in // somewhere above … -const config = createConfig({ +const documentation = new Documentation({ routing, config }).getSpecAsJson(); +const config = createConfig({ beforeRouting: ({ app, getLogger }) => { … app.use( "/docs", apiReference({ - // Pass your generated OpenAPI document - content: documentation.getSpecAsJson(), + content: documentation, // clearly defined variable }), ); }, });A one-line note (“Assuming you created a
documentationobject as shown in the previous section”) would be enough if you prefer not to duplicate code.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2546
File: example/factories.ts:35-42
Timestamp: 2025-05-27T20:03:34.213Z
Learning: The `./example` directory in the express-zod-api repository contains demonstration code for educational purposes only, not intended for production use. Example code can make simplified assumptions for brevity and clarity, and should not be flagged for missing production-level error handling, security measures, or edge case handling.
README.md (1)
Learnt from: RobinTail
PR: #2546
File: example/factories.ts:35-42
Timestamp: 2025-05-27T20:03:34.213Z
Learning: The ./example directory in the express-zod-api repository contains demonstration code for educational purposes only, not intended for production use. Example code can make simplified assumptions for brevity and clarity, and should not be flagged for missing production-level error handling, security measures, or edge case handling.
|
Oh, I’m so sorry. I just thought it might be helpful for the users of I added the example to our docs [1][2], that should work, too. ✌️ [1] scalar/scalar#6398 |

Hey @RobinTail! Just discovered your awesome project and thought it would be cool to add an example how you can easily generate a Scalar API Reference for the generated OpenAPI document.
I wondered if I could add it where the Swagger UI example is, but the section is actually about the middleware, so I thought a new section could be better.
What do you think? Helpful? Excited to hear your thoughts!
Summary by CodeRabbit