mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-26 03:23:55 +03:00
Fixed Connection side effects and add into breaking changes.
This commit is contained in:
parent
f1624af08a
commit
ec5697b185
|
@ -47,3 +47,36 @@
|
|||
class Dog(ObjectType, interfaces=[Pet]):
|
||||
name = String()
|
||||
```
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
* Node types no longer have a `Connection` by default.
|
||||
In 2.0 and onwoards `Connection`s should be defined explicitly.
|
||||
|
||||
Before:
|
||||
|
||||
```python
|
||||
class User(ObjectType):
|
||||
class Meta:
|
||||
interfaces = [relay.Node]
|
||||
name = String()
|
||||
|
||||
class Query(ObjectType):
|
||||
user_connection = relay.ConnectionField(User)
|
||||
```
|
||||
|
||||
With 2.0:
|
||||
|
||||
```python
|
||||
class User(ObjectType):
|
||||
class Meta:
|
||||
interfaces = [relay.Node]
|
||||
name = String()
|
||||
|
||||
class UserConnection(relay.Connection):
|
||||
class Meta:
|
||||
node = User
|
||||
|
||||
class Query(ObjectType):
|
||||
user_connection = relay.ConnectionField(UserConnection)
|
||||
```
|
||||
|
|
|
@ -98,9 +98,6 @@ class IterableConnectionField(Field):
|
|||
@property
|
||||
def type(self):
|
||||
type = super(IterableConnectionField, self).type
|
||||
if is_node(type):
|
||||
connection_type = type.Connection
|
||||
else:
|
||||
connection_type = type
|
||||
assert issubclass(connection_type, Connection), (
|
||||
'{} type have to be a subclass of Connection. Received "{}".'
|
||||
|
|
Loading…
Reference in New Issue
Block a user