I am currently using custom directives to handle authorization across mutations and queries for my subgraphs. However, I realised that when I wrap my schema in the custom directive function, the __resolveReference
function for a particular entity is not being called. But when I pass the schema returned from buildSubgraphSchema
function directly to the Apollo server constructor, everything works fine. Any idea what I could be doing wrong.?
Schema returned from buildSubgraph
let schema = buildSubgraphSchema({typedefs, resolvers})
const server = new ApolloServer({schema}) // works fine
Schema returned from directive
let schema = buildSubgraphSchema({typedefs, resolvers})
schema = authDirectiveTransformer(schema)
const server = new ApolloServer({schema}) // __resolveReference is not been called on entities.