Skip to content

Conversation

@lsmith77
Copy link
Contributor

@lsmith77 lsmith77 commented Sep 1, 2025

Summary by CodeRabbit

  • Documentation
    • Clarified pagination behavior for REST API handlers: the default pageSize also serves as the maximum allowed limit value in API requests.
    • Updated reference text to reduce ambiguity between pageSize and limit parameters and how they interact.
    • Improved guidance helps users configure pagination consistently and troubleshoot unexpected limiting.
    • No functional changes to the API or runtime behavior; this is a documentation-only update.

@vercel
Copy link

vercel bot commented Sep 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
zenstack-new-site Ready Ready Preview Comment Sep 1, 2025 7:28am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Walkthrough

Updated documentation in docs/reference/server-adapters/api-handlers/rest.mdx clarifying that the default pageSize also serves as the maximum limit for API calls. No code or behavior changes.

Changes

Cohort / File(s) Summary
Docs update
docs/reference/server-adapters/api-handlers/rest.mdx
Clarified that default pageSize determines the maximum limit value in API calls; no code changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/reference/server-adapters/api-handlers/rest.mdx (2)

67-71: Fix Nuxt example: missing comma between object properties

The example won’t parse without a comma after handler.

 export default createEventHandler({
-    handler: RestApiHandler({ endpoint: 'http://myhost/api/model' })
-    getPrisma
+    handler: RestApiHandler({ endpoint: 'http://myhost/api/model' }),
+    getPrisma
 });

760-764: Fix JSON in upsert example: trailing comma is invalid JSON

Remove the trailing comma after the array.

-        "matchFields": ["id"],
+        "matchFields": ["id"]
🧹 Nitpick comments (3)
docs/reference/server-adapters/api-handlers/rest.mdx (3)

85-85: Clarify how the max limit is enforced

Good addition. Please specify what happens when a client sends page[limit] > pageSize (clamped vs. 400 error) and how this interacts with pageSize = Infinity.

Proposed copy-only tweak (neutral about outcome):

-  Optional. A `number` field representing the default page size for listing resources and relationships. This value also determines the maximum `limit` value in an API call. Defaults to 100. Set to Infinity to disable pagination.
+  Optional. A `number` representing the default page size for listing resources and relationships. It also acts as the maximum allowed `page[limit]` in requests. Defaults to 100. Set to `Infinity` to disable pagination (in which case `page[limit]` is not capped).

512-516: Mirror the new “max limit = pageSize” rule in the Pagination section

Add a one-liner here so readers don’t miss the constraint when skimming pagination.

 When fetching a collection resource or relationship, you can use the `page[offset]=value` and `page[limit]=value` [query parameter family](https://jsonapi.org/format/#query-parameters-families) to fetch a specific page. They're mapped to `skip` and `take` parameters in the query arguments sent to PrismaClient.
+Note: `page[limit]` cannot exceed the configured `pageSize`; values above it are not honored.

89-89: Typos and minor grammar fixes across the page

Reader-facing polish. Low-risk copy edits.

-  Optional. An `Record<string, string>` value that provides a mapping from model names (as defined in ZModel) to URL path names.
+  Optional. A `Record<string, string>` that provides a mapping from model names (as defined in ZModel) to URL path names.
-  The mapping can be partial. You only need to specify the model names that you want to override. If a mapping is provided, only the mapped url path is valid, and accessing to unmapped path will be denied.
+  The mapping can be partial. You only need to specify the model names that you want to override. If a mapping is provided, only the mapped URL path is valid, and accessing an unmapped path will be denied.

-  Optional. An `Record<string, string>` value that provides a mapping from model names (as defined in ZModel) to unique contraint name. This is useful when you for example want to expose natural keys in place of a surrogate keys:
+  Optional. A `Record<string, string>` that provides a mapping from model names (as defined in ZModel) to a unique constraint name. This is useful, for example, when you want to expose natural keys in place of surrogate keys:

-  // Expose tags by unique name and not by ID, ie. /tag/blue intead of /tag/id
+  // Expose tags by unique name and not by ID, i.e. /tag/blue instead of /tag/id

-  Currentlly it is not possible to use custom index names. This also works for compound unique contraints just like for [compound IDs](#compound-id-fields).
+  Currently it is not possible to use custom index names. This also works for compound unique constraints just like for [compound IDs](#compound-id-fields).

- The RESTful API handler conforms to the the [JSON:API](https://jsonapi.org/format/) v1.1 specification for its URL design and input/output format. The following sections list the endpoints and features are implemented.
+ The RESTful API handler conforms to the [JSON:API](https://jsonapi.org/format/) v1.1 specification for its URL design and input/output format. The following sections list the endpoints and features that are implemented.

- Multiple filter values can be separated by comma. Items statisfying any of the values will be returned.
+ Multiple filter values can be separated by commas. Items satisfying any of the values will be returned.

- A request can carry multiple filters. Only items statisfying all filters will be returned.
+ A request can carry multiple filters. Only items satisfying all filters will be returned.

- Both `PUT` and `PATCH` do partial update and has exactly the same behavior.
+ Both `PUT` and `PATCH` do partial updates and have exactly the same behavior.
- Besides plain fields, you can also include relationships in the request body. Please note that this won't update the related resource; instead if only replaces the relationships.
+ Besides plain fields, you can also include relationships in the request body. This won't update the related resource; instead it only replaces the relationships.

- `PUT` and `PATCH` has exactly the same behavior and both relace the existing relationships with the new ones entirely.
+ `PUT` and `PATCH` have exactly the same behavior and both replace the existing relationships with the new ones entirely.

- You can use this ID value convension in places where an ID is needed, e.g., reading a single entity.
+ You can use this ID value convention in places where an ID is needed, e.g., reading a single entity.

Also applies to: 100-100, 104-104, 107-107, 115-115, 120-120, 411-411, 419-419, 683-689, 820-820, 900-900

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8f92385 and 1dcf4cb.

📒 Files selected for processing (1)
  • docs/reference/server-adapters/api-handlers/rest.mdx (1 hunks)

@ymc9 ymc9 merged commit e723c9d into zenstackhq:main Sep 1, 2025
4 checks passed
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.

2 participants