Search in sources :

Example 1 with UnresolvedTypeException

use of graphql.execution.UnresolvedTypeException in project graphql-java by graphql-java.

the class FetchedValueAnalyzer method analyzeFetchedValueImpl.

private FetchedValueAnalysis analyzeFetchedValueImpl(ExecutionContext executionContext, FetchedValue fetchedValue, Object toAnalyze, ExecutionStepInfo executionInfo) throws NonNullableFieldWasNullException {
    GraphQLType fieldType = executionInfo.getUnwrappedNonNullType();
    MergedField field = executionInfo.getField();
    if (isList(fieldType)) {
        return analyzeList(executionContext, fetchedValue, toAnalyze, executionInfo);
    } else if (fieldType instanceof GraphQLScalarType) {
        return analyzeScalarValue(fetchedValue, toAnalyze, (GraphQLScalarType) fieldType, executionInfo);
    } else if (fieldType instanceof GraphQLEnumType) {
        return analyzeEnumValue(fetchedValue, toAnalyze, (GraphQLEnumType) fieldType, executionInfo);
    }
    // 
    if (toAnalyze == null) {
        return newFetchedValueAnalysis(OBJECT).fetchedValue(fetchedValue).executionStepInfo(executionInfo).nullValue().build();
    }
    try {
        GraphQLObjectType resolvedObjectType = resolveType.resolveType(executionContext, field, toAnalyze, executionInfo, fieldType, fetchedValue.getLocalContext());
        return newFetchedValueAnalysis(OBJECT).fetchedValue(fetchedValue).executionStepInfo(executionInfo).completedValue(toAnalyze).resolvedType(resolvedObjectType).build();
    } catch (UnresolvedTypeException ex) {
        return handleUnresolvedTypeProblem(fetchedValue, executionInfo, ex);
    }
}
Also used : GraphQLEnumType(graphql.schema.GraphQLEnumType) MergedField(graphql.execution.MergedField) GraphQLType(graphql.schema.GraphQLType) GraphQLObjectType(graphql.schema.GraphQLObjectType) UnresolvedTypeException(graphql.execution.UnresolvedTypeException) GraphQLScalarType(graphql.schema.GraphQLScalarType)

Aggregations

MergedField (graphql.execution.MergedField)1 UnresolvedTypeException (graphql.execution.UnresolvedTypeException)1 GraphQLEnumType (graphql.schema.GraphQLEnumType)1 GraphQLObjectType (graphql.schema.GraphQLObjectType)1 GraphQLScalarType (graphql.schema.GraphQLScalarType)1 GraphQLType (graphql.schema.GraphQLType)1