bdunogier / ezplatform-graphql-bundle

GraphQL server for eZ Platform, the open source Symfony CMS.
13 stars 6 forks source link

Implement Relay Network Layer support #21

Open bdunogier opened 6 years ago

bdunogier commented 6 years ago

The Relay Network Layer is a middleware for GraphQL that bring in many very valuable features, most notably in regards to performances:

From https://github.com/relay-tools/react-relay-network-modern:

The ReactRelayNetworkModern is a Network Layer for Relay Modern with various middlewares which can manipulate requests/responses on the fly (change auth headers, request url or perform some fallback if request fails), batch several relay request by timeout into one http request, cache queries and server-side rendering.

Its implementation will be a breaking change, as it requires several standards to be apply (https://facebook.github.io/relay/docs/en/graphql-server-specification.html):

The three core assumptions that Relay makes about a GraphQL server are that it provides:

  • A mechanism for refetching an object.
  • A description of how to page through connections.
  • Structure around mutations to make them predictable.

The "mechanism for refetching an object" implies that each entity has a "global id", allowing to uniquely identify it based on its ID alone: content-123 instead of 123.

The "description of how to page through collections" implies that we restructure all items collections.