Upgrade to GraphQL Java 22 test version

See gh-932
This commit is contained in:
Brian Clozel
2024-03-29 18:59:32 +01:00
parent 52202d40d1
commit 8a4a4327e1
4 changed files with 13 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ description = "Spring for GraphQL"
ext {
moduleProjects = [project(":spring-graphql"), project(":spring-graphql-test")]
springFrameworkVersion = "6.1.4"
graphQlJavaVersion = "0.0.0-2024-03-20T00-25-33-974c165"
graphQlJavaVersion = "0.0.0-2024-03-28T10-27-26-41c9ba2"
springBootVersion = "3.2.2"
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.function.Function;
import graphql.schema.DataFetcher;
import graphql.schema.FieldCoordinates;
import graphql.schema.GraphQLCodeRegistry;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLFieldsContainer;
@@ -78,7 +79,8 @@ class AutoRegistrationTypeVisitor extends GraphQLTypeVisitorStub {
if (dataFetcher != null) {
GraphQLCodeRegistry.Builder registry = context.getVarFromParents(GraphQLCodeRegistry.Builder.class);
if (!hasDataFetcher(registry, parent, fieldDefinition)) {
registry.dataFetcher(parent, fieldDefinition, dataFetcher);
FieldCoordinates coordinates = FieldCoordinates.coordinates(parent.getName(), fieldDefinition.getName());
registry.dataFetcher(coordinates, dataFetcher);
}
}
@@ -101,7 +103,8 @@ class AutoRegistrationTypeVisitor extends GraphQLTypeVisitorStub {
GraphQLCodeRegistry.Builder registry, GraphQLFieldsContainer parent,
GraphQLFieldDefinition fieldDefinition) {
DataFetcher<?> fetcher = registry.getDataFetcher(parent, fieldDefinition);
FieldCoordinates coordinates = FieldCoordinates.coordinates(parent.getName(), fieldDefinition.getName());
DataFetcher<?> fetcher = registry.getDataFetcher(coordinates, fieldDefinition);
return (fetcher != null && !(fetcher instanceof PropertyDataFetcher));
}

View File

@@ -33,6 +33,7 @@ import io.micrometer.observation.ObservationRegistry;
import io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor;
import org.springframework.lang.Nullable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
@@ -95,8 +96,8 @@ public class GraphQlObservationInstrumentation extends SimplePerformantInstrumen
}
@Override
public InstrumentationState createState(InstrumentationCreateStateParameters parameters) {
return RequestObservationInstrumentationState.INSTANCE;
public CompletableFuture<InstrumentationState> createStateAsync(InstrumentationCreateStateParameters parameters) {
return CompletableFuture.completedFuture(RequestObservationInstrumentationState.INSTANCE);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ public class GraphQlClientTests extends GraphQlClientTestSupport {
void retrieveInvalidResponse() {
String document = "errorsOnlyResponse";
getGraphQlService().setErrors(document, new ValidationError(ValidationErrorType.InvalidSyntax));
getGraphQlService().setErrors(document, ValidationError.newValidationError().validationErrorType(ValidationErrorType.InvalidSyntax).build());
testRetrieveFieldAccessException(document, "me");
document = "nullDataResponse";
@@ -162,7 +162,7 @@ public class GraphQlClientTests extends GraphQlClientTestSupport {
void executeInvalidResponse() {
String document = "errorsOnlyResponse";
getGraphQlService().setErrors(document, new ValidationError(ValidationErrorType.InvalidSyntax));
getGraphQlService().setErrors(document, ValidationError.newValidationError().validationErrorType(ValidationErrorType.InvalidSyntax).build());
testExecuteFailedResponse(document);
document = "nullDataResponse";