With a federated GraphQL model using Apollo, the docs state that "A reference resolver is responsible for returning all of the entity fields that this subgraph defines". But is it possible to have fields in a subgraph not returned from the __resolveReference
function, which have their own separate resolvers?
For example, let's say this is the schema (in two subgraphs):
// Products subgraph
type Product @key(fields: "id") {
id: ID!
name: String!
price: Int
}
// Inventory subgraph
type Product @key(fields: "id") {
id: ID!
inStock: Boolean!
otherField: String!
}
Can you then have this in your resolvers in the inventory subgraph?
// Inventory subgraph
const resolvers = {
Product: {
__resolveReference({ id }) {
return { id, inStock: false };
},
otherField: () => 'Hello World!',
},
}