-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adds support for identifying trivial data fetchers and ignoring trivial fields in tracing #1300
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,8 +25,19 @@ public interface DataFetcher<T> { | |
| * @return a value of type T. May be wrapped in a {@link graphql.execution.DataFetcherResult} | ||
| * | ||
| * @throws Exception to relieve the implementations from having to wrap checked exceptions. Any exception thrown | ||
| * from a {@code DataFetcher} will eventually be handled by the registered {@link graphql.execution.DataFetcherExceptionHandler} | ||
| * and the related field will have a value of {@code null} in the result. | ||
| * from a {@code DataFetcher} will eventually be handled by the registered {@link graphql.execution.DataFetcherExceptionHandler} | ||
| * and the related field will have a value of {@code null} in the result. | ||
| */ | ||
| T get(DataFetchingEnvironment environment) throws Exception; | ||
|
|
||
|
|
||
| /** | ||
| * If a data fetcher is simply mapping data from an object to a field, it can be considered a trivial data fetcher for the purposes | ||
| * of tracing and so on. | ||
| * | ||
| * @return true if the data fetcher can be considered a trivial data fetcher. | ||
| */ | ||
| default boolean isTrivialDataFetcher() { | ||
| return false; | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be a default method or a marker interface that some one implements? I like this because subclassing is easier
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Decided to keep current behavior for completeness and allow people to opt into less information if they choose. So default is that trivial fields ARE included by default |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the default be? include ALL fields by default or exclude trivial fields byy default?