Skip to content

Commit 8e84484

Browse files
Merge pull request #776 from apollographql/update/docs
Schema Download Instructions Clarification
2 parents 545e533 + 5a538c7 commit 8e84484

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

docs/source/downloading-schema.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ title: Downloading a schema
44

55
Apollo iOS requires a GraphQL schema file as input to the code generation process. A schema file is a JSON file that contains the results of an introspection query. Conventionally this file is called `schema.json`, and you store it next to the `.graphql` files in your target.
66

7-
You can use `apollo` from the [apollo-cli](https://github.com/apollographql/apollo-cli) package to download a GraphQL schema by sending an introspection query to the server:
7+
You can use `apollo` from the [apollo-cli](https://github.com/apollographql/apollo-cli) package to download a GraphQL schema by sending an introspection query to the server.
8+
9+
If you've installed the CLI globally, you can use the following command to download your schema:
810

911
```sh
1012
apollo schema:download --endpoint=http://localhost:8080/graphql schema.json
1113
```
1214

15+
Note that if you're using the local version set up for codegen, you'll want to use the same method you're using in the [Adding A Code Generation Build Step](installation#adding-a-code-generation-build-step) instructions to access that specific CLI. For example, if you're using CocoaPods, you can set it up like this to download your schema:
16+
17+
```sh
18+
SCRIPT_PATH="${PODS_ROOT}/Apollo/scripts"
19+
cd "${SRCROOT}/${TARGET_NAME}"
20+
"${SCRIPT_PATH}"/check-and-run-apollo-cli.sh schema:download --endpoint=http://localhost:8080/graphql schema.json
21+
```
22+
1323
If needed, you can use the `header` option to add additional HTTP headers to the request. For example, to include an authentication token, use `--header "Authorization: Bearer <token>"`:
1424

1525
```sh
16-
apollo schema:download --endpoint=http://localhost:8080/graphql --header="Authorization: Bearer <token>"
26+
[your apollo version] schema:download --endpoint=http://localhost:8080/graphql --header="Authorization: Bearer <token>"
1727
```

0 commit comments

Comments
 (0)