fetchMap.put("parentType", executionStepInfo.getParent().getUnwrappedNonNullType().getName()); fetchMap.put("returnType", executionStepInfo.simplePrint()); fetchMap.put("fieldName", executionStepInfo.getFieldDefinition().getName()); fetchMap.put("startOffset", startOffset); fetchMap.put("duration", duration);
private boolean isDataFetcherBatched(ExecutionContext executionContext, ExecutionStepInfo executionStepInfo) { GraphQLFieldsContainer parentType = getFieldsContainer(executionStepInfo); GraphQLFieldDefinition fieldDef = executionStepInfo.getFieldDefinition(); DataFetcher dataFetcher = executionContext.getGraphQLSchema().getCodeRegistry().getDataFetcher(parentType, fieldDef); return dataFetcher instanceof BatchedDataFetcher; }
private String mkMessage(ExecutionPath path, UnresolvedTypeException exception, ExecutionStepInfo info) { return format("Can't resolve '%s'. Abstract type '%s' must resolve to an Object type at runtime for field '%s.%s'. %s", path, exception.getInterfaceOrUnionType().getName(), info.getParent().getUnwrappedNonNullType().getName(), info.getFieldDefinition().getName(), exception.getMessage()); }
GraphQLFieldDefinition fieldDef = parameters.getExecutionStepInfo().getFieldDefinition(); GraphQLObjectType fieldContainer = parameters.getExecutionStepInfo().getFieldContainer();
ExecutionStepInfo newParentExecutionStepInfo = newExecutionStepInfo() .type(curNode.getType()) .fieldDefinition(currentParentExecutionStepInfo.getFieldDefinition()) .field(currentParentExecutionStepInfo.getField()) .path(currentParentExecutionStepInfo.getPath())
public CompletableFuture<FetchedValue> fetchValue(ExecutionContext executionContext, Object source, Object localContext, MergedField sameFields, ExecutionStepInfo executionInfo) { Field field = sameFields.getSingleField(); GraphQLFieldDefinition fieldDef = executionInfo.getFieldDefinition(); GraphQLCodeRegistry codeRegistry = executionContext.getGraphQLSchema().getCodeRegistry(); GraphQLFieldsContainer parentType = getFieldsContainer(executionInfo); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(codeRegistry, fieldDef.getArguments(), field.getArguments(), executionContext.getVariables()); GraphQLOutputType fieldType = fieldDef.getType(); DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext, fieldType, sameFields); DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext) .source(source) .localContext(localContext) .arguments(argumentValues) .fieldDefinition(fieldDef) .mergedField(sameFields) .fieldType(fieldType) .executionStepInfo(executionInfo) .parentType(parentType) .selectionSet(fieldCollector) .build(); ExecutionId executionId = executionContext.getExecutionId(); ExecutionPath path = executionInfo.getPath(); return callDataFetcher(codeRegistry, parentType, fieldDef, environment, executionId, path) .thenApply(rawFetchedValue -> FetchedValue.newFetchedValue() .fetchedValue(rawFetchedValue) .rawFetchedValue(rawFetchedValue) .build()) .exceptionally(exception -> handleExceptionWhileFetching(field, path, exception)) .thenApply(result -> unboxPossibleDataFetcherResult(sameFields, path, result, localContext)) .thenApply(this::unboxPossibleOptional); }
fetchMap.put("parentType", executionStepInfo.getParent().getUnwrappedNonNullType().getName()); fetchMap.put("returnType", executionStepInfo.simplePrint()); fetchMap.put("fieldName", executionStepInfo.getFieldDefinition().getName()); fetchMap.put("startOffset", startOffset); fetchMap.put("duration", duration);
private boolean isDataFetcherBatched(ExecutionContext executionContext, ExecutionStepInfo executionStepInfo) { GraphQLFieldsContainer parentType = getFieldsContainer(executionStepInfo); GraphQLFieldDefinition fieldDef = executionStepInfo.getFieldDefinition(); DataFetcher dataFetcher = executionContext.getGraphQLSchema().getCodeRegistry().getDataFetcher(parentType, fieldDef); return dataFetcher instanceof BatchedDataFetcher; }
private String mkMessage(ExecutionPath path, UnresolvedTypeException exception, ExecutionStepInfo info) { return format("Can't resolve '%s'. Abstract type '%s' must resolve to an Object type at runtime for field '%s.%s'. %s", path, exception.getInterfaceOrUnionType().getName(), info.getParent().getUnwrappedNonNullType().getName(), info.getFieldDefinition().getName(), exception.getMessage()); }
GraphQLFieldDefinition fieldDef = parameters.getExecutionStepInfo().getFieldDefinition(); GraphQLObjectType fieldContainer = parameters.getExecutionStepInfo().getFieldContainer();
ExecutionStepInfo newParentExecutionStepInfo = newExecutionStepInfo() .type(curNode.getType()) .fieldDefinition(currentParentExecutionStepInfo.getFieldDefinition()) .field(currentParentExecutionStepInfo.getField()) .path(currentParentExecutionStepInfo.getPath())
public CompletableFuture<FetchedValue> fetchValue(ExecutionContext executionContext, Object source, Object localContext, MergedField sameFields, ExecutionStepInfo executionInfo) { Field field = sameFields.getSingleField(); GraphQLFieldDefinition fieldDef = executionInfo.getFieldDefinition(); GraphQLCodeRegistry codeRegistry = executionContext.getGraphQLSchema().getCodeRegistry(); GraphQLFieldsContainer parentType = getFieldsContainer(executionInfo); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(codeRegistry, fieldDef.getArguments(), field.getArguments(), executionContext.getVariables()); GraphQLOutputType fieldType = fieldDef.getType(); DataFetchingFieldSelectionSet fieldCollector = DataFetchingFieldSelectionSetImpl.newCollector(executionContext, fieldType, sameFields); DataFetchingEnvironment environment = newDataFetchingEnvironment(executionContext) .source(source) .localContext(localContext) .arguments(argumentValues) .fieldDefinition(fieldDef) .mergedField(sameFields) .fieldType(fieldType) .executionStepInfo(executionInfo) .parentType(parentType) .selectionSet(fieldCollector) .build(); ExecutionId executionId = executionContext.getExecutionId(); ExecutionPath path = executionInfo.getPath(); return callDataFetcher(codeRegistry, parentType, fieldDef, environment, executionId, path) .thenApply(rawFetchedValue -> FetchedValue.newFetchedValue() .fetchedValue(rawFetchedValue) .rawFetchedValue(rawFetchedValue) .build()) .exceptionally(exception -> handleExceptionWhileFetching(field, path, exception)) .thenApply(result -> unboxPossibleDataFetcherResult(sameFields, path, result, localContext)) .thenApply(this::unboxPossibleOptional); }