Skip to content

Commit 04f585b

Browse files
authored
Merge pull request #192 from yarinvak/graphql-java-11
Graphql java 11
2 parents 24bdc75 + 421dfe7 commit 04f585b

File tree

10 files changed

+30
-24
lines changed

10 files changed

+30
-24
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ gradle.projectsEvaluated {
6969

7070
dependencies {
7171
compile 'javax.validation:validation-api:1.1.0.Final'
72-
compile 'com.graphql-java:graphql-java:9.2'
72+
compile 'com.graphql-java:graphql-java:11.0'
7373

7474
// OSGi
7575
compileOnly 'org.osgi:org.osgi.core:6.0.0'

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8
77

88
bintray.user=DUMMY_USER
99
bintray.key=DUMMY_KEY
10-
version = 5.3.1
10+
version = 6.1

src/main/java/graphql/annotations/connection/PaginatedDataConnectionFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public PaginatedDataConnectionFetcher(DataFetcher<PaginatedData<T>> paginationDa
4141
}
4242

4343
@Override
44-
public Connection<T> get(DataFetchingEnvironment environment) {
44+
public Connection<T> get(DataFetchingEnvironment environment) throws Exception{
4545
PaginatedData<T> paginatedData = paginationDataFetcher.get(environment);
4646
if (paginatedData == null) {
4747
return new DefaultConnection<>(Collections.emptyList(), new DefaultPageInfo(null,null,false,false));

src/main/java/graphql/annotations/connection/simple/SimpleConnectionDataFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public SimpleConnectionDataFetcher(Class<? extends SimpleConnectionFetcher<T>> c
4444
}
4545

4646
@Override
47-
public Connection<T> get(DataFetchingEnvironment environment) {
47+
public Connection<T> get(DataFetchingEnvironment environment) throws Exception {
4848
SimpleConnectionFetcher<T> conn = constructNewInstance(constructor, actualDataFetcher);
4949
return conn.get(environment);
5050
}

src/main/java/graphql/annotations/connection/simple/SimplePaginatedDataConnectionFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public SimplePaginatedDataConnectionFetcher(DataFetcher<SimplePaginatedData<T>>
2626
}
2727

2828
@Override
29-
public SimpleConnection<T> get(DataFetchingEnvironment environment) {
29+
public SimpleConnection<T> get(DataFetchingEnvironment environment) throws Exception {
3030
return simplePaginatedDataDataFetcher.get(environment);
3131
}
3232
}

src/main/java/graphql/annotations/dataFetchers/ExtensionDataFetcherWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public ExtensionDataFetcherWrapper(Class declaringClass, DataFetcher<T> dataFetc
3434
}
3535

3636
@Override
37-
public T get(DataFetchingEnvironment environment) {
37+
public T get(DataFetchingEnvironment environment) throws Exception {
3838
Object source = environment.getSource();
3939
if (source != null && (!declaringClass.isInstance(source)) && !(source instanceof Map)) {
4040
environment = new DataFetchingEnvironmentImpl(newInstance(declaringClass, source),
@@ -43,7 +43,7 @@ public T get(DataFetchingEnvironment environment) {
4343
environment.getFields(), environment.getFieldType(), environment.getParentType(),
4444
environment.getGraphQLSchema(),
4545
environment.getFragmentsByName(), environment.getExecutionId(),
46-
environment.getSelectionSet(), environment.getFieldTypeInfo(),
46+
environment.getSelectionSet(), environment.getExecutionStepInfo(),
4747
environment.getExecutionContext());
4848
}
4949

src/main/java/graphql/annotations/dataFetchers/connection/AsyncConnectionDataFetcher.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,13 @@ public AsyncConnectionDataFetcher(ConnectionDataFetcher connectionFetcher) {
3030
}
3131

3232
@Override
33-
public CompletableFuture<graphql.relay.Connection<T>> get(DataFetchingEnvironment environment) {
34-
return supplyAsync(() -> connectionDataFetcher.get(environment));
33+
public CompletableFuture<graphql.relay.Connection<T>> get(DataFetchingEnvironment environment) throws Exception {
34+
return supplyAsync(() -> {
35+
try {
36+
return connectionDataFetcher.get(environment);
37+
} catch (Exception e) {
38+
throw new RuntimeException("Error in AsyncConnectionDataFetcher", e);
39+
}
40+
});
3541
}
3642
}

src/main/java/graphql/annotations/dataFetchers/connection/ConnectionDataFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public ConnectionDataFetcher(Class<? extends ConnectionFetcher<T>> connection, D
4444
}
4545

4646
@Override
47-
public graphql.relay.Connection<T> get(DataFetchingEnvironment environment) {
47+
public graphql.relay.Connection<T> get(DataFetchingEnvironment environment) throws Exception {
4848
ConnectionFetcher<T> conn = constructNewInstance(constructor, actualDataFetcher);
4949
return conn.get(environment);
5050
}

src/main/java/graphql/annotations/dataFetchers/connection/DispatchingConnection.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ public DispatchingConnection(Object o) {
3434
}
3535

3636
@Override
37-
public Object get(DataFetchingEnvironment environment) {
37+
public Object get(DataFetchingEnvironment environment) throws Exception {
3838
return connection.get(environment);
3939
}
4040
}

src/main/java/graphql/annotations/strategies/EnhancedExecutionStrategy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class EnhancedExecutionStrategy extends AsyncSerialExecutionStrategy {
3131

3232
@Override
3333
protected CompletableFuture<ExecutionResult> resolveField(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
34-
GraphQLObjectType parentType = (GraphQLObjectType) parameters.getTypeInfo().getType();
34+
GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getType();
3535
GraphQLFieldDefinition fieldDef = getFieldDef(executionContext.getGraphQLSchema(), parentType, parameters.getField().get(0));
3636
if (fieldDef == null) return null;
3737

@@ -52,12 +52,12 @@ protected CompletableFuture<ExecutionResult> resolveField(ExecutionContext execu
5252
clientMutationId = clientMutationIdVal.getValue();
5353
}
5454

55-
ExecutionTypeInfo fieldTypeInfo = ExecutionTypeInfo.newTypeInfo().type(fieldDef.getType()).parentInfo(parameters.getTypeInfo()).build();
55+
ExecutionStepInfo fieldTypeInfo = ExecutionStepInfo.newExecutionStepInfo().type(fieldDef.getType()).parentInfo(parameters.getExecutionStepInfo()).build();
5656
ExecutionStrategyParameters newParameters = ExecutionStrategyParameters.newParameters()
5757
.arguments(parameters.getArguments())
5858
.fields(parameters.getFields())
5959
.nonNullFieldValidator(parameters.getNonNullFieldValidator())
60-
.typeInfo(fieldTypeInfo)
60+
.executionStepInfo(fieldTypeInfo)
6161
.source(clientMutationId)
6262
.build();
6363

@@ -70,7 +70,7 @@ protected CompletableFuture<ExecutionResult> resolveField(ExecutionContext execu
7070

7171
@Override
7272
protected FieldValueInfo completeValue(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException {
73-
graphql.schema.GraphQLType fieldType = parameters.getTypeInfo().getType();
73+
graphql.schema.GraphQLType fieldType = parameters.getExecutionStepInfo().getType();
7474
Object result = parameters.getSource();
7575
if (result instanceof Enum && fieldType instanceof GraphQLEnumType) {
7676
Object value = ((GraphQLEnumType) fieldType).getCoercing().parseValue(((Enum) result).name());
@@ -91,7 +91,7 @@ private ExecutionStrategyParameters withSource(ExecutionStrategyParameters param
9191
.arguments(parameters.getArguments())
9292
.fields(parameters.getFields())
9393
.nonNullFieldValidator(parameters.getNonNullFieldValidator())
94-
.typeInfo(parameters.getTypeInfo())
94+
.executionStepInfo(parameters.getExecutionStepInfo())
9595
.source(source)
9696
.build();
9797
}

0 commit comments

Comments
 (0)