Docs
Launch GraphOS Studio

Validating client operations

Confirm that all client operations are supported by your schema


You can confirm that all of the defined in your client application are valid against the types, , and in your graph's published schema. To do so, you use the apollo client:check command of the Apollo CLI:

$ apollo client:check
✔ Loading Apollo Project
✔ Checking client compatibility with service
GetTeamGrid: src/components/TeamGrid.jsx:4
FAILURE Field "league" must not have a selection since type "SportsLeague" has no subfields.
4 total operations validated
1 failure

You run this command from your client application's root. It recursively scans your project for the following:

By combining your registered 's schema with your client-side schema , the apollo client:check command can confirm whether the shape of each defined conforms to the shape of your combined schema.

Make sure that your project provides a graph API key to the Apollo CLI. This both authenticates the CLI with Studio and specifies which 's schema you're checking against.

Checking against a particular variant

During development, your application might be executing against a locally running server with a schema that differs somewhat from your production server's schema. Because schemas can differ, it's important to always check your against the current schema for a particular environment before you push client changes to that environment.

If you represent each of your server's environments with a separate graph variant (recommended), you can check your against a particular 's schema like so:

$ apollo client:check --variant=production

Using with continuous integration

Your application can incorporate client:check into its continuous delivery pipeline to help ensure that new and modified are valid before they go live.

Here's a Circle CI configuration excerpt that incorporates the command:

config.yml
version: 2
jobs:
# ...other jobs...
# Define a separate job for each environment you validate against.
check_against_staging:
docker:
- image: circleci/node:12
steps:
- checkout
- run: npm install
# CircleCI needs global installs to be sudo
- run: sudo npm install --global apollo
# This command authenticates using the `APOLLO_KEY` environment variable.
# Don't forget to provide your API key in it.
- run: npx apollo client:check --variant=staging
Previous
Installation
Next
Moving to Rover
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company