-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First page number is 0 in the API response when using spring data one-indexed-parameters #2811
Comments
@sundarsabapathi You should provide a minimal reproducer. |
Hi @quaff, Sorry for the late reply. I reproduce the issue with minimal code and attached the zip file. Please give your feedback. |
Serializing |
Thanks @odrotbohm. I follow your suggestion to try again. |
Regardless of it being a domain object, it looks like an error. The Page should be constructed based on Pageable and contain its parameters, similar to the PageImpl instance, even if the parameter only concerns the way Pageable is built. |
I am unable to follow here, either. The ticket is about serializing
The reference documentation contains a dedicated section on the web aspects of serializing |
This seems more crazy than I thought. :/ I initially believed that the Pageable object would take the same value as in the URL, but now I see that it is modified during the binding of the address to PageRequest. This generates many problems because, from the HTTP layer, page parameter is other than page parameter in the query, but in the case of HATEOAS, the links to the beginning of the resources are incorrectly generated as they should contain page=1 instead of page=0. This approach is very confusing, and I would consider starting a new issue to:
|
As a first measure, let's stop derailing the original reporter's problem with completely unrelated aspects (the way you assume query parameters to look like and work, for example). |
I am using
spring-boot-starter-web
andspring-boot-starter-jpa
to developing a REST API.I am trying to make an API page start from 1 instead of 0.
I configured the following property
spring.data.web.pageable.one-indexed-parameters=true
inapplication.properties
file.Here is my current endpoint implementation code:
When the above REST endpoint is invoked as below
http://localhost:9091/user-management/userinfo/alluser
Then I get the following response
I am expecting the
pageNumber
to be 1, however it is 0.The text was updated successfully, but these errors were encountered: