lib/graphql/execution/execute.rb in graphql-1.6.2 vs lib/graphql/execution/execute.rb in graphql-1.6.3
- old
+ new
@@ -2,13 +2,19 @@
module GraphQL
module Execution
# A valid execution strategy
# @api private
class Execute
+
# @api private
- SKIP = Object.new
+ class Skip; end
+
+ # Just a singleton for implementing {Query::Context#skip}
# @api private
+ SKIP = Skip.new
+
+ # @api private
PROPAGATE_NULL = Object.new
def execute(ast_operation, root_type, query)
result = resolve_selection(
query.root_value,
@@ -38,11 +44,11 @@
subselection.definition,
object,
query_ctx
)
- if field_result == SKIP
+ if field_result.is_a?(Skip)
next
end
if mutation
GraphQL::Execution::Lazy.resolve(field_result)
@@ -101,10 +107,13 @@
result
end
end
def continue_resolve_field(owner, selection, parent_type, field, raw_value, field_ctx)
+ if owner.invalid_null?
+ return
+ end
query = field_ctx.query
case raw_value
when GraphQL::ExecutionError
raw_value.ast_node = field_ctx.ast_node
@@ -145,10 +154,10 @@
if field_type.kind.non_null?
PROPAGATE_NULL
else
nil
end
- elsif value == SKIP
+ elsif value.is_a?(Skip)
value
else
case field_type.kind
when GraphQL::TypeKinds::SCALAR
field_type.coerce_result(value, field_ctx)