-
Notifications
You must be signed in to change notification settings - Fork 1.1k
WIP - Ability to get parsed directive argument values inside a DataFetcher #1229
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 |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
|
|
||
| /** | ||
|
|
@@ -55,6 +56,12 @@ public interface DataFetchingEnvironment { | |
| */ | ||
| <T> T getArgument(String name); | ||
|
|
||
| Map<String, Map<String, Object>> getDirectiveArguments(); | ||
|
Member
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. JavaDoc please |
||
|
|
||
| Map<String, Object> getDirectiveArguments(String directiveName); | ||
|
|
||
| <T> Optional<T> getDirectiveArgument(String directiveName, String argumentName); | ||
|
Member
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. As much as Optional is a better pattern, its mixing styles on this class. We already use null via getArgument() (because it predates Java 8) so I think we should stay consistent to the other methods in this interface
Contributor
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. The difference between this and |
||
|
|
||
| /** | ||
| * Returns a context argument that is set up when the {@link graphql.GraphQL#execute} method | ||
| * is invoked. | ||
|
|
||
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.
Can we make put this into a DirectivesUtil helper class so its simpler to read and easier to test
See
graphql.DirectivesUtilThere 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.
Do you think it would maybe be better to create a new type to represent this or are you ok with
Map<String, Map<String, Object>>?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.
I think this should be a Map<String,graphql.schema.GraphQLDirective>
That is a field has a map of named
graphql.schema.GraphQLDirectiveobjects. From that you can get the arguments and the values to this arguments.We have other code somewhere (off hand) that helps create that