Odyssey Voyage II - Listings subgraph

Hi, tried to move Listings to a separate subgraph, but got stuck on Expected Iterable, but did not find one for field while using find error for Bookings and Reviews

Listings schema

type Listing @key(fields: "id") {
 ...
  "The list of bookings for a listing"
  bookings: [Booking]!
  "The submitted reviews for this listing"
  reviews: [Review]!
 ...
}

type Review @key(fields: "id") {
  id: ID!
}

Listings resolvers

const resolvers = {
  ...
  Listing: {
    reviews: ({ id }) => {
      return { id };
    }, 
   // same for bookings
  ...
}

Reviews resolvers

  Listing: {
    __resolveReference: (listing) => {
      return listing;
    },
    reviews: ({ id }, _, { dataSources }) => {
      return dataSources.reviewsDb.getReviewsForListing(id);
    },

what am i doing wrong here? It doesn’t trigger Review’s subgraph, all graphs are up to date.

Also tried to launch final/subgraph-listings as stated in readme, but it doesn’t exist :frowning:

Hi @junge! Really exciting that you’re continuing to federate the Airlock graph!

Apologies for the confusion in the README, we originally had the course keep going with steps to extract the listings subgraph but ultimately removed it for length. These steps will eventually be covered in a separate lab. However, you can dig through the history of the repo to find how we approached this, if you’re interested! Here are the relevant commits, you’ll want to read through the ones marked lesson 12.X.

That said, there are multiple ways to go about this so I don’t have an exact answer for what you’re doing “wrong”.

For what we covered in a previous version of the course, we chose not to include the reviews field for a Listing in the listings subgraph. That’s because this field should be the responsibility of the reviews subgraph! So we kept it in the monolith subgraph until it was time to extract out the reviews subgraph.

So have you created the reviews subgraph? What are all the subgraphs you have so far? What query are you testing?

I really enjoyed your courses, so tried to finish “practice” part, before i can start Voyage III

So have you created the reviews subgraph?

yeap, still have few references to resolve like the one mentioned in this ticket

What are all the subgraphs you have so far?

4 except listings, their types are still in “monolith” subgraph

What query are you testing?

LISTING from listing page

export const LISTING = gql`
  query GetListing($id: ID!) {
    listing(id: $id) {
      id
      title
      description
      photoThumbnail
      numOfBeds
      costPerNight
      locationType
      amenities {
        name
        category
      }
      overallRating
      reviews {
        text
        author {
          id
          name
          profilePicture
        }
        rating
      }
      host {
        id
        name
        profilePicture
        profileDescription
        overallRating
      }
      bookings {
        checkInDate
        checkOutDate
      }
    }
  }
`;

I guess at this point better to move Reviews in a separate query and rename GetListing into GetListingAndListingReviews