|
14 | 14 | import graphql.TrivialDataFetcher; |
15 | 15 | import graphql.TypeMismatchError; |
16 | 16 | import graphql.UnresolvedTypeError; |
17 | | -import graphql.collect.ImmutableMapWithNullValues; |
18 | 17 | import graphql.execution.directives.QueryDirectives; |
19 | 18 | import graphql.execution.directives.QueryDirectivesImpl; |
20 | 19 | import graphql.execution.incremental.DeferredExecutionSupport; |
|
29 | 28 | import graphql.execution.reactive.ReactiveSupport; |
30 | 29 | import graphql.extensions.ExtensionsBuilder; |
31 | 30 | import graphql.introspection.Introspection; |
32 | | -import graphql.language.Argument; |
33 | 31 | import graphql.language.Field; |
34 | 32 | import graphql.normalized.ExecutableNormalizedField; |
35 | 33 | import graphql.normalized.ExecutableNormalizedOperation; |
|
38 | 36 | import graphql.schema.DataFetchingEnvironment; |
39 | 37 | import graphql.schema.DataFetchingFieldSelectionSet; |
40 | 38 | import graphql.schema.DataFetchingFieldSelectionSetImpl; |
41 | | -import graphql.schema.GraphQLArgument; |
42 | 39 | import graphql.schema.GraphQLCodeRegistry; |
43 | 40 | import graphql.schema.GraphQLEnumType; |
44 | 41 | import graphql.schema.GraphQLFieldDefinition; |
45 | 42 | import graphql.schema.GraphQLObjectType; |
46 | | -import graphql.schema.GraphQLOutputType; |
47 | 43 | import graphql.schema.GraphQLScalarType; |
48 | 44 | import graphql.schema.GraphQLSchema; |
49 | 45 | import graphql.schema.GraphQLType; |
|
64 | 60 | import java.util.function.Supplier; |
65 | 61 |
|
66 | 62 | import static graphql.execution.Async.exceptionallyCompletedFuture; |
67 | | -import static graphql.execution.ExecutionStepInfo.newExecutionStepInfo; |
68 | 63 | import static graphql.execution.FieldCollectorParameters.newParameters; |
69 | 64 | import static graphql.execution.FieldValueInfo.CompleteValueType.ENUM; |
70 | 65 | import static graphql.execution.FieldValueInfo.CompleteValueType.LIST; |
@@ -1094,48 +1089,10 @@ protected ExecutionStepInfo createExecutionStepInfo(ExecutionContext executionCo |
1094 | 1089 | ExecutionStrategyParameters parameters, |
1095 | 1090 | GraphQLFieldDefinition fieldDefinition, |
1096 | 1091 | GraphQLObjectType fieldContainer) { |
1097 | | - MergedField field = parameters.getField(); |
1098 | | - ExecutionStepInfo parentStepInfo = parameters.getExecutionStepInfo(); |
1099 | | - GraphQLOutputType fieldType = fieldDefinition.getType(); |
1100 | | - List<GraphQLArgument> fieldArgDefs = fieldDefinition.getArguments(); |
1101 | | - Supplier<ImmutableMapWithNullValues<String, Object>> argumentValues = ImmutableMapWithNullValues::emptyMap; |
1102 | | - // |
1103 | | - // no need to create args at all if there are none on the field def |
1104 | | - // |
1105 | | - if (!fieldArgDefs.isEmpty()) { |
1106 | | - argumentValues = getArgumentValues(executionContext, fieldArgDefs, field.getArguments()); |
1107 | | - } |
1108 | | - |
1109 | | - |
1110 | | - return newExecutionStepInfo() |
1111 | | - .type(fieldType) |
1112 | | - .fieldDefinition(fieldDefinition) |
1113 | | - .fieldContainer(fieldContainer) |
1114 | | - .field(field) |
1115 | | - .path(parameters.getPath()) |
1116 | | - .parentInfo(parentStepInfo) |
1117 | | - .arguments(argumentValues) |
1118 | | - .build(); |
1119 | | - } |
1120 | | - |
1121 | | - @NonNull |
1122 | | - private static Supplier<ImmutableMapWithNullValues<String, Object>> getArgumentValues(ExecutionContext executionContext, |
1123 | | - List<GraphQLArgument> fieldArgDefs, |
1124 | | - List<Argument> fieldArgs) { |
1125 | | - Supplier<ImmutableMapWithNullValues<String, Object>> argumentValues; |
1126 | | - GraphQLCodeRegistry codeRegistry = executionContext.getGraphQLSchema().getCodeRegistry(); |
1127 | | - Supplier<ImmutableMapWithNullValues<String, Object>> argValuesSupplier = () -> { |
1128 | | - Map<String, Object> resolvedValues = ValuesResolver.getArgumentValues(codeRegistry, |
1129 | | - fieldArgDefs, |
1130 | | - fieldArgs, |
1131 | | - executionContext.getCoercedVariables(), |
1132 | | - executionContext.getGraphQLContext(), |
1133 | | - executionContext.getLocale()); |
1134 | | - |
1135 | | - return ImmutableMapWithNullValues.copyOf(resolvedValues); |
1136 | | - }; |
1137 | | - argumentValues = FpKit.intraThreadMemoize(argValuesSupplier); |
1138 | | - return argumentValues; |
| 1092 | + return executionStepInfoFactory.createExecutionStepInfo(executionContext, |
| 1093 | + parameters, |
| 1094 | + fieldDefinition, |
| 1095 | + fieldContainer); |
1139 | 1096 | } |
1140 | 1097 |
|
1141 | 1098 | // Errors that result from the execution of deferred fields are kept in the deferred context only. |
|
0 commit comments