hotchoc's AddApolloFederation schema vs non-apollo subgraph
You might be wondering what is the difference if you use 'AddApolloFederation' besides resolving a bunch of ambiguous static extension in your code?
One of the biggest difference I noticed is schema generated - as you can see below. Although this is not a apple by apple comparison. there's extra schema definition here:-
As you can see here, we have "query: Query". This can only be one. If you have more than one, we will get into a schema definition error.
In graphql federation, you will see similar schema definition. Let's say you have a product and user subgraph, it would look something like below. You will notice we extended Query type using extend type Query. So really important to keep this construct or setup.
// product subgraph
extend type Query {
products: [Product]
}
// user subgraph
extend type Query {
user(id: ID!): User
}

Comments