Problem with federation #1376
-
Describe the Bug To Reproduce Expected Behavior Environment (please complete the following information):
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I find out the problem is actually present also in your query Me {
me {
reviews {
product {
name
}
}
}
} This shows the federation is actually not working. @MichalLytek can we move this to issues instead of a discussion? |
Beta Was this translation helpful? Give feedback.
-
The error is present with the example query as well: https://github.com/MichalLytek/type-graphql/blob/new-major-release/examples/apollo-federation/examples.graphql |
Beta Was this translation helpful? Give feedback.
-
@ramiel The problem is that with old apollo federation and import deepMerge from "lodash.merge";
const federatedSchema = buildSubgraphSchema({
typeDefs: gql(printSchemaWithDirectives(schema)),
resolvers: deepMerge(createResolversMap(schema) as any, referenceResolvers),
}); I will update the example with this, thanks for noticing the issue. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply. I'm going to try this. Understanding all the differences between federation v1 and v2 is a pain 😄 |
Beta Was this translation helpful? Give feedback.
@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 withbuildSubgraphSchema
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: