4
votes

I try to understand Graphql in django and use graphene and graphene_django. My frontend will probably be built with Vuejs and Apollo client. All the tutorials on the internet are about wether classic Graphql or Relay. Relay with its Nodes and Edges seem to be advised (is it ?). But Node and Edges are available with wether the interface graphene.Node or the interface graphene.relay.Node.

Is there any difference between these two ?

Complementary question : Is it a good practice to use node and edges, even though I wont use Relay/React ? Apollo docs are all about classic Graphql.

Regards

1
Nothing different. graphene.Node is imported from graphene.relay.Node.Yang HG
Another question, in fact, I don't like node and edges, but I would like to follow it. That means we can coordinate codes between different environment. A bad standard is better than no standard.Yang HG

1 Answers

1
votes

As Yang HG pointed out, there is no difference between relay.Node and Node.

Whether it's a good practice to use the Node interface, the best thing about it is it forces the types that inherit Node to have an ID. Second advantage: Connection (adding extra fields to the node's Connection and Edge).

Read this to see how ID is enforced for all Nodes: https://atheros.ai/blog/graphql-interfaces-and-unions-how-to-design-graphql-schema