# relay-page-info

Source: https://apigenie.pl/docs/linter/graphql/rules/relay-page-info

This rule checks that a schema with connections has a `PageInfo` type as the Relay Cursor Connections specification defines it.

## Rule Details

`PageInfo` is an object type with the fields `hasNextPage: Boolean!`, `hasPreviousPage: Boolean!`, and the nullable `startCursor` and `endCursor` of type String or a scalar.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        relay-page-info: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable relay-page-info` comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.

## Examples

**Good**.

```graphql
type Query {
  users(first: Int, after: String, last: Int, before: String): UserConnection
}
interface Node { id: ID! }
type User implements Node { id: ID! }
type UserConnection { edges: [UserEdge], pageInfo: PageInfo! }
type UserEdge { node: User, cursor: String! }
type PageInfo {
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: String
  endCursor: String
}
```

**Bad**. The linter reports `PageInfo should have a field 'hasNextPage: Boolean!'`.

```graphql
type UserConnection { edges: [UserEdge], pageInfo: PageInfo! }
type PageInfo { hasNextPage: Boolean }
```
