graphql-spqr icon indicating copy to clipboard operation
graphql-spqr copied to clipboard

Relay and Federated API

Open blongstreth opened this issue 3 years ago • 0 comments

I am evaluating this library for use in a federated GraphQL API and noticed that I can't easily federate with other services which have defined the relay cursor as a scalar type rather than a string. For example:

scalar Cursor

type PageInfo {
  endCursor: Cursor
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: Cursor
}

type FooConnection {
  edges: [FooEdge!]!
  pageInfo: PageInfo!
  totalCount: Int!
}

type FooEdge {
  cursor: Cursor!
  node: Foo!
}

type Foo {

}

type Query {
  getFooElements(after: Cursor, before: Cursor, first: Int, last: Int): FooConnection!
}

I briefly looked through graphgl-java Relay class and noticed that doesn't lend itself to easily support a scalar Cursor type or even a custom PageInfo type name (i.e. MyPageInfo) which would help get around the issue entirely. I don't see any easy way to hack around this issue without creating a custom connection-like API which doesn't extend Connection. I was just curious if anyone has any advise or would consider updating this library (and probably graphql-java to be consistent) to better support the scenario I just outlined.

blongstreth avatar Dec 19 '21 23:12 blongstreth