Method: GraphQL::Query#resolve_type

Defined in:
lib/graphql/query.rb

#resolve_type(abstract_type, value = :__undefined__) ⇒ GraphQL::ObjectType?

Returns The runtime type of value from Schema.resolve_type.

Parameters:

  • abstract_type (GraphQL::UnionType, GraphQL::InterfaceType)
  • value (Object) (defaults to: :__undefined__)

    Any runtime value

Returns:

See Also:

  • to apply filtering from `only` / `except`


299
300
301
302
303
304
305
306
307
308
309
# File 'lib/graphql/query.rb', line 299

def resolve_type(abstract_type, value = :__undefined__)
  if value.is_a?(Symbol) && value == :__undefined__
    # Old method signature
    value = abstract_type
    abstract_type = nil
  end
  if value.is_a?(GraphQL::Schema::Object)
    value = value.object
  end
  @resolved_types_cache[abstract_type][value]
end