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
Pass rootValue from execution context to resolveType #103
Comments
This happens today, though the variable naming is probably confusing. We're using the terms |
leebyron
added a commit
that referenced
this issue
Aug 11, 2015
This solves the issue raised in #103 by providing a second argument with this information. There is also some minor renaming happening in this diff to match previous diffs.
These last two diffs should add the functionality you're looking for! |
They will be released on npm in the near future. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be quite useful to get the
rootValue
inresolveType
the same way you get it in field resolvers.In my case I need to dynamically chose which fetching backend implementation to use and I'm passing it in in the rootValue. The backend also does list filtering by various predicates, one of which is the item type - the backend therefore needs to be able to resolve the item type the same way the interface does.
The natural place for this logic is the backend itself (all backend-specific things sit in one place), but since I only know the right implementation at query run time the type detection logic is now duplicated.
I can imagine other use-cases for the
rootValue
in resolveType - e.g. using an authorisation system to resolve to basic or extended type (guess that is kinda contrived) or some sort of user-specified type resolution rules maybe.The text was updated successfully, but these errors were encountered: