-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation for duplicate lookups. #170
base: main
Are you sure you want to change the base?
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 <[email protected]>
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. |
Duplicate lookup fields creates ambiguity for the query planner