-
Notifications
You must be signed in to change notification settings - Fork 691
Open
Labels
status: feedback-providedFeedback has been providedFeedback has been provided
Description
Good morning from spain.
My scope is Spring boot 3.1 I'm implemeting REST service and I have pagination for return large list of elements. For default Spring boot manage the page from 0 index. I have reading that is possible start pagination from page 1, using this senetence in application.yaml:
spring:
data:
web:
pageable:
one-indexed-parameters: true
With new settings, the page 0 and the page 1 is the same. It show the same result. The problem is that the param "number" on paginations settings always show one page less, that I access:
Examples:
To page 0
Request:
{{base_url}}/system/business/pagination?size=5&page=0
Response details:
"pagination": {
"totalPages": 4,
"totalElements": 17,
"size": 5,
"number": 0,
"numberOfElements": 5,
"empty": false,
"first": true,
"last": false,
"sorted": false
}
Note: I would prefer that it returns null.
To page 1
Request:
{{base_url}}/system/business/pagination?size=5&page=1
Response details:
"pagination": {
"totalPages": 4,
"totalElements": 17,
"size": 5,
"number": 0,
"numberOfElements": 5,
"empty": false,
"first": true,
"last": false,
"sorted": false
}
Note: Returns the same that page 0. See that number value is wrong. It would have to be 1.
To page 2
Request:
{{base_url}}/system/business/pagination?size=5&page=2
Response details:
"pagination": {
"totalPages": 4,
"totalElements": 17,
"size": 5,
"number": 1,
"numberOfElements": 5,
"empty": false,
"first": false,
"last": false,
"sorted": false
}
Note: Return the page 2, but number value is 1.
Thanks for your attention
Metadata
Metadata
Assignees
Labels
status: feedback-providedFeedback has been providedFeedback has been provided