apostrophecms / apostrophecms/apostrophe

In 3.x the `perPage` option on piece types should be renamed `apiPerPage`

Open
#2,772 1 comment 1 reaction 0 assignees View on GitHub
enhancement v3
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## The problem to solve

Both piece types and piece page types have a `perPage` option in 3.x. The module types are related and the properties have identical keys, but they have different purposes. We could make those more clear by renaming one.

## Proposed solution

In piece page types, `perPage` defines the number of pieces displayed on index pages of that type. For piece type modules, `perPage` defines the number of pieces included in each "page" of API GET requests.

We should rename the option on piece type modules to `apiPerPage` to make its functionality clearer. We could cover the BC break by letting `perPage` serve as an undocumented alias.

## Alternatives

We do nothing and count on documentation and the fact that it probably won't be used all that often for piece types anyway.

Contributor guide

Open the contributing guide

Research direction

Start by locating the piece type modules and piece page types that define or consume `perPage`, then trace the API GET request pagination behavior. Compare the two option meanings and determine where the new `apiPerPage` name and undocumented `perPage` compatibility alias must be handled; done means piece type API pages use the new option without changing piece page index behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.