mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-23 23:20:47 +03:00
Simplified ConnectionField type checking
This commit is contained in:
parent
072b2f3dd0
commit
1d8f5ded33
|
@ -119,20 +119,15 @@ class ConnectionField(Field):
|
||||||
kwargs.setdefault('after', String())
|
kwargs.setdefault('after', String())
|
||||||
kwargs.setdefault('first', Int())
|
kwargs.setdefault('first', Int())
|
||||||
kwargs.setdefault('last', Int())
|
kwargs.setdefault('last', Int())
|
||||||
|
assert issubclass(type, Connection), (
|
||||||
|
'{} type have to be a subclass of Connection. Received "{}".'
|
||||||
|
).format(str(self), type)
|
||||||
super(ConnectionField, self).__init__(
|
super(ConnectionField, self).__init__(
|
||||||
type,
|
type,
|
||||||
*args,
|
*args,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def type(self):
|
|
||||||
type = super(ConnectionField, self).type
|
|
||||||
assert issubclass(type, Connection), (
|
|
||||||
'{} type have to be a subclass of Connection. Received "{}".'
|
|
||||||
).format(str(self), type)
|
|
||||||
return type
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def connection_resolver(cls, resolver, connection_type, root, args, context, info):
|
def connection_resolver(cls, resolver, connection_type, root, args, context, info):
|
||||||
resolved = resolver(root, args, context, info)
|
resolved = resolver(root, args, context, info)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user