Exercise 3: A listing's activities (⏳ 5 min)
Uncomment the following lines from the listings.graphql schema:
type Listing {# ...other Listing fields# EXERCISE: LISTING ACTIVITIES"The activities available for this listing"activities: [Activity!]!}# EXERCISE: LISTING ACTIVITIEStype Activity {id: ID!name: String!description: Stringterrain: StringgroupSize: Int}
Save your changes. rover dev will now give you an error:
error[E029]: Encountered 6 build errors while trying to build a supergraph.Caused by:CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Listing.activities`. It must have a `@connect` directive or appear in `@connect(selection:)`.CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.id`. It must have a `@connect` directive or appear in `@connect(selection:)`.CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.name`. It must have a `@connect` directive or appear in `@connect(selection:)`.CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.description`. It must have a `@connect` directive or appear in `@connect(selection:)`.CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.terrain`. It must have a `@connect` directive or appear in `@connect(selection:)`.CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.groupSize`. It must have a `@connect` directive or appear in `@connect(selection:)`.
Exercise #3 Goal
🎯 Retrieve data for the Listing.activities field.
Use this REST API endpoint:
https://activities-rest-api-0d717e1922e0.herokuapp.com/location/:id/activities
After successfully completing the exercise, you should get data back when running the GetListingActivities operation below:
query GetListingActivities($listingId: ID!) {listing(id: $listingId) {idtitleactivities {idnamedescriptionterraingroupSize}}}
For the Variables section:
{"listingId": "listing-1"}
Check your work
Answer the following questions after you've completed the exercise. Lost? Check out the hints and solution below.
listing-1, which of the following statements about the listing's activities are true?GetListingActivities operation make?Detour: Using Apollo Skills
Apollo Skills give your AI coding assistant the context it needs to build effectively with Apollo.
Skills activate automatically once installed. Your AI agent uses them when relevant tasks are detected. For example, it may help you write GraphQL operations, refactor the client code, or determine the correct YAML configuration. Skills are especially useful when you want guidance that follows Apollo conventions while still adapting to the code in your app.
If you have access to Claude or any other AI agent that supports Skills, you can try completing this exercise using that approach instead of manually.
Install Apollo Skills for Connectors and GraphQL schemas:
npx skills add https://github.com/apollographql/skills --skill apollo-connectors --agent claude-codenpx skills add https://github.com/apollographql/skills --skill graphql-schema --agent claude-codeSelect the project scope as
ProjectorGlobalaccording to your preference.Proceed with the installation.
Start a new Claude Code session and give it the following prompt:
Use the apollo-connectors skill to update the listings.graphql schema.Use this REST API endpoint to retrieve activities data using a listing id: https://activities-rest-api-0d717e1922e0.herokuapp.com/location/:id/activitiesSuccess criteria: running the query below with listingId: "listing-1" returns that listing's activities.
query GetListingActivities($listingId: ID!) {listing(id: $listingId) {idtitleactivities {idnamedescriptionterraingroupSize}}}
💭 Hints (for manual completion)
✅ Solution
extend schema# ...other schema extensions@source(name: "activities"http: { baseURL: "https://activities-rest-api-0d717e1922e0.herokuapp.com" })type Listing {# ...other Listing fields"The activities available for this listing"activities: [Activity!]!@connect(source: "activities"http: { GET: "/location/{$this.id}/activities" }selection: """idnamedescriptionterraingroupSize""")}# EXERCISE: LISTING ACTIVITIEStype Activity {id: ID!name: String!description: Stringterrain: StringgroupSize: Int}