Skip to content

relayArguments

PropertyValue
Config namerelayArguments
Default severity
ContextSchema
In recommendedNo

Ensures that fields returning a Relay connection type (any type whose name ends with Connection) include the required pagination arguments. By default, the rule requires both forward pagination (first/after) and backward pagination (last/before) arguments. This can be relaxed to require only one direction.

The rule checks fields on both object types and interface types.

Given this schema:

type PostConnection {
edges: [PostEdge]
}
type PostEdge {
node: Post
cursor: String
}
# ⚠️ Warning — missing pagination arguments
type User {
posts: PostConnection
}
# ⚠️ Warning — missing backward pagination arguments (with default includeBoth: true)
type User {
posts(first: Int, after: String): PostConnection
}
# ✅ Good — all pagination arguments present
type User {
posts(first: Int, after: String, last: Int, before: String): PostConnection
}
# ✅ Good — extra arguments are fine
type User {
posts(first: Int, after: String, last: Int, before: String, filter: String): PostConnection
}
OptionTypeDefaultDescription
includeBothbooltrueWhen true, requires both forward and backward pagination arguments. When false, either direction is sufficient.
# Require both forward and backward pagination arguments (default)
extensions:
graphql-analyzer:
lint:
rules:
relayArguments: warn
# Only require one direction (forward OR backward)
extensions:
graphql-analyzer:
lint:
rules:
relayArguments: [warn, { includeBoth: false }]