ivome / graphql-relay-php

A library to help construct a graphql-php server supporting react-relay.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Componentise into types (ConnectionType, EdgeType, PageInfoType, etc)

torreytsui opened this issue · comments

Motivation

I have use cases to implement using a stricter typed system.

That is, in my domain, I implement custom types to extends ObjectType.

Before

However, that is impossible if we use this library, because it configs the object type using the helper functions:

  • Relay::connectionType(...): ObjectType
  • Relay::edgeType(...): ObjectType
  • etc

After

We can make it more flexible by introducing more granular Relay compliant types

  • Relay::connectionType(...): ConnectionType
  • Relay::edgeType(...): EdgeType

This also make the components more flexible (open-closed principle?!)

class MyCustomType extends ConnectionType
{
}

What do you think?