Closed
Description
The Relay connection spec requires adding boilerplate Connection
and Edge
types for each domain type that requires pagination.
When Relay pagination is enabled, after schema files are parsed, we will check for fields whose type name ends on "Connection", which the spec defines this as a reserved type. If no type definition is not present for that type name, we will create it.
For example, given the following declarations in schema.graphqls
:
type Query {
books: BookConnection
}
type Book {
id: ID!
title: String!
}
The following additional type definitions would be added transparently on startup:
type BookConnection {
edges: [BookEdge]!
pageInfo: PageInfo!
}
type BookEdge {
cursor: String!
node: Book!
}
type PageInfo {
hasPreviousPage: Boolean!
hasNextPage: Boolean!
startCursor: String
endCursor: String
}