-
-
Notifications
You must be signed in to change notification settings - Fork 38
pageSize also acts as the maximum for "limit" #487
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 GitHub.
|
WalkthroughUpdated 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
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes ✨ 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type 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
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 propertiesThe 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 JSONRemove 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 enforcedGood 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 sectionAdd 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 pageReader-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.
📒 Files selected for processing (1)
docs/reference/server-adapters/api-handlers/rest.mdx(1 hunks)
Summary by CodeRabbit