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