A connection is a vitaminized version of a List that provides ways of
slicing and paginating through it. The way you create Connection types
graphene is using
If we want to create a custom Connection on a given node, we have to subclass the
In the following example,
extra will be an extra field in the connection,
other an extra field in the Connection Edge.
class ShipConnection(Connection): extra = String() class Meta: node = Ship class Edge: other = String()
ShipConnection connection class, will have automatically a
edges field (which is a list of
Edge will have a
node field linking to the specified node
ShipConnection.Meta) and the field
other that we defined in the class.
You can create connection fields in any Connection, in case any ObjectType
Node will have a default Connection.
class Faction(graphene.ObjectType): name = graphene.String() ships = relay.ConnectionField(ShipConnection) def resolve_ships(self, info): return