mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-24 23:09:46 +03:00
Added ability to add _root values to connection
This commit is contained in:
parent
cfb0b2257b
commit
5202fed41a
|
@ -111,14 +111,14 @@ class SimpleConnection(Connection):
|
|||
|
||||
@classmethod
|
||||
@memoize
|
||||
def for_node(cls, node, edge_type=None):
|
||||
def for_node(cls, node, root_values=None):
|
||||
from graphene.relay.utils import is_node, is_node_type
|
||||
assert is_node(node) or is_node_type(node), 'ObjectTypes in a connection have to be Nodes'
|
||||
edges = List(node, description='Information to aid in pagination.')
|
||||
return type(
|
||||
'%s%s' % (node._meta.type_name, cls._meta.type_name),
|
||||
(cls,),
|
||||
{'edge_type': node, 'edges': edges})
|
||||
{'edge_type': node, 'edges': edges, '_root': root_values})
|
||||
|
||||
@classmethod
|
||||
def from_list(cls, iterable, args, context, info):
|
||||
|
|
Loading…
Reference in New Issue
Block a user