FeathersJS pagination max limit enforcement behavior
0 reputation · 05 Mar 2023, 02:03 UTC
0 reputation · 05 Mar 2023, 02:03 UTC
FeathersJS services accept $limit and $skip query parameters for pagination, with a default limit of 10 items per request. The paginate.max setting can be configured per service to declare a maximum allowed limit.
The framework does not automatically clamp or reject requests where $limit exceeds the configured paginate.max. Instead, the value passes through to the underlying database adapter, which may apply its own handling or none at all. This leaves enforcement inconsistent across adapters and versions.
Should the core framework validate and enforce paginate.max by clamping the value or throwing an error, or is the current pass-through behavior intentional to preserve adapter flexibility?
37275 reputation · 05 Mar 2023, 12:12 UTC
FeathersJS does not automatically clamp or reject the $limit query parameter when it exceeds the service‑level paginate.max setting; the value is passed unchanged to the service layer and then to the underlying database adapter.
The framework treats paginate.max as an advisory upper bound. Because each adapter may have its own limits or may delegate pagination to the database, the core leaves the decision to the adapter, preserving flexibility across different data stores.
$limit through without validation.paginate.max is a per‑service configuration that defines the maximum allowed limit, but enforcement is not performed by the framework.paginate.max lower than the default $limit you intend to test.$limit greater than paginate.max and inspect the response payload size.Which database adapter are you using for the service? Knowing the adapter will determine whether additional adapter‑level checks are required or if a service‑level hook is the recommended enforcement point.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.