Skip to content

Commit 8a4a432

Browse files
committed
Upgrade to GraphQL Java 22 test version
See gh-932
1 parent 52202d4 commit 8a4a432

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description = "Spring for GraphQL"
33
ext {
44
moduleProjects = [project(":spring-graphql"), project(":spring-graphql-test")]
55
springFrameworkVersion = "6.1.4"
6-
graphQlJavaVersion = "0.0.0-2024-03-20T00-25-33-974c165"
6+
graphQlJavaVersion = "0.0.0-2024-03-28T10-27-26-41c9ba2"
77
springBootVersion = "3.2.2"
88
}
99

spring-graphql/src/main/java/org/springframework/graphql/data/query/AutoRegistrationTypeVisitor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
import java.util.function.Function;
2020

2121
import graphql.schema.DataFetcher;
22+
import graphql.schema.FieldCoordinates;
2223
import graphql.schema.GraphQLCodeRegistry;
2324
import graphql.schema.GraphQLFieldDefinition;
2425
import graphql.schema.GraphQLFieldsContainer;
@@ -78,7 +79,8 @@ public TraversalControl visitGraphQLFieldDefinition(
7879
if (dataFetcher != null) {
7980
GraphQLCodeRegistry.Builder registry = context.getVarFromParents(GraphQLCodeRegistry.Builder.class);
8081
if (!hasDataFetcher(registry, parent, fieldDefinition)) {
81-
registry.dataFetcher(parent, fieldDefinition, dataFetcher);
82+
FieldCoordinates coordinates = FieldCoordinates.coordinates(parent.getName(), fieldDefinition.getName());
83+
registry.dataFetcher(coordinates, dataFetcher);
8284
}
8385
}
8486

@@ -101,7 +103,8 @@ private boolean hasDataFetcher(
101103
GraphQLCodeRegistry.Builder registry, GraphQLFieldsContainer parent,
102104
GraphQLFieldDefinition fieldDefinition) {
103105

104-
DataFetcher<?> fetcher = registry.getDataFetcher(parent, fieldDefinition);
106+
FieldCoordinates coordinates = FieldCoordinates.coordinates(parent.getName(), fieldDefinition.getName());
107+
DataFetcher<?> fetcher = registry.getDataFetcher(coordinates, fieldDefinition);
105108
return (fetcher != null && !(fetcher instanceof PropertyDataFetcher));
106109
}
107110

spring-graphql/src/main/java/org/springframework/graphql/observation/GraphQlObservationInstrumentation.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor;
3434
import org.springframework.lang.Nullable;
3535

36+
import java.util.concurrent.CompletableFuture;
3637
import java.util.concurrent.CompletionException;
3738
import java.util.concurrent.CompletionStage;
3839

@@ -95,8 +96,8 @@ public GraphQlObservationInstrumentation(ObservationRegistry observationRegistry
9596
}
9697

9798
@Override
98-
public InstrumentationState createState(InstrumentationCreateStateParameters parameters) {
99-
return RequestObservationInstrumentationState.INSTANCE;
99+
public CompletableFuture<InstrumentationState> createStateAsync(InstrumentationCreateStateParameters parameters) {
100+
return CompletableFuture.completedFuture(RequestObservationInstrumentationState.INSTANCE);
100101
}
101102

102103
@Override

spring-graphql/src/test/java/org/springframework/graphql/client/GraphQlClientTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ void retrieveWithOperationNameAndVariables() {
119119
void retrieveInvalidResponse() {
120120

121121
String document = "errorsOnlyResponse";
122-
getGraphQlService().setErrors(document, new ValidationError(ValidationErrorType.InvalidSyntax));
122+
getGraphQlService().setErrors(document, ValidationError.newValidationError().validationErrorType(ValidationErrorType.InvalidSyntax).build());
123123
testRetrieveFieldAccessException(document, "me");
124124

125125
document = "nullDataResponse";
@@ -162,7 +162,7 @@ private void testRetrieveFieldAccessException(String document, String path) {
162162
void executeInvalidResponse() {
163163

164164
String document = "errorsOnlyResponse";
165-
getGraphQlService().setErrors(document, new ValidationError(ValidationErrorType.InvalidSyntax));
165+
getGraphQlService().setErrors(document, ValidationError.newValidationError().validationErrorType(ValidationErrorType.InvalidSyntax).build());
166166
testExecuteFailedResponse(document);
167167

168168
document = "nullDataResponse";

0 commit comments

Comments
 (0)