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

feat(c/v3-engine): support Relay's `Cursor Connections Specification`

Open jjangga0214 opened this issue 1 year ago • 4 comments

Component

c/v3-engine

Is your proposal related to a problem?

There's GraphQL Cursor Connections Specification for Relay.

Hasura v2 supports it.

Hasura v3 ddn docs argue it also supports the spec.

스크린샷 2024-12-30 오전 7 19 15

But I actually cannot find a way to enable it.

Describe the solution you'd like

Metadata setting for Relay's Cursor-Connection Spec.

Describe alternatives you've considered

Additional APIs (e.g. connection suffix as like v2)

jjangga0214 avatar Dec 29 '24 22:12 jjangga0214

@jjangga0214 — can you take a look at the collapsed example inside of this docs section and let me know if this helps you use GlobalIDs for relay?

robertjdominguez avatar Dec 30 '24 13:12 robertjdominguez

DDN calls this global id

This needs to be configured on the Model https://hasura.io/docs/3.0/supergraph-modeling/models

kind: Model
version: v1
definition:
  globalIdSource: true

And also on the ObjectType https://hasura.io/docs/3.0/supergraph-modeling/types/

kind: ObjectType
version: v1
definition:
  globalIdFields:
    - author_id

This should enable the relay global id on this model

nullxone avatar Dec 30 '24 17:12 nullxone

@robertjdominguez Hi! Thanks for the reply :) @nullxone Thanks for the advice :) I've already configured Global ID, but that's not the point. Opaque Global ID, Node interface, and node query are just part of Relay spec.

I am asking for another one. About GraphQL Cursor Connections Specification.

For example, the screenshot below is from Hasura v2.

스크린샷 2024-12-31 오전 11 49 58

As you can see, there are pageInfo, edges, cursor, node .. v2 supports them while v3 doesn't. To declare "ddn supports Relay spec", GraphQL Cursor Connections Specification must be supported as well. Without Cursor Connections Spec, directives like @connection, which is used for Relay Client implementation, will take no effect.

jjangga0214 avatar Dec 31 '24 02:12 jjangga0214

Thanks for clarifying, @jjangga0214 🙌

I've updated the docs to accurately reflect what we support with respect to Relay and have added the c/v3-engine tag to this issue.

This tag will trigger an internal automation so we can track this and get back to you with information about the feature request. Let us know if you have any questions!

robertjdominguez avatar Dec 31 '24 16:12 robertjdominguez