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

#ast_field, #execution_context, #field_type, #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



83
84
85
86
87
88
89
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 83

def result
  raise GraphQL::InvalidNullError.new(ast_field.name, value) if value.nil? || value.is_a?(GraphQL::ExecutionError)
  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, ast_field, execution_context)
  inner_strategy.result
end