Class: GraphQL::Query::SerialExecution::ValueResolution::HasPossibleTypeResolution

Inherits:
BaseResolution
  • Object
show all
Defined in:
lib/graphql/query/serial_execution/value_resolution.rb

Instance Attribute Summary

Attributes inherited from BaseResolution

#ast_field, #execution_context, #field_type, #parent_type, #target, #value

Instance Method Summary collapse

Methods inherited from BaseResolution

#get_strategy_for_kind, #initialize, #result

Constructor Details

This class inherits a constructor from GraphQL::Query::SerialExecution::ValueResolution::BaseResolution

Instance Method Details

#non_null_resultObject



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 56

def non_null_result
  resolved_type = field_type.resolve_type(value, execution_context)

  unless resolved_type.is_a?(GraphQL::ObjectType)
    raise GraphQL::ObjectType::UnresolvedTypeError.new(ast_field.name, field_type, parent_type)
  end

  strategy_class = get_strategy_for_kind(resolved_type.kind)
  inner_strategy = strategy_class.new(value, resolved_type, target, parent_type, ast_field, execution_context)
  inner_strategy.result
end