Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a8a35ae
Attempted fix for integration test failing on CI (#2024)
AnthonyMDev Nov 9, 2021
ece5b5b
fix(deps): update dependency gatsby-theme-apollo-docs to v5.3.6 (#2026)
renovate[bot] Nov 10, 2021
55c5db8
Update apollo-tooling to v2.33.9 (#2028)
calvincestari Nov 12, 2021
8d48031
Gateway clarification based on license change
hwillson Nov 12, 2021
46957a3
Update SQLite.swift to version 13.0 (#2015)
Iron-Ham Nov 17, 2021
d93568f
Release `0.50.0` (#2031)
calvincestari Nov 17, 2021
3262cd0
fix(deps): update dependency gatsby-theme-apollo-docs to v5.3.8 (#2038)
renovate[bot] Nov 18, 2021
f1707b4
Update caching.mdx (#2042)
bogdanbeczkowski Nov 24, 2021
c3687d2
Update ROADMAP.md (#2053)
calvincestari Dec 7, 2021
f192578
Clean up Github API for performance tests
AnthonyMDev Dec 13, 2021
c3969d1
fix(deps): update dependency gatsby-theme-apollo-docs to v5.3.9 (#2062)
renovate[bot] Dec 13, 2021
dbd7b87
Make filesystem diagram a bit easier to understand (#2063)
designatednerd Dec 14, 2021
67d86ae
Allow periods in arguments to be ignored when parsing cacheKeys (#2057)
Iron-Ham Dec 15, 2021
5079b14
fix(deps): update dependency gatsby-theme-apollo-docs to v5.3.11 (#2068)
renovate[bot] Dec 16, 2021
4d8b5bb
fix(deps): update dependency gatsby-theme-apollo-docs to v5.3.12 (#2074)
renovate[bot] Dec 17, 2021
95ee510
Add tutorial on subscriptions to match Android (#2072)
designatednerd Dec 20, 2021
0358975
Bump mermaid from 8.13.6 to 8.13.8 in /docs (#2083)
dependabot[bot] Jan 6, 2022
d46bd37
chore(deps): update dependency engine.io to 4.1.2 [security] (#2094)
renovate[bot] Jan 13, 2022
60ecd70
chore(deps): update dependency follow-redirects to 1.14.7 [security] …
renovate[bot] Jan 13, 2022
d44820d
chore(deps): update dependency node-forge to 1.0.0 [security] (#2095)
renovate[bot] Jan 13, 2022
fbeee46
Add note about acceptable extensions for types of schema file. (#2059)
designatednerd Jan 19, 2022
a4e7b4f
Docs: Bump to Gatsby v3 (#2104)
jgarrow Jan 25, 2022
0c9aa54
fix(deps): pin dependency gatsby-theme-apollo-docs to 6.0.0 (#2113)
renovate[bot] Jan 26, 2022
161873b
fix(deps): pin dependency gatsby to 3.14.6 (#2123)
renovate[bot] Jan 29, 2022
63eacd1
Edits to intro and installation docs (#2125)
Feb 1, 2022
eb6cbe1
Fix tutorial URL and tweak downloading a schema article (#2133)
Feb 3, 2022
7538bef
Split advanced "Creating a client" content into separate article (#2143)
Feb 7, 2022
ca88016
Disable flaky integration test
AnthonyMDev Feb 8, 2022
f51e7c4
Update gatsby config to deploy 1.0 alpha docs
AnthonyMDev Feb 8, 2022
ec034e8
Update roadmap after 1.0.0-alpha.1 release (#2145)
calvincestari Feb 9, 2022
0beea3d
[v1.0.0 Alpha 1] JavascriptError @unchecked Sendable (#2147)
TizianoCoroneo Feb 11, 2022
bf4cb5a
Update documentation to clarify schema download format and filename (…
calvincestari Feb 14, 2022
3c58987
chore(deps): update dependency follow-redirects to 1.14.8 [security] …
renovate[bot] Feb 14, 2022
f409e81
Update license copyright notice
calvincestari Feb 15, 2022
cf713c1
Delete Jazzy config - not supported
calvincestari Feb 16, 2022
c188637
Update list of active maintainers
calvincestari Feb 16, 2022
2b607ec
[Fix #2170] Do not refetch query watcher from server after cache miss…
AnthonyMDev Feb 25, 2022
bf86e01
Add `graphql-ws` protocol support (#2168)
calvincestari Feb 25, 2022
8b6a50a
chore(deps): update dependency prismjs to 1.27.0 [security] (#2179)
renovate[bot] Feb 28, 2022
cb5f1ce
Release 0.51.0 (#2086)
calvincestari Feb 28, 2022
664c1f1
Enable lazy access to the request body creation for leverage in custo…
rickfast Mar 3, 2022
52bbeac
Release `0.51.1` (#2188)
calvincestari Mar 7, 2022
6aee64a
Updates for new docs infra (#2197)
trevorblades Mar 15, 2022
f916c5f
Remove files from old Gatsby docs theme (#2202)
jgarrow Mar 15, 2022
62f4554
Clear body on APQ retry in JSONRequest (#2206)
AnthonyMDev Mar 18, 2022
729fedb
Release 0.51.2 (#2207)
AnthonyMDev Mar 18, 2022
08a41ba
Fix changelog version.
AnthonyMDev Mar 18, 2022
fecf44b
Add netlify config for deploy previews (#2208)
trevorblades Mar 22, 2022
b25d1de
Add codegen option for excludes (#2205)
bannzai Mar 23, 2022
a5f6f5d
Fix typo (#2212)
changm4n Mar 23, 2022
b4f58e2
Start a docs production deploy when docs changes get merged (#2211)
trevorblades Mar 23, 2022
4772297
Bump minimist from 1.2.5 to 1.2.6 in /SimpleUploadServer (#2214)
dependabot[bot] Mar 23, 2022
79876e5
Bump node-fetch from 2.6.6 to 2.6.7 in /SimpleUploadServer (#2215)
dependabot[bot] Mar 23, 2022
a563c40
Add note to tutorial about the `graphql-ws` subscription library (#2219)
rkoron007 Mar 25, 2022
c8c3951
Update tutorial-obtain-schema.md (#2225)
Carrione Mar 29, 2022
26351b5
Update tutorial-execute-query.md (#2228)
Carrione Mar 29, 2022
ab160e4
chore: Update Xcode build tool versions on CircleCI (#2242)
calvincestari Apr 8, 2022
57f329d
chore: Update roadmap
calvincestari Apr 15, 2022
b9a6116
fix: Sandbox documentation links (#2254)
martinbonnin Apr 21, 2022
09003c7
ci: Update xcode image to fix Node version mismatch
calvincestari Apr 21, 2022
fc260c7
ci: Update Node version to match what is installed with Xcode 13.3.1 …
calvincestari Apr 21, 2022
90d2c34
chore: updates roadmap (#2258)
jpvajda Apr 27, 2022
51c686f
Update build phases example to propagate errors to Xcode (#2260)
adam-zethraeus May 3, 2022
eecef09
Add a comment about a new use of the X-APOLLO-OPERATION-NAME header (…
glasser May 5, 2022
c78e0b1
Set permissions for GitHub actions (#2248)
neilnaveen May 16, 2022
858c769
updates roadmap for june 2022 (#2295)
jpvajda Jun 6, 2022
51c81bd
Update CircleCI tool versions (#2304)
calvincestari Jun 8, 2022
402dd16
fix: `graphql_transport_ws` protocol should send 'complete' to end su…
calvincestari Jun 17, 2022
c0a8ce3
Replace print statement with CodegenLogger.log (#2348)
hiltonc Jun 29, 2022
d26751a
Fix buttons on docs root (#2369)
Jul 12, 2022
f214c8e
Expose GraphQLResultError Path String (#2361)
Jul 12, 2022
414cc63
Revert "Fix buttons on docs root (#2369)" (#2371)
trevorblades Jul 12, 2022
0c43e49
release: 0.52.0 (#2370)
calvincestari Jul 14, 2022
bfa089b
Fix typo (#2379)
mischa-hildebrand Jul 18, 2022
b2ed705
Fix incorrect parameter name (#2380)
mischa-hildebrand Jul 18, 2022
135acc4
chore: Update ROADMAP for Beta release cycle (#2393)
calvincestari Jul 25, 2022
928f9ea
Remove all instances of bitcode as not supported in Xcode 14 (#2398)
stareque-atlassian Jul 28, 2022
42646f7
Release 0.53.0 (#2406)
calvincestari Jul 29, 2022
5f31e2a
fix: checkout at tag with legacy optionals behavior (#2412)
calvincestari Aug 2, 2022
323ed07
Update version in Swift Scripting docs (#2416)
redryerye Aug 3, 2022
ddc8953
Re-added support for iOS 11
adamayoung Aug 18, 2022
7482d49
Update to 0.53.0
adamayoung Aug 18, 2022
09895bf
Update dependencies
adamayoung Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tutorial URL and tweak downloading a schema article (apollographq…
  • Loading branch information
Stephen Barlow authored Feb 3, 2022
commit eb6cbe12efb22e2b0077ac37d7cc4ae8b6adf774
12 changes: 6 additions & 6 deletions docs/source/downloading-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
title: Downloading a schema
---

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.
Apollo iOS requires a GraphQL schema file as input to its code generation process. You can provide your schema either as a JSON file (most commonly the result of an introspection query) or as a `.graphqls` file that uses GraphQL SDL syntax. Conventionally, this file is named `schema.json` or `schema.graphqls` (depending on its format), and you store it in the same folder as your project's `App`:

> 🚧 BETA ALERT 🚧 : Instead of writing the rest of this in Bash, try using our new [Swift Scripting Library](./swift-scripting), now in Beta! It supports downloading a schema and generating code.
<img class="screenshot" src="./screenshot/schema_location.jpg" alt="Location of schema file in project" width="250" />

You can use the [Apollo CLI](https://www.apollographql.com/docs/devtools/cli/) to download a GraphQL schema by sending an introspection query to the server.
> 📣 **Check it out:** Instead of writing the scripts below in Bash, try using our new [Swift Scripting Library](./swift-scripting), now in Beta! It supports downloading a schema and generating code.

If you've installed the CLI globally, you can use the following command to download your schema:
You can use the [Apollo CLI](https://www.apollographql.com/docs/devtools/cli/) to download a GraphQL schema by sending an introspection query to the server. If you've installed the CLI globally, you can use the following command to download your schema:

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

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 [Add a code generation build step](/installation/#5-add-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:
Note that if you're using the local version set up for codegen, you should use the same method you're using in the [Add a code generation build step](/installation/#5-add-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:

```sh
```bash
SCRIPT_PATH="${PODS_ROOT}/Apollo/scripts"
cd "${SRCROOT}/${TARGET_NAME}"
"${SCRIPT_PATH}"/run-bundled-codegen.sh schema:download --endpoint=http://localhost:8080/graphql schema.json
Expand Down
146 changes: 74 additions & 72 deletions docs/source/initialization.md

Large diffs are not rendered by default.

Binary file added docs/source/screenshot/schema_location.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 21 additions & 21 deletions docs/source/tutorial/tutorial-execute-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@
title: "3. Execute your first query"
---

The most common GraphQL operation is the **query**, which requests data from your graph in a structure that conforms to your server's schema. If you return to [the Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com) for your server, you can see available queries in the Schema Reference tab you opened earlier.
The most common GraphQL operation is the **query**, which requests data from your graph in a structure that conforms to your server's schema. If you return to [the Sandbox](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fapollo-fullstack-tutorial.herokuapp.com/graphql) for your server, you can see available queries in the Schema Reference tab you opened earlier.

Scroll down to the `launches` query to get details about it:

<img src="images/launches_detail.png" class="screenshot" alt="Detail about launches query"/>

Here, you see both the query term itself, the return type, and information about parameters that can be passed to the query. You can use this information to write a query you'll eventually add to your app.
Here, you see both the query term itself, the return type, and information about parameters that can be passed to the query. You can use this information to write a query you'll eventually add to your app.

To start working with this query in the Sandbox Explorer, select the "play" button to the right side of the information:
To start working with this query in the Sandbox Explorer, select the "play" button to the right side of the information:

<img src="images/open_in_explorer_launches.png" class="screenshot" alt="Open in Explorer"/>

This brings you back into Sandbox's Explorer tab with the sidebar on the left showing documentation for the query you've selected:

<img src="images/explorer_sandbox_open.png" class="screenshot" alt="Docs open in the left sidebar"/>

Notice the small button next to the `launches` icon. Click this button to add the query to the middle "operations" panel:
Notice the small button next to the `launches` icon. Click this button to add the query to the middle "operations" panel:

<img src="images/explorer_add_launches_query.png" class="screenshot" alt="Click the button to add this query"/>

When the query is added, it will look like this:
When the query is added, it will look like this:

<img src="images/explorer_initial_added_query.png" class="screenshot" alt="The query once it's been added to the Operations section"/>

Let's break down what you're seeing here:
Let's break down what you're seeing here:

- The type of the operation, `query`, followed by the name of the operation, currently `Query` (we'll make that more specific in a second), is the outermost set of brackets.
- The actual query being called is the next set of brackets in. Since the `arguments` for this query both have default values, they are not automatically added to the query for you.
- An error in the empty space between the brackets, which is where you'll put the list of information you want back from each launch.
- An error in the empty space between the brackets, which is where you'll put the list of information you want back from each launch.

The Apollo iOS SDK requires every query to have a name (even though this isn't required by the GraphQL spec). Since you're going to be creating more than one query, it's also a good idea to give this operation a specific name other than `Query`. Change the name of the operation to `LaunchList`:
The Apollo iOS SDK requires every query to have a name (even though this isn't required by the GraphQL spec). Since you're going to be creating more than one query, it's also a good idea to give this operation a specific name other than `Query`. Change the name of the operation to `LaunchList`:

<img src="images/explorer_launch_list_rename.png" class="screenshot" alt="Renaming the query"/>

Next, on the left hand side, you can select what fields you want back in the returned object. Start by clicking the button next to the `cursor` field. It will mark that field as selected, then insert it into your operations:
Next, on the left hand side, you can select what fields you want back in the returned object. Start by clicking the button next to the `cursor` field. It will mark that field as selected, then insert it into your operations:

<img src="images/explorer_check_cursor.png" class="screenshot" alt="After adding the cursor field."/>

This is probably the easiest way to add fields to your object, since it knows how everything is spelled and what type everything is.
This is probably the easiest way to add fields to your object, since it knows how everything is spelled and what type everything is.

However, you can also use auto-complete to help you with this. Add a newline below `cursor` in the Operations panel and start typing `ha`. An autocomplete box pops up and shows you options based on what's in the schema:

Expand All @@ -50,21 +50,21 @@ The Sandbox Explorer is a great tool for building and verifying queries so you d

As the schema indicates, the `launches` query returns a `LaunchConnection` object. This object includes a list of launches, along with fields related to pagination (`cursor` and `hasMore`). The query you've written so far indicates exactly which fields of this `LaunchConnection` object you want to be returned.

Run this query by pressing the "Submit Operation" button, which should now have the name of your query, `LaunchList`:
Run this query by pressing the "Submit Operation" button, which should now have the name of your query, `LaunchList`:

<img src="images/explorer_submit_operation.png" class="screenshot" alt="Submit the operation"/>

You'll quickly see the query returns results as a JSON object on the right-hand side of the page:
You'll quickly see the query returns results as a JSON object on the right-hand side of the page:

<img src="images/explorer_launch_list_initial_response.png" class="screenshot" alt="Query JSON in Sandbox Explorer"/>

This query executes successfully, but it doesn't include any information about the `launches`! That's because we didn't include the necessary field in the query.

Click the button next to the `launches` field at the bottom of the left column. It will add a set of braces for `launches` to the operations section, and then move the documentation to show information for the `Launch` type:
Click the button next to the `launches` field at the bottom of the left column. It will add a set of braces for `launches` to the operations section, and then move the documentation to show information for the `Launch` type:

<img src="images/explorer_launches_drill_in.png" class="screenshot" alt="Status after adding launches field"/>

The fields you add in this set of brackets will be fetched for every launch in the list. Click the buttons next to `id` and `site` properties to add those two fields. When you're done, your operation should look like this:
The fields you add in this set of brackets will be fetched for every launch in the list. Click the buttons next to `id` and `site` properties to add those two fields. When you're done, your operation should look like this:

```graphql:title=(Sandbox%20Explorer)
query LaunchList {
Expand All @@ -75,11 +75,11 @@ query LaunchList {
id
site
}
}
}
}
```

Run the operation again, and you'll now see that in addition to the information you got back before, you're also getting a list of launches with their ID and site information:
Run the operation again, and you'll now see that in addition to the information you got back before, you're also getting a list of launches with their ID and site information:

<img src="images/completed_id_query.png" class="screenshot" alt="Updated query JSON in Sandbox Explorer"/>

Expand All @@ -93,7 +93,7 @@ Now that your query is fetching the right data, head back to Xcode.

2. Click **Next** and name the file `LaunchList.graphql`. Make sure it's saved at the same level as your `schema.json` file. As previously, don't add it to any target.

3. Copy your final operation from Sandbox Explorer by selecting the three dot (aka "meatball") menu to the right of your operation name and selecting "Copy Operation":
3. Copy your final operation from Sandbox Explorer by selecting the three dot (aka "meatball") menu to the right of your operation name and selecting "Copy Operation":

<img src="images/explorer_meatball_copy.png" class="screenshot" alt="Copy operation from Explorer Sandbox"/>

Expand All @@ -113,9 +113,9 @@ You're now ready to generate code from the combination of your saved query and s

### The `API.swift` file

Open the `API.swift` file. It defines a root class, `LaunchListQuery`, with many nested structs below it. If you compare the structs to the JSON data returned in Sandbox Explorer, you see that the structure matches. These structs include properties only for the fields that your query requests.
Open the `API.swift` file. It defines a root class, `LaunchListQuery`, with many nested structs below it. If you compare the structs to the JSON data returned in Sandbox Explorer, you see that the structure matches. These structs include properties only for the fields that your query requests.

Try commenting out the `id` property in `LaunchList.graphql` using a `#`, saving, then building again. When the build completes, the innermost `Launch` now only includes the built-in `__typename` and the requested `site` property.
Try commenting out the `id` property in `LaunchList.graphql` using a `#`, saving, then building again. When the build completes, the innermost `Launch` now only includes the built-in `__typename` and the requested `site` property.

Uncomment `id` in `LaunchList.graphql` and rebuild to restore the property.

Expand All @@ -127,7 +127,7 @@ To use the generated operations in `API.swift`, you first create an instance of

1. Create a new Swift file called `Network.swift` and copy the code from [Basic client creation](/initialization/#basic-client-creation) into it. Make sure to add `import Apollo` to the top of the file.

2. Update the URL string to be `https://apollo-fullstack-tutorial.herokuapp.com` instead of the `localhost` URL in the example.
2. Update the URL string to be `https://apollo-fullstack-tutorial.herokuapp.com/graphql` instead of the `localhost` URL in the example.

3. To make sure your `ApolloClient` instance is communicating correctly with the server, add the following code to `AppDelegate.swift` in the `application:didFinishLaunchingWithOptions` method, above `return true`:

Expand All @@ -142,7 +142,7 @@ To use the generated operations in `API.swift`, you first create an instance of
}
```

Build and run your application. The web host might take a few seconds to spin up your GraphQL server if nobody's been using it recently, but once it's up, you should see a response that resembles the following:
Build and run your application. The web host might take a few seconds to spin up your GraphQL server if nobody's been using it recently, but once it's up, you should see a response that resembles the following:

<img alt="Success log output" class="screenshot" src="images/success_log_barf.png"/>

Expand Down
Loading