relay-arguments
- Category:
Schema
- Rule name:
@graphql-eslint/relay-arguments
- Requires GraphQL Schema:
false
ℹ️ - Requires GraphQL Operations:
false
ℹ️
Set of rules to follow Relay specification for Arguments.
- A field that returns a Connection type must include forward pagination arguments (
first
andafter
), backward pagination arguments (last
andbefore
), or both
Forward pagination arguments
first
takes a non-negative integerafter
takes the Cursor type
Backward pagination arguments
last
takes a non-negative integerbefore
takes the Cursor type
Usage Examples
Incorrect
# eslint @graphql-eslint/relay-arguments: 'error'
type User {
posts: PostConnection
}
Correct
# eslint @graphql-eslint/relay-arguments: 'error'
type User {
posts(after: String, first: Int, before: String, last: Int): PostConnection
}
Config Schema
The schema defines the following properties:
includeBoth
(boolean)
Enforce including both forward and backward pagination arguments
Default: true
Resources
Last updated on