1
1
---
2
- title : Relay wrong resolver annotation Error
2
+ title : Connection wrong resolver annotation Error
3
3
---
4
4
5
- # Relay wrong resolver annotation error
5
+ # Connection wrong resolver annotation error
6
6
7
7
## Description
8
8
9
- This error is thrown when a field on a relay connection was defined with a
10
- resolver that returns something that is not compatible with pagination.
9
+ This error is thrown when a field on a connection was defined with a resolver
10
+ that returns something that is not compatible with pagination.
11
11
12
12
For example, the following code would throw this error:
13
13
14
14
``` python
15
15
from typing import Any
16
16
17
17
import strawberry
18
- from strawberry import relay
18
+ from strawberry.pagination import connection
19
19
20
20
21
21
@strawberry.type
22
- class MyType (relay . Node ): ...
22
+ class MyType (Node ): ...
23
23
24
24
25
25
@strawberry.type
26
26
class Query :
27
- @relay. connection (relay. Connection[MyType])
27
+ @connection (Connection[MyType])
28
28
def some_connection_returning_mytype (self ) -> MyType: ...
29
29
30
- @relay. connection (relay. Connection[MyType])
30
+ @connection (Connection[MyType])
31
31
def some_connection_returning_any (self ) -> Any: ...
32
32
```
33
33
@@ -53,22 +53,22 @@ For example:
53
53
from typing import Any
54
54
55
55
import strawberry
56
- from strawberry import relay
56
+ from strawberry.pagination import connection, Connection
57
57
58
58
59
59
@strawberry.type
60
- class MyType ( relay . Node ) : ...
60
+ class MyType : ...
61
61
62
62
63
63
@strawberry.type
64
64
class Query :
65
- @relay. connection (relay. Connection[MyType])
65
+ @connection (Connection[MyType])
66
66
def some_connection (self ) -> Iterable[MyType]: ...
67
67
```
68
68
69
69
<Note >
70
70
Note that if you are returning a type different than the connection type, you
71
71
will need to subclass the connection type and override its ` resolve_node `
72
- method to convert it to the correct type, as explained in the [ relay
73
- guide] ( ../guides/relay ) .
72
+ method to convert it to the correct type, as explained in the [ pagination
73
+ guide] ( ../guides/pagination ) .
74
74
</Note >
0 commit comments