docs/errors/relay-wrong-resolver-annotation.md
This error is thrown when a field on a relay connection was defined with a resolver that returns something that is not compatible with pagination.
For example, the following code would throw this error:
from typing import Any
import strawberry
from strawberry import relay
@strawberry.type
class MyType(relay.Node): ...
@strawberry.type
class Query:
@relay.connection(relay.Connection[MyType])
def some_connection_returning_mytype(self) -> MyType: ...
@relay.connection(relay.Connection[MyType])
def some_connection_returning_any(self) -> Any: ...
This happens because the connection resolver needs to return something that can be paginated, usually an iterable/generator of the connection type itself.
You can fix this error by annotating the resolver with one of the following supported types:
List[<NodeType>]Iterator[<NodeType>]Iterable[<NodeType>]AsyncIterator[<NodeType>]AsyncIterable[<NodeType>]Generator[<NodeType>, Any, Any]AsyncGenerator[<NodeType>, Any]For example:
from typing import Any
import strawberry
from strawberry import relay
@strawberry.type
class MyType(relay.Node): ...
@strawberry.type
class Query:
@relay.connection(relay.Connection[MyType])
def some_connection(self) -> Iterable[MyType]: ...