Merge pull request #342 from ekampf/feature/connection_edges_should_be_nonnull

Connection Edges should be NonNull
This commit is contained in:
Syrus Akbary 2016-10-28 12:44:27 +02:00 committed by GitHub
commit 9a3d84319d
3 changed files with 5 additions and 4 deletions

View File

@ -56,7 +56,7 @@ type Ship implements Node {
type ShipConnection { type ShipConnection {
pageInfo: PageInfo! pageInfo: PageInfo!
edges: [ShipEdge] edges: [ShipEdge]!
} }
type ShipEdge { type ShipEdge {

View File

@ -82,7 +82,7 @@ class ConnectionMeta(ObjectTypeMeta):
class ConnectionBase(AbstractType): class ConnectionBase(AbstractType):
page_info = Field(PageInfo, name='pageInfo', required=True) page_info = Field(PageInfo, name='pageInfo', required=True)
edges = List(edge) edges = NonNull(List(edge))
bases = (ConnectionBase, ) + bases bases = (ConnectionBase, ) + bases
attrs = dict(attrs, _meta=options, Edge=edge) attrs = dict(attrs, _meta=options, Edge=edge)

View File

@ -28,8 +28,9 @@ def test_connection():
pageinfo_field = fields['page_info'] pageinfo_field = fields['page_info']
assert isinstance(edge_field, Field) assert isinstance(edge_field, Field)
assert isinstance(edge_field.type, List) assert isinstance(edge_field.type, NonNull)
assert edge_field.type.of_type == MyObjectConnection.Edge assert isinstance(edge_field.type.of_type, List)
assert edge_field.type.of_type.of_type == MyObjectConnection.Edge
assert isinstance(pageinfo_field, Field) assert isinstance(pageinfo_field, Field)
assert isinstance(pageinfo_field.type, NonNull) assert isinstance(pageinfo_field.type, NonNull)