Allow an optional function to resolve the rootValue#1555
Merged
Conversation
evans
reviewed
Aug 20, 2018
evans
left a comment
Contributor
There was a problem hiding this comment.
@tgriesser Thanks for adding this support! Let's get some documentation for it in the API reference and then we can merge it
Contributor
Author
|
Great! Rebased & added API reference docs - let me know if you want me to add anything else. |
Contributor
Author
|
Not sure why the netlify check didn't pass |
Passes the parsed DocumentNode AST to determine the root value, useful when providing a different rootValue for query vs mutation
88facd6 to
47698b0
Compare
Contributor
Author
|
@evans bump |
Contributor
|
@tgriesser Thank you! |
abernix
pushed a commit
that referenced
this pull request
Sep 27, 2018
* Allow an optional function to resolve the rootValue Passes the parsed DocumentNode AST to determine the root value, useful when providing a different rootValue for query vs mutation * Add API docs for rootValue
|
It would be nice if we could pass the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows providing a function to the
rootValueoption, which is called with the parsed query ASTDocumentNodeand the return value determines the value of the root.This is useful in situations where you want to provide a different
rootValuedepending on the operation type, for instance if therootValueshould be different for aqueryvs amutationIt also includes the commit from the type fixes in #1554
TODO: