spring-projects / spring-projects/spring-data-rest
Allow easier configuration of one-indexed mode for PageableHandlerMethodArgumentResolver [DATAREST-911]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.