Add validation for duplicate lookups.#170
Conversation
Duplicate lookup fields creates ambiguity for the query planner
✅ Deploy Preview for composite-schemas ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Co-authored-by: Glen <glen.84@gmail.com>
|
I think in order to allow for migration in a non breaking way we should allow deprecated fields. So it should be two or more non-deprecated lookup fields cause an error. |
That's a good idea. So the query planner would always choose the non-deprecated one, making it still unambiguous. |
we could discard of the deprecated lookup in the composition so that the gateway does not need to choose. |
But that would break existing clients that depend on the deprecated lookup field. So I don't think we want to remove them completely, just enforce that there's always exactly one non-deprecated lookup for composition and query planning to take advantage of. |
On further reflection, I believe migration could also be handled in a non-breaking way without allowing multiple @lookups. before: after: The subgraph would just move @lookup to the new field while leaving the old field present in the schema but without @lookup directive. Perhaps for simplicity we can indeed restrict to a single @lookup without hindering migration. |
| } | ||
| ``` | ||
|
|
||
| For a given source schema, there must be exactly one non-deprecated lookup field |
There was a problem hiding this comment.
We need to move this to the validation section.
Duplicate lookup fields creates ambiguity for the query planner