Skip to content

Conversation

@dondonz
Copy link
Member

@dondonz dondonz commented Mar 24, 2024

Backport of PR #3539

This is a cherry pick of 3539 plus other changes to bring ConditionalNodes and related classes up to date with v21. I chose not to use the master versions of these files as they have references to defer, to be released in v22.

Note that introspection deliberately has 1 node less than v21+, because the new built-in directive @oneOf is added in version 21.

}
throwAssert(msgFmt, arg1);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport utils

@@ -1,10 +1,10 @@
package graphql.analysis;

import graphql.GraphQLContext;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

@@ -1,5 +1,6 @@
package graphql.analysis;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

@@ -1,5 +1,6 @@
package graphql.analysis;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

FragmentSpread fragmentSpread = (FragmentSpread) node;
return singletonList(fragmentsByName.get(fragmentSpread.getName()));
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

@@ -1,43 +0,0 @@
package graphql.execution;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File was moved into it's own directory

@@ -1,7 +1,8 @@
package graphql.execution;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

@@ -1,6 +1,7 @@
package graphql.execution;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update file to bring in line with v21 - it's because ConditionalNodes are referenced in the ExecutableNormalizedOperationFactory, and those changes are viral in a few other files

@@ -0,0 +1,22 @@
package graphql.execution.conditional;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bring in line with v21

@@ -0,0 +1,48 @@
package graphql.execution.conditional;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bring in line with v21

@@ -0,0 +1,102 @@
package graphql.execution.conditional;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated ConditionalNodes as it appears in v21

then:
def e = thrown(AbortExecutionException)
// This line is different in version 21+, it is "Maximum field count exceeded. 189 > 188"
e.message == "Maximum field count exceeded. 188 > 187"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we count nodes is 1 less in v20 compared to v21 & master

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Andi: the reason for this is @oneOf is introduced in v21, so v20 and prior will have 1 less node

@dondonz dondonz changed the title Cherry pick PR 3539 and update ConditionalNodes and related files to … 20.x Backport PR 3539 Mar 25, 2024
byte[] bytes;
try (InputStream inputStream = resource.openStream()) {
// In GraphQL Java version 21 and above, this Guava helper is replaced with Java 9's readAllBytes()
bytes = ByteStreams.toByteArray(inputStream);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun one: readAllBytes is only in Java 9 onwards so here's the Guava equivalent. We selectively shade in Guava files (e.g. Immutable objects already in use) so we're alright to use Guava here.

@dondonz dondonz added this to the 20.9 milestone Mar 25, 2024
@dondonz dondonz merged commit d3a8540 into 20.x Mar 26, 2024
@dondonz dondonz deleted the 20.x-backport-enf-introspection branch March 26, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants