Improved relay types

This commit is contained in:
Syrus Akbary 2016-06-15 22:45:28 -07:00
parent dd377c7da3
commit 35f42f4e0c
3 changed files with 15 additions and 2 deletions

View File

@ -10,7 +10,14 @@ def test_correct_fetch_first_ship_rebels():
rebels {
name,
ships(first: 1) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
name
}
@ -23,8 +30,15 @@ def test_correct_fetch_first_ship_rebels():
'rebels': {
'name': 'Alliance to Restore the Republic',
'ships': {
'pageInfo': {
'startCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
'endCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
'hasNextPage': True,
'hasPreviousPage': False
},
'edges': [
{
'cursor': 'YXJyYXljb25uZWN0aW9uOjA=',
'node': {
'name': 'X-Wing'
}

View File

@ -105,7 +105,6 @@ class IterableConnectionField(Field):
args,
connection_type=self.connection,
edge_type=self.connection.Edge,
pageinfo_type=None
)
return connection
return resolver

View File

@ -19,7 +19,7 @@ class NodeMeta(ObjectTypeMeta):
if not is_object_type:
get_node_from_global_id = getattr(cls, 'get_node_from_global_id', None)
id_resolver = getattr(cls, 'id_resolver', None)
assert get_node_from_global_id, '{}.get_node method is required by the Node interface.'.format(cls.__name__)
assert get_node_from_global_id, '{}.get_node_from_global_id method is required by the Node interface.'.format(cls.__name__)
node_interface, node_field = node_definitions(
get_node_from_global_id,
id_resolver=id_resolver,