mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-29 09:19:49 +03:00
doc:connection:precise expected return of connection resolver
This commit is contained in:
parent
ae7a5d71c7
commit
7eac990ea4
|
@ -35,6 +35,10 @@ Connection Field
|
||||||
You can create connection fields in any Connection, in case any ObjectType
|
You can create connection fields in any Connection, in case any ObjectType
|
||||||
that implements ``Node`` will have a default Connection.
|
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
|
.. code:: python
|
||||||
|
|
||||||
class Faction(graphene.ObjectType):
|
class Faction(graphene.ObjectType):
|
||||||
|
@ -42,4 +46,5 @@ that implements ``Node`` will have a default Connection.
|
||||||
ships = relay.ConnectionField(ShipConnection)
|
ships = relay.ConnectionField(ShipConnection)
|
||||||
|
|
||||||
def resolve_ships(self, info):
|
def resolve_ships(self, info):
|
||||||
return []
|
# shall return a list of ship objects
|
||||||
|
return get_ship_list()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user