Skip to content

Commit 38baf7a

Browse files
committed
Handle relay connection field being required
1 parent 42c96a4 commit 38baf7a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

graphene/relay/connection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ def __init__(self, type, *args, **kwargs):
9999
def type(self):
100100
type = super(IterableConnectionField, self).type
101101
connection_type = type
102-
if is_node(type):
102+
if isinstance(type, NonNull):
103+
connection_type = type.of_type
104+
105+
if is_node(connection_type):
103106
raise Exception(
104107
"ConnectionField's now need a explicit ConnectionType for Nodes.\n"
105108
"Read more: https://github.com/graphql-python/graphene/blob/v2.0.0/UPGRADE-v2.0.md#node-connections"
@@ -108,10 +111,13 @@ def type(self):
108111
assert issubclass(connection_type, Connection), (
109112
'{} type have to be a subclass of Connection. Received "{}".'
110113
).format(self.__class__.__name__, connection_type)
111-
return connection_type
114+
return type
112115

113116
@classmethod
114117
def resolve_connection(cls, connection_type, args, resolved):
118+
if isinstance(connection_type, NonNull):
119+
connection_type = connection_type.of_type
120+
115121
if isinstance(resolved, connection_type):
116122
return resolved
117123

0 commit comments

Comments
 (0)