relayPageInfo
| Property | Value |
|---|---|
| Config name | relayPageInfo |
| Default severity | — |
| Context | Schema |
| In recommended | No |
What it checks
Section titled “What it checks”Enforces that the PageInfo type in your schema conforms to the Relay Connection specification. Specifically, it checks that:
PageInfois an object type (not a scalar, enum, etc.)- It contains the four required fields with the correct types:
hasPreviousPage: Boolean!hasNextPage: Boolean!startCursor: StringendCursor: String
Additional fields beyond the four required ones are allowed.
Examples
Section titled “Examples”# ❌ Bad — missing required fieldstype PageInfo { totalCount: Int}# ❌ Bad — wrong types (cursors must be nullable, booleans must be non-null)type PageInfo { hasPreviousPage: Boolean hasNextPage: Boolean startCursor: String! endCursor: String!}# ✅ Good — all required fields with correct typestype PageInfo { hasPreviousPage: Boolean! hasNextPage: Boolean! startCursor: String endCursor: String}# ✅ Good — extra fields are finetype PageInfo { hasPreviousPage: Boolean! hasNextPage: Boolean! startCursor: String endCursor: String totalCount: Int}Configuration
Section titled “Configuration”extensions: graphql-analyzer: lint: rules: relayPageInfo: warn