Repository navigation
Conversation
This reverts commit 38dfab1
…ropertyDataFetcher
andimarek
approved these changes
Aug 20, 2018
| launchDate(dateFormat : String = "dd, MMM, yyyy') : String | ||
| } | ||
|
|
||
| The ``Query.products`` field ihas a data fetcher, as does each field in the type ``Product``. |
| Every data fetcher is passed a ``graphql.schema.DataFetchingEnvironment`` object which allows it to know more about what is being fetched | ||
| and what arguments have been provided. Here are some of the more interesting parts of ``DataFetchingEnvironment``. | ||
|
|
||
| * ``<T> T getSource()`` - the ``source`` object is used to get information for a field. In the simple case its the in memory |
Member
There was a problem hiding this comment.
source has always been a bit confusing name imho: I often try to describe it as the result of the parent field DF. Not sure this makes it clear, but it is technically correct.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See #1166
This adds the ability for a getter method to receive the DataFetchingEnvironment as a parameter if it declares it.
It is preferred over a simple getter when 2 are declared
This allows for less boiler plate in your graphql wiring. There is no need to wire in a specific data fetcher for a field because a getter on the source object can take the DataFetchingEnvironment to make specific choices instead.