Skip to content

GraphQL: Subclass offset based pagination

Brett Walker requested to merge bw-offset-pagination into master

What does this MR do?

Keyset / stable cursor based pagination currently has limits, and can not be used in all ActiveRecord::Relation cases. However by default we use keyset pagination for every ActiveRecord::Relation.

A new Gitlab::Graphql::Pagination::OffsetActiveRecordRelationConnection simply subclasses from the graphql gem GraphQL::Relay::RelationConnection, and allows us to use offset pagination when necessary. Many times it is good enough, and allows us to support reasonable pagination in cases that KeySet pagination doesn't support.

Once we upgrade to 1.10.x in #207278 (closed), we'l migrate the class to use the new GraphQL::Pagination::ActiveRecordRelationConnection.

The reason for putting this class in gitlab/graphql/pagination instead of gitlab/graphql/connections is because 1.10.x now places connections in the pagination directory. An upcoming MR will refactor other connections into this directory structure.

Related to #36758 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Brett Walker

Merge request reports