-
Notifications
You must be signed in to change notification settings - Fork 305
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
Pagination and Sorting Support #103
Comments
this is an example https://doug-martin.github.io/nestjs-query/docs/graphql/paging cursor based and offset based paginations are compatible. just add |
I'm trying to implement this, but just wanted to check before. When is this feature going to come out if ever? |
@SeriousSamV I don't think this is an easy issue to tackle and we probably need to spend some time designing and iterating on that problem. This issue is not scheduled yet so we don't have a concrete plan for it. Voting for this issue and sharing useful information about use cases (see previous comments) is a way to help us make progress on this. |
Thanks again for the fantastic work on this project, it has greatly simplified the integration of graphql-java into an existing SpringBoot project. I don't see much movement on this issue and it doesn't look like it'll be tackled as part of RC1 so I figured I'll give it a push. Pagination support is a pretty common requirement for APIs. In terms of use-cases, we are in the process of transitioning some GET endpoints from REST to GraphQL. Previously, these endpoints return a As part of the initial transition, we are utilizing an offset-based approach supported by our client. This was straightforward to implement by exposing offset/limit query arguments and creating a Ideally though, a cursor-based implementation such the relay cursor connections specification should be chosen. Besides relay, there seems to be a shift towards clients supporting that specification as a standard (e.g. see apollo). If the full relay connections specification looks too daunting, perhaps simpler offset/cursor-based pagination implementations can be first supported? It'll be nice to rely on an official implementation vs. hand-rolling our own. Hopefully some of this context helps. Happy to provide more if its useful. Thanks! |
Is there any "temporary" of implementing pagination while this issue is addressed? |
Hi! Is there any update of this issue? We were using https://github.com/graphql-java-kickstart/graphql-spring-boot in some of our projects. It already provides pagination using relay classes -> https://www.graphql-java-kickstart.com/tools/relay. These relay classes are already defined in com.graphql-java library, so would be available in this project too. It's not necessary to reinvent the wheel :) Probably the first step to support relay/pagination is to recognize relay directives in the schema.graphqls dinamically, generating the necessary classes. |
Hello, I'd like to share my workaround for Pagination and Sorting Support for Spring GraphQL, using Kotlin, although it doesn't work with cursors (as per spring-projects/spring-data-commons#2151). https://gist.github.com/Michal-Kucera/a0ad1572a0c212dc8b67b8136c7cb78c P.S. I didn't try it out with nested schemas.. Once Spring data common supports cursors, we may reuse classes from
There is also an interesting class Cheers! |
Hi. I am also interested in the pagination support. Especially in the |
Thanks for the comment, @cezary-butler. I've created #597 as a more specific issue for now. Let's continue the discussion there. |
I've turned this into an umbrella issue. See issue description at the top for a list of sub-tasks for the actual work. |
Is pagination support only possible with spring boot v3.x.x and not v2.7.x? I am currently using v2.7.8 and I wonder if there is any way to implement pagination using spring-for-graphql? |
@chop-sui this new feature will be available as of Spring for GraphQL 1.2.0 (so Spring Boot 3.1.0). We don't backport new features. |
It also depends on what exactly you need from pagination. If using Spring Data pagination, then yes we'll have 1st class support for that in 1.2 (only), but that in turn depends on Spring Data's cursor support that's also in development. You can also adapt other persistence pagination mechanisms, but obviously that can't be built in, and you'll need to upgrade to make use of that. If it's just |
@bclozel @rstoyanchev Thank you for comfirming. I am planning to use Spring Data pagination with connection style GraphQL pagination. I will look into migrating to Spring Boot 3 as the project I'm working on has started only recently. |
I'm closing this umbrella issue since all sub-tasks are now complete. |
Investigate ways to support Pagination, for example connecting to pagination support in Spring Data repositories. There is also a specification as well. There are a different ways to control navigation, typically offset or cursor based. Spring Data currently supports offset based pagination.
Pagination depends on a predictable sort order. There doesn't seem to be any spec or ongoing effort to converge on a common approach. There is a talk on the topic that provides a good overview.
@SchemaMapping
methods #620SchemaMappingInspector
to supportConnection
types #656The text was updated successfully, but these errors were encountered: