The ability to get query directives in ENF land#3048
Merged
Conversation
bbakerman
commented
Dec 7, 2022
| }; | ||
|
|
||
| for (ExecutableNormalizedField topLevel : collectFromOperationResult.children) { | ||
| ImmutableList<FieldAndAstParent> mergedField = collectFromOperationResult.normalizedFieldToAstFields.get(topLevel); |
Member
Author
There was a problem hiding this comment.
renamed this list to a better name - because its not a mergedField
bbakerman
commented
Dec 7, 2022
| ImmutableList<FieldAndAstParent> childFieldAndAstParents = nextLevel.normalizedFieldToAstFields.get(child); | ||
|
|
||
| MergedField mergedField = newMergedField(map(childFieldAndAstParents, fieldAndAstParent -> fieldAndAstParent.field)).build(); | ||
| captureMergedField.accept(child, mergedField); |
Member
Author
There was a problem hiding this comment.
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
bbakerman
commented
Dec 8, 2022
| normalizedFieldToQueryDirectives.put(enf, queryDirectives); | ||
| normalizedFieldToMergedField.put(enf, mergedFld); | ||
| }; | ||
|
|
Member
Author
There was a problem hiding this comment.
This conumer is the side effect to create QueryDirectives and also to capture enf -> mergedField
bbakerman
commented
Dec 8, 2022
| 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); |
bbakerman
commented
Dec 8, 2022
| List types = ((GraphQLUnionType) type).getTypes(); | ||
| return ImmutableSet.copyOf(types); | ||
| List<GraphQLNamedOutputType> unionTypes = ((GraphQLUnionType) type).getTypes(); | ||
| return ImmutableSet.copyOf(ImmutableKit.map(unionTypes, GraphQLObjectType.class::cast)); |
Member
Author
There was a problem hiding this comment.
fix up to remove warnings around List without generics
dondonz
reviewed
Feb 6, 2023
| CoercedVariables coercedVariableValues, | ||
| @Nullable Map<String, NormalizedInputValue> normalizedVariableValues) { | ||
| @Nullable Map<String, NormalizedInputValue> normalizedVariableValues, | ||
| GraphQLContext graphQLContext, Locale locale) { |
Member
There was a problem hiding this comment.
Nit: can you push Locale locale to the next line?
dondonz
approved these changes
Feb 6, 2023
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.
This gives us the ability to get to query directives from ENFs