This is a follow-up to https://github.com/spring-projects/spring-graphql/issues/619 and https://github.com/spring-projects/spring-graphql/issues/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.

Comment From: scottfrederick

Closing in favor of #34677