While extending the following entity with a nullable field title:
type Product @key(fields:"id language") {
id: ID!
language: String!
title: String
}
with this one in another subgraph:
type Product @key(fields: "id language") @extends {
id: ID! @external
language: String! @external
title: String @external
url(region: String!): String @requires(fields: "title")
}
everything works just fine when querying products that have a non-empty title. However, when we query products that do have an empty title Apollo returns the following error:
"message": "Field \"title\" was not found in response."
in which case the resolver for the url query is never reached. What we like to achieve, however, is that in this case the resolver is actually called with an empty title field, so we can implement logic that deals with an empty title. The @requires annotation does not seem to fit our use case.
What is the correct way of extending this product entity in such a way that both null and non-null titles are passed on to the resolver that’s responsible for producing the result of the url query?