Skip to content

19.x Backport #3526 and PR #3527 #3532

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

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

dondonz
Copy link
Member

@dondonz dondonz commented Mar 18, 2024

Backport of #3526 and PR #3527 - pulls in introspection disabling and Good Faith Introspection

Remember we're back in the stone age with Java 8, small adjustments for this

return errorClassification;
}
};
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I also backported this convenience method to make the backport easier - it's in v20 onwards

public class NoIntrospectionGraphqlFieldVisibility implements GraphqlFieldVisibility {

@Deprecated // (since = "2024-03-16")
Copy link
Member Author

Choose a reason for hiding this comment

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

Java 8 special: since is not an argument for the Deprecated annotation, so it's a comment

This was added in Java 9. v21 uses Java 11.

Copy link
Member

Choose a reason for hiding this comment

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

nice


when:
ei = ExecutionInput.newExecutionInput(IntrospectionQuery.INTROSPECTION_QUERY)
.graphQLContext(["INTROSPECTION_DISABLED": false]).build()
Copy link
Member Author

Choose a reason for hiding this comment

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

Java 8 special: Map.of was introduced in Java 9, so using the Groovy way instead

@NotNull
private static Optional<ExecutionResult> mkDisabledError(MergedField schemaField) {
IntrospectionDisabledError error = new IntrospectionDisabledError(schemaField.getSingleField().getSourceLocation());
return Optional.of(ExecutionResultImpl.newExecutionResult().addError(error).build());
Copy link
Member Author

Choose a reason for hiding this comment

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

v19 API difference: this builder method is moved in v20 onwards

@dondonz dondonz changed the title Backport #3526 with minor adjustments for v19 19.x Backport #3526 Mar 18, 2024
ImmutableList<ExecutableNormalizedField> normalizedFields = coordinatesToENFs.get(coordinates);
if (normalizedFields.size() > allowSize) {
BadFaithIntrospectionError error = new BadFaithIntrospectionError(coordinates.toString());
return Optional.of(ExecutionResultImpl.newExecutionResult().addError(error).build());
Copy link
Member Author

Choose a reason for hiding this comment

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

Slight difference to master: this builder has changed file location

For v19 it is inside ExecutionResultImpl

ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "inputFields"), 1);
ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "interfaces"), 1);
ALLOWED_FIELD_INSTANCES.put(coordinates("__Type", "possibleTypes"), 1);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Java 8 alert: there is no Map.of until Java 9 so I am using a static block like a caveman

@dondonz dondonz changed the title 19.x Backport #3526 19.x Backport #3526 and PR #3527 Mar 18, 2024
Copy link
Member

@bbakerman bbakerman left a comment

Choose a reason for hiding this comment

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

Nice one - will the max nodes go in here

@dondonz
Copy link
Member Author

dondonz commented Mar 19, 2024

Nice one - will the max nodes go in here

I'll add it in a separate PR

@dondonz dondonz merged commit 84d4e39 into 19.x Mar 19, 2024
@dondonz dondonz added this to the 19.10 milestone Mar 19, 2024
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.

2 participants