mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Merge pull request #297 from sjhewitt/connection-node
relay Connection.node does not have to subclass Node/ObjectType
This commit is contained in:
commit
d112cc5988
|
@ -6,13 +6,14 @@ import six
|
||||||
|
|
||||||
from graphql_relay import connection_from_list
|
from graphql_relay import connection_from_list
|
||||||
|
|
||||||
from ..types import AbstractType, Boolean, Int, List, String
|
from ..types import (AbstractType, Boolean, Enum, Int, Interface, List, NonNull, Scalar, String,
|
||||||
|
Union)
|
||||||
from ..types.field import Field
|
from ..types.field import Field
|
||||||
from ..types.objecttype import ObjectType, ObjectTypeMeta
|
from ..types.objecttype import ObjectType, ObjectTypeMeta
|
||||||
from ..types.options import Options
|
from ..types.options import Options
|
||||||
from ..utils.is_base_type import is_base_type
|
from ..utils.is_base_type import is_base_type
|
||||||
from ..utils.props import props
|
from ..utils.props import props
|
||||||
from .node import Node, is_node
|
from .node import is_node
|
||||||
|
|
||||||
|
|
||||||
class PageInfo(ObjectType):
|
class PageInfo(ObjectType):
|
||||||
|
@ -57,7 +58,7 @@ class ConnectionMeta(ObjectTypeMeta):
|
||||||
options.local_fields = OrderedDict()
|
options.local_fields = OrderedDict()
|
||||||
|
|
||||||
assert options.node, 'You have to provide a node in {}.Meta'.format(cls.__name__)
|
assert options.node, 'You have to provide a node in {}.Meta'.format(cls.__name__)
|
||||||
assert issubclass(options.node, (Node, ObjectType)), (
|
assert issubclass(options.node, (Scalar, Enum, ObjectType, Interface, Union, NonNull)), (
|
||||||
'Received incompatible node "{}" for Connection {}.'
|
'Received incompatible node "{}" for Connection {}.'
|
||||||
).format(options.node, name)
|
).format(options.node, name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user