GraphQL
Deploy, delete and list GraphQL APIs for Sanity projects
usage: sanity graphql [--default] [-v|--version] [-d|--debug] [-h|--help] <command> [<args>]
Commands:
deploy Deploy a GraphQL API from the current Sanity schema
list Lists all the GraphQL endpoints deployed for this project
undeploy Remove a deployed GraphQL API
See 'sanity help graphql <command>' for specific information on a subcommand.
usage: sanity graphql deploy
Deploy a GraphQL API from the current Sanity schema
Options
--dry-run Validate defined APIs, exiting with an error on breaking changes
--force Deploy API without confirming breaking changes
--api <api-id> Only deploy API with this ID. Can be specified multiple times.
The following options will override any setting from the CLI configuration file
(sanity.cli.js/sanity.cli.ts) - and applies to ALL defined APIs defined in that
configuration file. Tread with caution!
--tag Deploy API(s) to given tag (defaults to 'default')
--dataset <name> Deploy API for the given dataset
--generation <gen1|gen2|gen3> API generation to deploy (defaults to 'gen3')
--non-null-document-fields Use non-null document fields (_id, _type etc)
--playground Enable GraphQL playground for easier debugging
--no-playground Disable GraphQL playground
--with-union-cache *Experimental:* Enable union cache that optimizes schema generation for schemas with many self referencing types
Examples
# Deploy all defined GraphQL APIs
sanity graphql deploy
# Validate defined GraphQL APIs, check for breaking changes, skip deploy
sanity graphql deploy --dry-run
# Deploy only the GraphQL APIs with the IDs "staging" and "ios"
sanity graphql deploy --api staging --api ios
# Deploy all defined GraphQL APIs, overriding any playground setting
sanity graphql deploy --playground
usage: sanity graphql undeploy undefined
Remove a deployed GraphQL API
Options
--dataset <dataset> Delete GraphQL API for the given dataset
--tag <tag> Delete GraphQL API for the given tag (defaults to 'default')
Examples
sanity graphql undeploy
sanity graphql undeploy --dataset staging
sanity graphql undeploy --dataset staging --tag next