Method: GraphQL::Schema::Warden#get_type

Defined in:
lib/graphql/schema/warden.rb

#get_type(type_name) ⇒ GraphQL::BaseType?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The type named type_name, if it exists (else nil).

Returns:

  • (GraphQL::BaseType, nil)

    The type named type_name, if it exists (else nil)



254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/graphql/schema/warden.rb', line 254

def get_type(type_name)
  @visible_types ||= read_through do |name|
    type_defn = @schema.get_type(name, @context, false)
    if type_defn && visible_and_reachable_type?(type_defn)
      type_defn
    else
      nil
    end
  end

  @visible_types[type_name]
end