module GraphQL::Query::Context::SharedMethods
Attributes
@return [Object] The target for field resultion
@return [Boolean] were any fields of this selection skipped?
@return [Boolean] were any fields of this selection skipped?
@return [Hash, Array, String, Integer, Float, Boolean, nil] The resolved value for this field
Public Instance Methods
Add error at query-level. @param error [GraphQL::ExecutionError] an execution error @return [void]
# File lib/graphql/query/context.rb, line 57 def add_error(error) if !error.is_a?(ExecutionError) raise TypeError, "expected error to be a ExecutionError, but was #{error.class}" end errors << error nil end
@example Print the GraphQL backtrace during field resolution
puts ctx.backtrace
@return [GraphQL::Backtrace] The backtrace for this point in query execution
# File lib/graphql/query/context.rb, line 69 def backtrace GraphQL::Backtrace.new(self) end
Remove this child from the result value (used for null propagation and skip) @api private
# File lib/graphql/query/context.rb, line 36 def delete(child_ctx) @value.delete(child_ctx.key) end
# File lib/graphql/query/context.rb, line 73 def execution_errors @execution_errors ||= ExecutionErrors.new(self) end
@return [Boolean] True if this selection has been nullified by a null child
# File lib/graphql/query/context.rb, line 29 def invalid_null? @invalid_null end
Return this value to tell the runtime to exclude this field from the response altogether
# File lib/graphql/query/context.rb, line 24 def skip GraphQL::Execution::Execute::SKIP end
Create a child context to use for `key` @param key [String, Integer] The key in the response (name or index) @param irep_node [InternalRepresentation::Node] The node being evaluated @api private
# File lib/graphql/query/context.rb, line 44 def spawn_child(key,, irep_node,, object)) FieldResolutionContext.new( context: @context, parent: self, object: object, key: key, irep_node: irep_node, ) end