Repository navigation
Avoid printing inline fragment if there is no conditional type - #2621
Merged
andimarek merged 3 commits intoNov 30, 2021
Merged
Conversation
gnawf
commented
Nov 29, 2021
| ) { | ||
| List<Selection<?>> selections = selectionsForNormalizedFields(topLevelFields); | ||
| public static Document compileToDocument(GraphQLSchema schema, | ||
| OperationDefinition.Operation operationKind, |
Contributor
Author
There was a problem hiding this comment.
Ok now that we have the schema again, we can avoid explicitly specifying the operationKind and derive it from the ENF and GraphQLSchema but as I said in the PR desc, my IDE is broken, and that approach required some refactoring which I wasn't prepared to do without the IDE. What a massive pain…
|
|
||
| for (ExecutableNormalizedField nf : executableNormalizedFields) { | ||
| Map<String, List<Field>> groupFieldsForChild = selectionForNormalizedField(schema, nf); | ||
| if (nf.isConditional(schema)) { |
Contributor
Author
There was a problem hiding this comment.
This is the change, we check if the NF is conditional, if it is then we add it to the conditional field Map to group the type conditions, otherwise we add it straight to the output as a raw Field.
| } | ||
|
|
||
| overallGroupedFields.forEach((objectTypeName, fields) -> { | ||
| conditionalFieldsByObjectTypeName.forEach((objectTypeName, fields) -> { |
Contributor
Author
There was a problem hiding this comment.
As usual, we group the condition fields by object type conditions so that they can be grouped together in the same inline fragment.
andimarek
approved these changes
Nov 30, 2021
5 tasks done
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.
My IDE keeps freezing when I open GraphQL Java, so I used the IDE without the smart features to write this code… felt like I was sent 10 years back in time. Let me know if something is wrong.