Class: GraphQL::Query::SerialExecution::ValueResolution::NonNullResolution

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

Instance Attribute Summary

Attributes inherited from BaseResolution

#execution_context, #field_type, #irep_node, #parent_type, #target, #value

Instance Method Summary collapse

Methods inherited from BaseResolution

#get_strategy_for_kind, #initialize, #non_null_result

Constructor Details

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

Instance Method Details

#resultObject

Get the "wrapped" type and resolve the value according to that type


90
91
92
93
94
95
96
97
98
99
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 90

def result
  if value.nil? || value.is_a?(GraphQL::ExecutionError)
    raise GraphQL::InvalidNullError.new(parent_type.name, irep_node.definition_name, value)
  else
    wrapped_type = field_type.of_type
    strategy_class = get_strategy_for_kind(wrapped_type.kind)
    inner_strategy = strategy_class.new(value, wrapped_type, target, parent_type, irep_node, execution_context)
    inner_strategy.result
  end
end