-
Notifications
You must be signed in to change notification settings - Fork 279
Adding pagination limits. #2153
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
Conversation
/azp run |
/azp run |
/azp run |
/azp run |
Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nits and should be good to merge once addressed. Still one last remaining question for how we want to handle user provided First:0 since before this change, that resolved to default page size.
src/Service.Tests/SqlTests/GraphQLPaginationTests/GraphQLPaginationTestBase.cs
Show resolved
Hide resolved
src/Service.Tests/SqlTests/GraphQLPaginationTests/GraphQLPaginationTestBase.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/SqlTests/GraphQLPaginationTests/GraphQLPaginationTestBase.cs
Show resolved
Hide resolved
Co-authored-by: Sean Leonard <sean.leonard@microsoft.com>
…Azure/data-api-builder into rohkhann/AddingPaginationLimits
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through feedback! Pending test of first: 0 for GraphQL in main, and then closing out remainder of discussions since we discussed over a call.
/azp run |
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for quickly addressing comments.
/azp run |
/azp run |
/azp run |
Why make this change?
This change allows users to use the runtime config to provide limits on the number of records that can be retrieved through paginated calls. It also gives them the ability to define a default size which will be the size returned when no pagination input is given (no first in case of graphql and no limit in case of rest calls).
What is this change?
It adds the nullable paginationoptions property to runtimeoptions of runtimeConfig.
Default page size is set to 100.
Max page size is set to 100,000 ( can be altered by the user in their runtimeconfig).
A call with -1 pagination input will result in max page size records being returned. Any call with a pagination number higher than max page size will be rejected with bad request.
In config:
default-page-size is an integer
default-page-size default is 100
default-page-size value -1 means "same as max-page-size"
default-page-size value 0 is an error
default-page-size value less than -1 is an error
default-page-size value more than than max-page-size is an error
max-page-size is an integer
max-page-size default is 100,000
max-page-size value -1 means "same as int.MaxValue"
max-page-size value 0 is an error
max-page-size value less than -1 is an error
max-page-size value more than int.MaxValue is an error
In a query (REST or GQL):
$first=-1 means "whatever the max-page-size value is"
$first=less than -1 is an error
$first=0 is an error
$first=(any value more than max-page-size) is an error
Sample configuration file:
How was this tested?