Skip to content

Commit b67078e

Browse files
committed
all tests green
1 parent 6690312 commit b67078e

12 files changed

+295
-247
lines changed

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

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ protected ExecutionStrategy(DataFetcherExceptionHandler dataFetcherExceptionHand
154154
*
155155
* @param executionContext contains the top level execution parameters
156156
* @param parameters contains the parameters holding the fields to be executed and source object
157+
*
157158
* @return a promise to an {@link ExecutionResult}
159+
*
158160
* @throws NonNullableFieldWasNullException in the future if a non null field resolves to a null value
159161
*/
160162
public abstract CompletableFuture<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException;
@@ -170,7 +172,9 @@ protected ExecutionStrategy(DataFetcherExceptionHandler dataFetcherExceptionHand
170172
*
171173
* @param executionContext contains the top level execution parameters
172174
* @param parameters contains the parameters holding the fields to be executed and source object
175+
*
173176
* @return a promise to an {@link ExecutionResult}
177+
*
174178
* @throws NonNullableFieldWasNullException in the future if a non null field resolves to a null value
175179
*/
176180
protected CompletableFuture<ExecutionResult> resolveField(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
@@ -188,7 +192,9 @@ protected CompletableFuture<ExecutionResult> resolveField(ExecutionContext execu
188192
*
189193
* @param executionContext contains the top level execution parameters
190194
* @param parameters contains the parameters holding the fields to be executed and source object
195+
*
191196
* @return a promise to a {@link FieldValueInfo}
197+
*
192198
* @throws NonNullableFieldWasNullException in the {@link FieldValueInfo#getFieldValue()} future if a non null field resolves to a null value
193199
*/
194200
protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
@@ -220,7 +226,9 @@ protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContex
220226
*
221227
* @param executionContext contains the top level execution parameters
222228
* @param parameters contains the parameters holding the fields to be executed and source object
229+
*
223230
* @return a promise to a fetched object
231+
*
224232
* @throws NonNullableFieldWasNullException in the future if a non null field resolves to a null value
225233
*/
226234
protected CompletableFuture<FetchedValue> fetchField(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
@@ -239,7 +247,7 @@ protected CompletableFuture<FetchedValue> fetchField(ExecutionContext executionC
239247
Supplier<NormalizedField> normalizedFieldSupplier = getNormalizedField(executionContext, parameters, executionStepInfo);
240248

241249
// DataFetchingFieldSelectionSet and QueryDirectives is a supplier of sorts - eg a lazy pattern
242-
DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(fieldType, normalizedFieldSupplier);
250+
DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext.getGraphQLSchema(), fieldType, normalizedFieldSupplier);
243251
QueryDirectives queryDirectives = new QueryDirectivesImpl(field, executionContext.getGraphQLSchema(), executionContext.getVariables());
244252

245253

@@ -297,8 +305,8 @@ protected Supplier<NormalizedField> getNormalizedField(ExecutionContext executio
297305
}
298306

299307
protected FetchedValue unboxPossibleDataFetcherResult(ExecutionContext executionContext,
300-
ExecutionStrategyParameters parameters,
301-
Object result) {
308+
ExecutionStrategyParameters parameters,
309+
Object result) {
302310

303311
if (result instanceof DataFetcherResult) {
304312
//noinspection unchecked
@@ -326,8 +334,8 @@ protected FetchedValue unboxPossibleDataFetcherResult(ExecutionContext execution
326334
}
327335

328336
protected void handleFetchingException(ExecutionContext executionContext,
329-
DataFetchingEnvironment environment,
330-
Throwable e) {
337+
DataFetchingEnvironment environment,
338+
Throwable e) {
331339
DataFetcherExceptionHandlerParameters handlerParameters = DataFetcherExceptionHandlerParameters.newExceptionParameters()
332340
.dataFetchingEnvironment(environment)
333341
.exception(e)
@@ -359,7 +367,9 @@ protected void handleFetchingException(ExecutionContext executionContext,
359367
* @param executionContext contains the top level execution parameters
360368
* @param parameters contains the parameters holding the fields to be executed and source object
361369
* @param fetchedValue the fetched raw value
370+
*
362371
* @return a {@link FieldValueInfo}
372+
*
363373
* @throws NonNullableFieldWasNullException in the {@link FieldValueInfo#getFieldValue()} future if a non null field resolves to a null value
364374
*/
365375
protected FieldValueInfo completeField(ExecutionContext executionContext, ExecutionStrategyParameters parameters, FetchedValue fetchedValue) {
@@ -407,7 +417,9 @@ protected FieldValueInfo completeField(ExecutionContext executionContext, Execut
407417
*
408418
* @param executionContext contains the top level execution parameters
409419
* @param parameters contains the parameters holding the fields to be executed and source object
420+
*
410421
* @return a {@link FieldValueInfo}
422+
*
411423
* @throws NonNullableFieldWasNullException if a non null field resolves to a null value
412424
*/
413425
protected FieldValueInfo completeValue(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException {
@@ -468,6 +480,7 @@ protected CompletableFuture<ExecutionResult> completeValueForNull(ExecutionConte
468480
* @param executionContext contains the top level execution parameters
469481
* @param parameters contains the parameters holding the fields to be executed and source object
470482
* @param result the result to complete, raw result
483+
*
471484
* @return a {@link FieldValueInfo}
472485
*/
473486
protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Object result) {
@@ -490,6 +503,7 @@ protected FieldValueInfo completeValueForList(ExecutionContext executionContext,
490503
* @param executionContext contains the top level execution parameters
491504
* @param parameters contains the parameters holding the fields to be executed and source object
492505
* @param iterableValues the values to complete, can't be null
506+
*
493507
* @return a {@link FieldValueInfo}
494508
*/
495509
protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Iterable<Object> iterableValues) {
@@ -563,6 +577,7 @@ protected FieldValueInfo completeValueForList(ExecutionContext executionContext,
563577
* @param parameters contains the parameters holding the fields to be executed and source object
564578
* @param scalarType the type of the scalar
565579
* @param result the result to be coerced
580+
*
566581
* @return a promise to an {@link ExecutionResult}
567582
*/
568583
protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLScalarType scalarType, Object result) {
@@ -593,6 +608,7 @@ protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionCon
593608
* @param parameters contains the parameters holding the fields to be executed and source object
594609
* @param enumType the type of the enum
595610
* @param result the result to be coerced
611+
*
596612
* @return a promise to an {@link ExecutionResult}
597613
*/
598614
protected CompletableFuture<ExecutionResult> completeValueForEnum(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLEnumType enumType, Object result) {
@@ -617,6 +633,7 @@ protected CompletableFuture<ExecutionResult> completeValueForEnum(ExecutionConte
617633
* @param parameters contains the parameters holding the fields to be executed and source object
618634
* @param resolvedObjectType the resolved object type
619635
* @param result the result to be coerced
636+
*
620637
* @return a promise to an {@link ExecutionResult}
621638
*/
622639
protected CompletableFuture<ExecutionResult> completeValueForObject(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLObjectType resolvedObjectType, Object result) {
@@ -661,7 +678,9 @@ private Object handleCoercionProblem(ExecutionContext context, ExecutionStrategy
661678
* Converts an object that is known to should be an Iterable into one
662679
*
663680
* @param result the result object
681+
*
664682
* @return an Iterable from that object
683+
*
665684
* @throws java.lang.ClassCastException if its not an Iterable
666685
*/
667686
protected Iterable<Object> toIterable(Object result) {
@@ -697,6 +716,7 @@ private void handleTypeMismatchProblem(ExecutionContext context, ExecutionStrate
697716
* @param executionContext contains the top level execution parameters
698717
* @param parameters contains the parameters holding the fields to be executed and source object
699718
* @param field the field to find the definition of
719+
*
700720
* @return a {@link GraphQLFieldDefinition}
701721
*/
702722
protected GraphQLFieldDefinition getFieldDef(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Field field) {
@@ -710,6 +730,7 @@ protected GraphQLFieldDefinition getFieldDef(ExecutionContext executionContext,
710730
* @param schema the schema in play
711731
* @param parentType the parent type of the field
712732
* @param field the field to find the definition of
733+
*
713734
* @return a {@link GraphQLFieldDefinition}
714735
*/
715736
protected GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLObjectType parentType, Field field) {
@@ -727,6 +748,7 @@ protected GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLObject
727748
*
728749
* @param e this indicates that a null value was returned for a non null field, which needs to cause the parent field
729750
* to become null OR continue on as an exception
751+
*
730752
* @throws NonNullableFieldWasNullException if a non null field resolves to a null value
731753
*/
732754
protected void assertNonNullFieldPrecondition(NonNullableFieldWasNullException e) throws NonNullableFieldWasNullException {
@@ -774,6 +796,7 @@ protected ExecutionResult handleNonNullException(ExecutionContext executionConte
774796
* @param parameters contains the parameters holding the fields to be executed and source object
775797
* @param fieldDefinition the field definition to build type info for
776798
* @param fieldContainer the field container
799+
*
777800
* @return a new type info
778801
*/
779802
protected ExecutionStepInfo createExecutionStepInfo(ExecutionContext executionContext,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private CompletableFuture<FetchedValues> fetchData(ExecutionContext executionCon
253253
Supplier<NormalizedField> normalizedFieldSupplier = getNormalizedField(executionContext, parameters, parameters::getExecutionStepInfo);
254254

255255
GraphQLOutputType fieldType = fieldDef.getType();
256-
DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(fieldType, normalizedFieldSupplier);
256+
DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext.getGraphQLSchema(), fieldType, normalizedFieldSupplier);
257257

258258
DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext)
259259
.source(node.getSources())

src/main/java/graphql/execution/nextgen/ValueFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public CompletableFuture<FetchedValue> fetchValue(ExecutionContext executionCont
127127

128128
Supplier<NormalizedQueryTree> normalizedQuery = executionContext.getNormalizedQueryTree();
129129
Supplier<NormalizedField> normalisedField = () -> normalizedQuery.get().getNormalizedField(sameFields, executionInfo.getObjectType(), executionInfo.getPath());
130-
DataFetchingFieldSelectionSet selectionSet = DataFetchingFieldSelectionSetImpl.newCollector(fieldType, normalisedField);
130+
DataFetchingFieldSelectionSet selectionSet = DataFetchingFieldSelectionSetImpl.newCollector(executionContext.getGraphQLSchema(), fieldType, normalisedField);
131131

132132
DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext)
133133
.source(source)

0 commit comments

Comments
 (0)