Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free
You're viewing documentation for a previous version of this software. Switch to the latest stable version.

2. Add the GraphQL schema


This tutorial uses a modified version of the you build as part of the Apollo full-stack tutorial. You can visit https://apollo-fullstack-tutorial.herokuapp.com/ to start it up and open the Playground tool to explore its schema.

The GraphQL Playground query explorer

The schema defines which GraphQL your server can execute. Click Docs on the right-hand side to view a list of types you can (and the types of on those types) along with any possible or .

GraphQL Playground showing the schema

Download your server's schema

Apollo Android requires a schema to generate typesafe models and code from your queries. There are multiple ways to get a schema. For an example, you can download a json schema directly from GraphQL Playground by clicking Schema > Download in the right pane.

In this tutorial, we will use the apolloDownloadSchema task that is created by the plugin automatically. Since GraphQL supports introspection, this will work with any GraphQL endpoint that has enabled.

From the root of the project, run the following:

mkdir -p app/src/main/graphql/com/example/rocketreserver/
./gradlew :app:downloadApolloSchema --endpoint='https://apollo-fullstack-tutorial.herokuapp.com/' --schema='app/src/main/graphql/com/example/rocketreserver/schema.json'

This will download a schema.json file from your endpoint to app/src/main/graphql/com/example/rocketserver/schema.json.

Next, write your first query that uses this schema.

Previous
1. Configure your project
Next
3. Write your first query
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company