Increase max pager size, ideally per resource type

Created on 16 January 2019, almost 6 years ago
Updated 31 May 2023, over 1 year ago

Problem/Motivation

@moshe requested this during last week's API-First Initiative meeting. We discussed it at length in Slack, sadly Slack ate the history.

Proposed resolution

From most to least work:

  1. Add ResourceType::getLimitMax() (and perhaps ResourceType::getLimitDefault()). Then update JSON:API Extras to make it configurable.
  2. Add jsonapi.pager.max_size container parameter
  3. Don't provide explicit support for this, instead recommend to create a custom param enhancer or KernelEvents::REQUEST subscriber that runs after \Drupal\jsonapi\Routing\JsonApiParamEnhancer::enhance() and does $request->attributes['_json_api_params']['page'] = new OffsetPage(…, CUSTOM_MAX);.

Concerns for each:

  1. Tying the limit to a resource type means we don't know what the limit would be for mixed bundles ( #2956414: Support mixed-bundle collections (e.g. `/jsonapi/node`) ) or when dealing with search ( #2991729: Ability to define a "full text search" filter, e.g. using Elasticsearch ). In other words: this would be a nice fit today, but it likely will get in the way in the future, when expanding JSON:API's capabilities.
  2. Hard. But this is okay, we want to discourage customization, and encourage experience reports to steer tweaking defaults. Moshe's use case is very particular.

Remaining tasks

TBD

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
JSON API 

Last updated 1 day ago

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024