spring-projects / spring-projects/spring-data-rest

Allow easier configuration of one-indexed mode for PageableHandlerMethodArgumentResolver [DATAREST-911]

Open
#1,277 2 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: enhancement
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Triqui Galletas opened DATAREST-911 and commented

I've seen all kinds of settings when accessing paginated resources: different page sizes, different parameters names, using an offset/start parameters instead of page numbers, and probably some others. But I've never seen a single place where the first page is the index '0'. Surely there are many, but I always found frameworks/plugins/apps that expect the first page to be the page number 1.

The thing is you have all these settings to the RepositoryRestConfiguration, but the index of the first page is not there.

private int defaultPageSize = 20;
private int maxPageSize = 1000;
private String pageParamName = "page";
private String limitParamName = "size";
private String sortParamName = "sort";

So, first I think setOneIndexedParameters(true) should be the default. (Maybe not, since the default for Pageable implementations is zero in other Spring components). Second, there should be a property in the RepositoryRestConfiguration to define if it is true or not. Third, otherwise it should be possible to configure the pageableResolver with a RepositoryRestConfigurerAdapter


No further details from DATAREST-911

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.