Rover client commands

Validate client operations against your GraphQL schema


client check

This command requires authenticating Rover with GraphOS.

Use rover client check to validate that every GraphQL operation in your client project is compatible with your graph's published schema in GraphOS.

Bash
1rover client check my-graph@my-variant --include "src/**/*.graphql"

The argument my-graph@my-variant is a graph ref that identifies the GraphOS graph and variant to validate against. If you omit the variant, Rover uses the default variant named current.

File discovery

Rover scans for .graphql files using the glob patterns you provide. Specify multiple --include patterns and optionally exclude paths with --exclude.

Bash
1rover client check my-graph@staging \
2  --include "src/**/*.graphql" \
3  --exclude "src/__generated__/**"

By default, Rover scans from the current working directory. Use --root-dir to scan from a different location:

Bash
1rover client check my-graph@staging \
2  --root-dir /path/to/client \
3  --include "**/*.graphql"

Operation requirements

All operations must have names. Anonymous operations (for example, { user { name } }) are rejected with an error. Give every operation an explicit name:

GraphQL
1# Invalid — will error
2{ user { name } }
3
4# Valid
5query GetUser {
6  user { name }
7}

Fragment deduplication and conflicts

Fragments defined identically across multiple files are deduplicated automatically. However, if two files define a fragment with the same name but different bodies, rover client check returns an error listing the conflicting fragment names. Resolve conflicts by ensuring each fragment name is unique or that all files use an identical definition.

Options

OptionDescription
[GRAPH_REF]Graph ref (graph@variant) to validate against (positional argument).
--include <PATTERN>Glob pattern for .graphql files to include. Repeatable.
--exclude <PATTERN>Glob pattern for files to exclude. Repeatable.
--root-dir <DIR>Root directory to scan from. Defaults to the current working directory.
--profile <PROFILE>Configuration profile to use for authentication.
--format <FORMAT>Output format: plain (default) or json.
--output <FILE>Write output to a file instead of stdout.

Output

For each operation, rover client check reports whether it passed validation and, for failures, the specific error code and description. The first line shows the total operations and files scanned, followed by one entry per result:

Text
1Validated 10 operations (5 files scanned)
2GetUser: src/queries/user.graphql:4:1
3  FAILURE Field "legacyId" was removed from type "User".

The command exits with code 1 if any operation fails validation, making it straightforward to fail a CI pipeline.

Continuous integration

Use rover client check in CI pipelines to check operations against the variant that matches your deployment environment:

YAML
config.yml
1# Example: GitHub Actions
2- name: Validate client operations
3  run: |
4    rover client check my-graph@production \
5      --include "src/**/*.graphql"
6  env:
7    APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
Feedback

Edit on GitHub

Ask Community