19.x Backport #3526 and PR #3527 #3532
Conversation
| return errorClassification; | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
I also backported this convenience method to make the backport easier - it's in v20 onwards
| @Deprecated // (since = "2024-03-16") | ||
| public class NoIntrospectionGraphqlFieldVisibility implements GraphqlFieldVisibility { | ||
|
|
||
| @Deprecated // (since = "2024-03-16") |
There was a problem hiding this comment.
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.
|
|
||
| when: | ||
| ei = ExecutionInput.newExecutionInput(IntrospectionQuery.INTROSPECTION_QUERY) | ||
| .graphQLContext(["INTROSPECTION_DISABLED": false]).build() |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
v19 API difference: this builder method is moved in v20 onwards
| ImmutableList<ExecutableNormalizedField> normalizedFields = coordinatesToENFs.get(coordinates); | ||
| if (normalizedFields.size() > allowSize) { | ||
| BadFaithIntrospectionError error = new BadFaithIntrospectionError(coordinates.toString()); | ||
| return Optional.of(ExecutionResultImpl.newExecutionResult().addError(error).build()); |
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
Java 8 alert: there is no Map.of until Java 9 so I am using a static block like a caveman
bbakerman
left a comment
There was a problem hiding this comment.
Nice one - will the max nodes go in here
I'll add it in a separate PR |
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