- checkout repository
- run
yarn
ornpm i
- run
node index.js
- browse to
localhost:8484/api/graphql
to open playground
{
book {
id
title
author {
id
name
books {
id
title
author {
id
name
books {
id
title
author {
name
}
}
}
}
}
}
}
{
author {
id
name
books {
id
title
author {
id
name
books {
title
author {
name
}
}
}
}
}
}
https://github.com/apollographql/graphql-tools/blob/master/src/stitching/mergeSchemas.ts#L446
Because of the delegated resolver, the query for author
does not return author.books
, which are needed to resolve the book objects.
- Ugly: Add
bookIds
to theAuthor
type, but then we need to explicitly selectbookIds
in the query. We could inject transforms to the delegating resolver somehow to always fetchbookIds
, but that just makes a simple task like this even more hideous.