From 7eac990ea4c4b2197775aaaa18155bb1a95e3a9b Mon Sep 17 00:00:00 2001 From: Antoine Gallix Date: Thu, 17 Jan 2019 13:13:47 +0100 Subject: [PATCH] doc:connection:precise expected return of connection resolver --- docs/relay/connection.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/relay/connection.rst b/docs/relay/connection.rst index c2379cbc..98335fa7 100644 --- a/docs/relay/connection.rst +++ b/docs/relay/connection.rst @@ -35,6 +35,10 @@ Connection Field You can create connection fields in any Connection, in case any ObjectType that implements ``Node`` will have a default Connection. +The resolver of a connection field should return a list of objects of the +announced type. Those objects will automatically be wrapped in the edge and node +structure of the connection. + .. code:: python class Faction(graphene.ObjectType): @@ -42,4 +46,5 @@ that implements ``Node`` will have a default Connection. ships = relay.ConnectionField(ShipConnection) def resolve_ships(self, info): - return [] + # shall return a list of ship objects + return get_ship_list()