Skip to content

GraphQL Boot starter support for pagination and sorting #34630

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

Closed
rstoyanchev opened this issue Mar 17, 2023 · 1 comment
Closed

GraphQL Boot starter support for pagination and sorting #34630

rstoyanchev opened this issue Mar 17, 2023 · 1 comment
Labels
status: superseded An issue that has been superseded by another

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Mar 17, 2023

This is a follow-up to spring-projects/spring-graphql#619 and spring-projects/spring-graphql#620, adding support for pagination and sorting.

I've discussed details of with @bclozel, and he plans to prepare a PR, but I'll add a summary here. Most changes should be in GraphQlAutoConfiguration to my understanding, sketched out as follows:

  • Create ConnectionTypeDefinitionConfigurer and set it on GraphQlSource.SchemaResourceBuilder to enable schema type generation of boilerplate types.
  • Declare a CursorStrategy<ScrollPosition> bean, created from ScrollPositionCursorStrategy and JsonKeysetCursorStrategy, and wrapped via CursorStrategy.withEncoder for Base64 encoding, and use it as follows:
    • Set the respective property on AnnotatedControllerConfigurer.
    • Create ConnectionFieldTypeVisitor with WindowConnectionAdapter and SliceConnectionAdapter, and add it to GraphQlSource.Builder.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 17, 2023
@scottfrederick scottfrederick added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 17, 2023
@scottfrederick scottfrederick added this to the 3.1.x milestone Mar 17, 2023
@scottfrederick
Copy link
Contributor

Closing in favor of #34677

@scottfrederick scottfrederick closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2023
@scottfrederick scottfrederick added status: superseded An issue that has been superseded by another and removed type: enhancement A general enhancement labels Mar 21, 2023
@scottfrederick scottfrederick removed this from the 3.1.x milestone Mar 21, 2023
bclozel added a commit to bclozel/spring-boot that referenced this issue Mar 21, 2023
This commit auto-configures the new pagination and sorting support for
Spring for GraphQL, if Spring Data is available.
The `GraphQlAutoConfiguration` now contributes a `CursorStrategy` bean
that is used to set up the pagination and sorting data fetching
infrastructure.

This commit also configures by default a
`ConnectionTypeDefinitionConfigurer` that automatically detects
`*Connection` types and contributes the relevant schema definitions
according to the Relay spec.

Closes spring-projectsgh-34630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants