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
...
}
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?