diff --git a/src/graphql_relay/connection/connection.py b/src/graphql_relay/connection/connection.py index 2058baa..3321353 100644 --- a/src/graphql_relay/connection/connection.py +++ b/src/graphql_relay/connection/connection.py @@ -152,12 +152,15 @@ class PageInfoType(Protocol): def startCursor(self) -> Optional[ConnectionCursor]: ... + @property def endCursor(self) -> Optional[ConnectionCursor]: ... + @property def hasPreviousPage(self) -> bool: ... + @property def hasNextPage(self) -> bool: ... diff --git a/tests/connection/test_connection.py b/tests/connection/test_connection.py index 025cb2d..39a92f4 100644 --- a/tests/connection/test_connection.py +++ b/tests/connection/test_connection.py @@ -17,6 +17,7 @@ connection_definitions, connection_from_array, forward_connection_args, + PageInfoType, ) from ..utils import dedent @@ -98,6 +99,17 @@ class User(NamedTuple): schema = GraphQLSchema(query=query_type) +def describe_page_info_type(): + def defines_all_members_as_properties(): + for member_name in ( + "startCursor", + "endCursor", + "hasPreviousPage", + "hasNextPage", + ): + assert type(getattr(PageInfoType, member_name)) is property + + def describe_connection_definition(): def includes_connection_and_edge_fields(): source = """