Skip to content
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

Pageable/start from 1 #1566

Open
wants to merge 8 commits into
base: 4.7.x
Choose a base branch
from

Conversation

alexsimpson440dev
Copy link

What this does

  • Adds startFromPageOne config property that allows users to enter 1 for the page number and get the first page back
  • This is done by shifting the page number in the PageableRequestArgumentBinder by one if that property is set to true

Why is this needed

I am sure there are better ways to implement this, but this is similar to how spring has it implemented.

Also I noticed the docs for configuration properties are here: https://micronaut-projects.github.io/micronaut-data/latest/guide/configurationreference.html#io.micronaut.data.r2dbc.config.DataR2dbcConfiguration which doesn't seem to be linked to micronaut-data. Let me know if you would like me to update these docs if this does move forward.

@dstepanov
Copy link
Contributor

Looks fine to me, you might want to throw an exception if somebody sends 0 as the page number.

@graemerocher
Copy link
Contributor

I'm not sure this change is enough. The return value of

would also need to be shifted whenever an instance of Page is returned would it not?

@dstepanov
Copy link
Contributor

It's only problematic if you use Page directly in the response, if you have a custom one it's fine.

@BrianEstrada
Copy link

Bumping, any updates on this? would be super cool to have this as a configurable

@alexsimpson440dev
Copy link
Author

@BrianEstrada I haven't done anything as of recently but I was researching a way to do this without shifting the page number down 1. I remember there might be a way to change what is returned via offsets in the pageable interface but Its been a while.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants