Module: GraphQL::Schema::ResolveTypeWithType
- Defined in:
- lib/graphql/schema.rb
Overview
rubocop:disable Lint/DuplicateMethods
Instance Method Summary collapse
Instance Method Details
#resolve_type(type, obj, ctx) ⇒ Object
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 |
# File 'lib/graphql/schema.rb', line 1447 def resolve_type(type, obj, ctx) first_resolved_type, resolved_value = if type.is_a?(Module) && type.respond_to?(:resolve_type) type.resolve_type(obj, ctx) else super end after_lazy(first_resolved_type) do |resolved_type| if resolved_type.nil? || (resolved_type.is_a?(Module) && resolved_type.respond_to?(:kind)) || resolved_type.is_a?(GraphQL::BaseType) if resolved_value [resolved_type, resolved_value] else resolved_type end else raise ".resolve_type should return a type definition, but got #{resolved_type.inspect} (#{resolved_type.class}) from `resolve_type(#{type}, #{obj}, #{ctx})`" end end end |