Skip to content

Auto-generate Connection, PageInfo, and Edge schema type definitions #619

Closed
@rstoyanchev

Description

@rstoyanchev

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
}

Metadata

Metadata

Assignees

Labels

in: coreIssues related to config and core supporttype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions