Skip to content

Problem with federation #1376

Answered by MichalLytek
ramiel asked this question in Q&A
Discussion options

You must be logged in to vote

@ramiel __resolveReference is not a part for TypeGraphQL. It's defined by user and it's his own responsibility to build the apollo schema.

The problem is that with old apollo federation and buildApolloFederationSchema, we could add reference resolvers after building the schema, and it was working well. Now with buildSubgraphSchema it expects reference resolvers to be already provided with the schema.
So we have to merge TypeGraphQL resolvers with reference resolvers somehow. My approach is like this:

import deepMerge from "lodash.merge";

const federatedSchema = buildSubgraphSchema({
  typeDefs: gql(printSchemaWithDirectives(schema)),
  resolvers: deepMerge(createResolversMap(schema) as any,

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ramiel
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1376 on October 29, 2022 18:44.