Skip to content

Commit 687644c

Browse files
committed
Merge branch 'master' into defer-support-exploration
2 parents c0df7ae + 7e06f57 commit 687644c

19 files changed

+141
-106
lines changed

src/main/java/graphql/execution/AbsoluteGraphQLError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AbsoluteGraphQLError implements GraphQLError {
3131
assertNotNull(executionStrategyParameters);
3232
assertNotNull(relativeError);
3333
this.absolutePath = createAbsolutePath(executionStrategyParameters, relativeError);
34-
this.locations = createAbsoluteLocations(relativeError, executionStrategyParameters.field());
34+
this.locations = createAbsoluteLocations(relativeError, executionStrategyParameters.getField());
3535
this.message = relativeError.getMessage();
3636
this.errorType = relativeError.getErrorType();
3737
if (relativeError.getExtensions() != null) {
@@ -72,7 +72,7 @@ private List<Object> createAbsolutePath(ExecutionStrategyParameters executionStr
7272
return Optional.ofNullable(relativeError.getPath())
7373
.map(originalPath -> {
7474
List<Object> path = new ArrayList<>();
75-
path.addAll(executionStrategyParameters.path().toList());
75+
path.addAll(executionStrategyParameters.getPath().toList());
7676
path.addAll(relativeError.getPath());
7777
return path;
7878
})

src/main/java/graphql/execution/AsyncExecutionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public CompletableFuture<ExecutionResult> execute(ExecutionContext executionCont
4343

4444
InstrumentationContext<ExecutionResult> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters);
4545

46-
Map<String, List<Field>> fields = parameters.fields();
46+
Map<String, List<Field>> fields = parameters.getFields();
4747
List<String> fieldNames = new ArrayList<>(fields.keySet());
4848
List<CompletableFuture<ExecutionResult>> futures = new ArrayList<>();
4949
for (String fieldName : fieldNames) {
5050
List<Field> currentField = fields.get(fieldName);
5151

52-
ExecutionPath fieldPath = parameters.path().segment(fieldName);
52+
ExecutionPath fieldPath = parameters.getPath().segment(fieldName);
5353
ExecutionStrategyParameters newParameters = parameters
5454
.transform(builder -> builder.field(currentField).path(fieldPath));
5555

src/main/java/graphql/execution/AsyncSerialExecutionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public CompletableFuture<ExecutionResult> execute(ExecutionContext executionCont
3131
Instrumentation instrumentation = executionContext.getInstrumentation();
3232
InstrumentationExecutionStrategyParameters instrumentationParameters = new InstrumentationExecutionStrategyParameters(executionContext, parameters);
3333
InstrumentationContext<ExecutionResult> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters);
34-
Map<String, List<Field>> fields = parameters.fields();
34+
Map<String, List<Field>> fields = parameters.getFields();
3535
List<String> fieldNames = new ArrayList<>(fields.keySet());
3636

3737
CompletableFuture<List<ExecutionResult>> resultsFuture = Async.eachSequentially(fieldNames, (fieldName, index, prevResults) -> {
3838
List<Field> currentField = fields.get(fieldName);
39-
ExecutionPath fieldPath = parameters.path().segment(fieldName);
39+
ExecutionPath fieldPath = parameters.getPath().segment(fieldName);
4040
ExecutionStrategyParameters newParameters = parameters
4141
.transform(builder -> builder.field(currentField).path(fieldPath));
4242
return resolveField(executionContext, newParameters);

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 49 additions & 57 deletions
Large diffs are not rendered by default.

src/main/java/graphql/execution/ExecutionStrategyParameters.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,27 @@ private ExecutionStrategyParameters(ExecutionTypeInfo typeInfo, Object source, M
3636
this.deferredErrorSupport = deferredErrorSupport;
3737
}
3838

39-
public ExecutionTypeInfo typeInfo() {
39+
public ExecutionTypeInfo getTypeInfo() {
4040
return typeInfo;
4141
}
4242

43-
public Object source() {
43+
public Object getSource() {
4444
return source;
4545
}
4646

47-
public Map<String, List<Field>> fields() {
47+
public Map<String, List<Field>> getFields() {
4848
return fields;
4949
}
5050

51-
public Map<String, Object> arguments() {
51+
public Map<String, Object> getArguments() {
5252
return arguments;
5353
}
5454

55-
public NonNullableFieldValidator nonNullFieldValidator() {
55+
public NonNullableFieldValidator getNonNullFieldValidator() {
5656
return nonNullableFieldValidator;
5757
}
5858

59-
public ExecutionPath path() {
59+
public ExecutionPath getPath() {
6060
return path;
6161
}
6262

@@ -71,7 +71,7 @@ public DeferredErrorSupport deferredErrorSupport() {
7171
*
7272
* @return the current field in list form or null if this has not be computed yet
7373
*/
74-
public List<Field> field() {
74+
public List<Field> getField() {
7575
return currentField;
7676
}
7777

@@ -122,6 +122,7 @@ private Builder(ExecutionStrategyParameters oldParameters) {
122122
this.nonNullableFieldValidator = oldParameters.nonNullableFieldValidator;
123123
this.currentField = oldParameters.currentField;
124124
this.deferredErrorSupport = oldParameters.deferredErrorSupport;
125+
this.path = oldParameters.path;
125126
}
126127

127128
public Builder typeInfo(ExecutionTypeInfo type) {

src/main/java/graphql/execution/ExecutorServiceExecutionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public CompletableFuture<ExecutionResult> execute(final ExecutionContext executi
5858
InstrumentationExecutionStrategyParameters instrumentationParameters = new InstrumentationExecutionStrategyParameters(executionContext, parameters);
5959
InstrumentationContext<ExecutionResult> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters);
6060

61-
Map<String, List<Field>> fields = parameters.fields();
61+
Map<String, List<Field>> fields = parameters.getFields();
6262
Map<String, Future<CompletableFuture<ExecutionResult>>> futures = new LinkedHashMap<>();
6363
for (String fieldName : fields.keySet()) {
6464
final List<Field> currentField = fields.get(fieldName);
6565

66-
ExecutionPath fieldPath = parameters.path().segment(fieldName);
66+
ExecutionPath fieldPath = parameters.getPath().segment(fieldName);
6767
ExecutionStrategyParameters newParameters = parameters
6868
.transform(builder -> builder.field(currentField).path(fieldPath));
6969

src/main/java/graphql/execution/SubscriptionExecutionStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ private ExecutionResult wrapWithRootFieldName(ExecutionStrategyParameters parame
111111
}
112112

113113
private String getRootFieldName(ExecutionStrategyParameters parameters) {
114-
Field rootField = parameters.field().get(0);
114+
Field rootField = parameters.getField().get(0);
115115
return rootField.getAlias() != null ? rootField.getAlias() : rootField.getName();
116116
}
117117

118118
private ExecutionStrategyParameters firstFieldOfSubscriptionSelection(ExecutionStrategyParameters parameters) {
119-
Map<String, List<Field>> fields = parameters.fields();
119+
Map<String, List<Field>> fields = parameters.getFields();
120120
List<String> fieldNames = new ArrayList<>(fields.keySet());
121121

122122
List<Field> firstField = fields.get(fieldNames.get(0));
123123

124-
ExecutionPath fieldPath = parameters.path().segment(firstField.get(0).getName());
124+
ExecutionPath fieldPath = parameters.getPath().segment(firstField.get(0).getName());
125125
return parameters.transform(builder -> builder.field(firstField).path(fieldPath));
126126
}
127127

src/main/java/graphql/execution/batched/BatchedExecutionStrategy.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ public CompletableFuture<ExecutionResult> execute(ExecutionContext executionCont
102102
InstrumentationContext<ExecutionResult> executionStrategyCtx = executionContext.getInstrumentation()
103103
.beginExecutionStrategy(new InstrumentationExecutionStrategyParameters(executionContext, parameters));
104104

105-
GraphQLObjectType type = parameters.typeInfo().castType(GraphQLObjectType.class);
105+
GraphQLObjectType type = parameters.getTypeInfo().castType(GraphQLObjectType.class);
106106

107107
ExecutionNode root = new ExecutionNode(type,
108-
parameters.typeInfo(),
109-
parameters.fields(),
108+
parameters.getTypeInfo(),
109+
parameters.getFields(),
110110
singletonList(MapOrList.createMap(new LinkedHashMap<>())),
111-
Collections.singletonList(parameters.source())
111+
Collections.singletonList(parameters.getSource())
112112
);
113113

114114
Queue<ExecutionNode> nodes = new ArrayDeque<>();
@@ -152,7 +152,7 @@ private void executeImpl(ExecutionContext executionContext,
152152
// once an object is resolved from a interface / union to a node with an object type, the
153153
// parent type info has effectively changed (it has got more specific), even though the path etc...
154154
// has not changed
155-
ExecutionTypeInfo currentParentTypeInfo = parameters.typeInfo();
155+
ExecutionTypeInfo currentParentTypeInfo = parameters.getTypeInfo();
156156
ExecutionTypeInfo newParentTypeInfo = newTypeInfo()
157157
.type(curNode.getType())
158158
.fieldDefinition(currentParentTypeInfo.getFieldDefinition())
@@ -202,7 +202,7 @@ private CompletableFuture<List<ExecutionNode>> resolveField(ExecutionContext exe
202202
GraphQLFieldDefinition fieldDef = getFieldDef(executionContext.getGraphQLSchema(), parentType, fields.get(0));
203203

204204
Instrumentation instrumentation = executionContext.getInstrumentation();
205-
ExecutionTypeInfo typeInfo = parameters.typeInfo();
205+
ExecutionTypeInfo typeInfo = parameters.getTypeInfo();
206206
InstrumentationContext<ExecutionResult> fieldCtx = instrumentation.beginField(
207207
new InstrumentationFieldParameters(executionContext, fieldDef, typeInfo)
208208
);
@@ -247,7 +247,7 @@ private CompletableFuture<FetchedValues> fetchData(ExecutionContext executionCon
247247
.fieldDefinition(fieldDef)
248248
.fields(fields)
249249
.fieldType(fieldDef.getType())
250-
.fieldTypeInfo(parameters.typeInfo())
250+
.fieldTypeInfo(parameters.getTypeInfo())
251251
.parentType(parentType)
252252
.selectionSet(fieldCollector)
253253
.build();
@@ -285,7 +285,7 @@ private BiFunction<List<Object>, Throwable, FetchedValues> handleResult(Executio
285285
.argumentValues(argumentValues)
286286
.field(fields.get(0))
287287
.fieldDefinition(fieldDef)
288-
.path(parameters.path())
288+
.path(parameters.getPath())
289289
.exception(exception)
290290
.build();
291291
dataFetcherExceptionHandler.accept(handlerParameters);
@@ -297,7 +297,7 @@ private BiFunction<List<Object>, Throwable, FetchedValues> handleResult(Executio
297297
Object value = unboxPossibleOptional(values.get(i));
298298
retVal.add(new FetchedValue(parentResults.get(i), value));
299299
}
300-
return new FetchedValues(retVal, parameters.typeInfo(), parameters.path());
300+
return new FetchedValues(retVal, parameters.getTypeInfo(), parameters.getPath());
301301
};
302302
}
303303

src/main/java/graphql/language/AstPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private static NodePrinter<ObjectTypeDefinition> objectTypeDefinition() {
281281
out.printf("%s", spaced(
282282
"type",
283283
node.getName(),
284-
wrap("implements ", join(node.getImplements(), ", "), ""),
284+
wrap("implements ", join(node.getImplements(), " & "), ""),
285285
directives(node.getDirectives()),
286286
block(node.getFieldDefinitions())
287287
));

src/main/java/graphql/schema/CoercingParseLiteralException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import graphql.ErrorType;
44
import graphql.GraphQLError;
55
import graphql.GraphQLException;
6+
import graphql.PublicApi;
67
import graphql.language.SourceLocation;
78

89
import java.util.Arrays;
910
import java.util.List;
1011

12+
@PublicApi
1113
public class CoercingParseLiteralException extends GraphQLException implements GraphQLError {
1214
private List<SourceLocation> sourceLocations;
1315

0 commit comments

Comments
 (0)