Is there a way to use interface resolver inheritance with Apollo Federation?
I've found inheritResolversFromInterfaces: true
which is an option for makeExecutableSchema
. I couldn't find a way though to apply this option to a federated schema.
Asked
Active
Viewed 204 times
2

Lior Elrom
- 19,660
- 16
- 80
- 92

Daniel Hariri
- 1,081
- 8
- 10
1 Answers
2
You can use addResolveFunctionsToSchema
from graphql-tools
(or addResolversToSchema
from @graphql-tools/schema but I’m not sure if it works with this version) like this:
const federatedSchema = buildSubgraphSchema(typeDefs);
const schema = addResolveFunctionsToSchema({
inheritResolversFromInterfaces: true,
resolvers,
schema: federatedSchema,
});

Nicoowr
- 770
- 1
- 10
- 29