-
Notifications
You must be signed in to change notification settings - Fork 1.2k
The ability to get query directives in ENF land #3048
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
Conversation
| }; | ||
|
|
||
| for (ExecutableNormalizedField topLevel : collectFromOperationResult.children) { | ||
| ImmutableList<FieldAndAstParent> mergedField = collectFromOperationResult.normalizedFieldToAstFields.get(topLevel); |
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.
renamed this list to a better name - because its not a mergedField
| ImmutableList<FieldAndAstParent> childFieldAndAstParents = nextLevel.normalizedFieldToAstFields.get(child); | ||
|
|
||
| MergedField mergedField = newMergedField(map(childFieldAndAstParents, fieldAndAstParent -> fieldAndAstParent.field)).build(); | ||
| captureMergedField.accept(child, mergedField); |
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.
the consumer cause the side effect of putting the ENF into map along with the QueryDirectives
This save having to pass in all the extra parameters needed
I think its a neat side effect trick
| normalizedFieldToQueryDirectives.put(enf, queryDirectives); | ||
| normalizedFieldToMergedField.put(enf, mergedFld); | ||
| }; | ||
|
|
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.
This conumer is the side effect to create QueryDirectives and also to capture enf -> mergedField
| collectInlineFragment(parameters, result, (InlineFragment) selection, possibleObjects, astTypeCondition); | ||
| } else if (selection instanceof FragmentSpread) { | ||
| collectFragmentSpread(parameters, result, (FragmentSpread) selection, possibleObjects, astTypeCondition); | ||
| collectFragmentSpread(parameters, result, (FragmentSpread) selection, possibleObjects); |
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.
never used
| List types = ((GraphQLUnionType) type).getTypes(); | ||
| return ImmutableSet.copyOf(types); | ||
| List<GraphQLNamedOutputType> unionTypes = ((GraphQLUnionType) type).getTypes(); | ||
| return ImmutableSet.copyOf(ImmutableKit.map(unionTypes, GraphQLObjectType.class::cast)); |
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.
fix up to remove warnings around List without generics
| CoercedVariables coercedVariableValues, | ||
| @Nullable Map<String, NormalizedInputValue> normalizedVariableValues) { | ||
| @Nullable Map<String, NormalizedInputValue> normalizedVariableValues, | ||
| GraphQLContext graphQLContext, Locale locale) { |
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.
Nit: can you push Locale locale to the next line?
This gives us the ability to get to query directives from ENFs