-
-
Notifications
You must be signed in to change notification settings - Fork 38
docs: add api handler service usage #448
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe documentation for the NestJS adapter was updated to include a new section on the Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant ApiHandlerService
participant Handler
Controller->>ApiHandlerService: handleRequest(options)
ApiHandlerService->>Handler: Invoke API request handler (default or custom)
Handler-->>ApiHandlerService: Return response
ApiHandlerService-->>Controller: Return processed response
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 (5)
docs/reference/server-adapters/nestjs.mdx (5)
69-72: Consistent Heading Formatting
The new section header has two spaces after the###, whereas other section titles use a single space. Please adjust to a single space for consistency with the rest of the document.
73-95: Export the ApiHandlerService for broader reuse
The example registersApiHandlerServiceunderprovidersbut doesn’t export it. To allow injection in controllers from other modules, consider adding it to theexportsarray:@Module({ imports: [ // ... ], providers: [ApiHandlerService], + exports: [ApiHandlerService], }) export class AppModule {}
101-119: Clarify default RPC handler behavior
It may help users if you briefly note thathandleRequest()infers the model and operation name from the route path, defaulting to RPC-style handling. A short line in the example explaining this will prevent confusion about why no options object is passed.
216-222: Add a descriptive intro tohandleRequestreference
The signature is clear, but including a one-sentence summary above it—e.g., “Handles an API request using the configured handler and returns its result”—will give readers immediate context before diving into the signature.
224-266: Link referenced types and refine parameter docs
For better navigability, hyperlink or cross-reference the types (LoggerConfig,ModelMeta,ZodSchemas,HandleRequestFn) to their API definitions. Additionally, standardize punctuation in the JSDoc blocks (e.g., add terminal periods).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/reference/server-adapters/nestjs.mdx(2 hunks)
🔇 Additional comments (1)
docs/reference/server-adapters/nestjs.mdx (1)
125-158: Verify export and align code style in RESTful example
The snippet uses a default import forRESTApiHandler. Please confirm that@zenstackhq/server/api/restexportsRESTApiHandleras the default; if it's a named export, update the import accordingly. Also consider adding semicolons at the end of statements to match the TS examples above.
ymc9
left a comment
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.
Looks great. Thank you @ppodds ! I'm merging and will publish a new release.
Related to a new feature added in zenstackhq/zenstack#2099.
Summary by CodeRabbit
ApiHandlerServicefor automated request handling.ApiHandlerServicein NestJS controllers.handleRequestmethod and its options, clarifying configuration and usage.