- Notifications
You must be signed in to change notification settings - Fork1.5k
Add pagination support to GraphQL-based tools#683
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
ListDiscussions
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
A downside of using cursor-based pagination in GraphQL is that there is no way of 'skipping' pages as the ID of the final entry of the previously - I am investigating falling back to the REST api if the user needs this functionality. |
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.
Pull Request Overview
This PR implements pagination support for GraphQL-based tools to provide consistent pagination capabilities across both REST and GraphQL APIs. The changes introduce a unified pagination approach that accepts traditional page/perPage parameters while providing GraphQL cursor-based pagination support through theafter
parameter.
Key changes include:
- Introduction of
WithUnifiedPagination()
function that adds page, perPage, and after parameters to GraphQL tools - Conversion of private pagination struct fields to public fields (Page, PerPage, After)
- Addition of
ToGraphQLParams()
method to convert REST-style pagination to GraphQL parameters - Update of GraphQL discussion tools to return structured responses with pagination metadata
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
pkg/github/server.go | Adds unified pagination support and GraphQL parameter conversion |
pkg/github/discussions.go | Implements pagination for all discussion-related GraphQL tools |
pkg/github/discussions_test.go | Updates tests to handle new pagination response structure |
pkg/github/server_test.go | Updates pagination tests for public struct fields |
Multiple REST API files | Updates field references from private to public pagination fields |
README.md | Documents new pagination parameters for discussion tools |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
7ccc6b6
intomainUh oh!
There was an error while loading.Please reload this page.
* initial pagination for `ListDiscussions`* redo category id var cast* add GraphQL pagination support for discussion comments and categories* remove pageinfo returns* fix out ref for linter* update docs* move to unified pagination for consensus on params* update docs* refactor pagination handling* update docs* linter fix* conv rest to gql params for safe lint* add nolint* add error handling for perPage value in ToGraphQLParams* refactor pagination error handling* unified params for rest andn graphql and rennamed to be uniform for golang* add 'after' for pagination* update docs* Update pkg/github/discussions.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* Update pkg/github/discussions.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* Update pkg/github/discussions_test.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* update default page size const* reduce default pagination size from 100 to 30 in discussion tests* update pagination for reverse and total* update pagination to remove from discussions* updated README* improve the `ToGraphQLParams` function---------Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* initial pagination for `ListDiscussions`* redo category id var cast* add GraphQL pagination support for discussion comments and categories* remove pageinfo returns* fix out ref for linter* update docs* move to unified pagination for consensus on params* update docs* refactor pagination handling* update docs* linter fix* conv rest to gql params for safe lint* add nolint* add error handling for perPage value in ToGraphQLParams* refactor pagination error handling* unified params for rest andn graphql and rennamed to be uniform for golang* add 'after' for pagination* update docs* Update pkg/github/discussions.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* Update pkg/github/discussions.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* Update pkg/github/discussions_test.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* update default page size const* reduce default pagination size from 100 to 30 in discussion tests* update pagination for reverse and total* update pagination to remove from discussions* updated README* improve the `ToGraphQLParams` function---------Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
This PR idiomatically implements pagination for GraphQL based tools using the spec described inhttps://docs.github.com/en/graphql/reference/objects#connection and based on the standard inhttps://graphql.org/learn/pagination/
Closes:https://github.com/github/copilot-agent-services/issues/296