Module: GraphQL::Execution::Lookahead::FieldHelpers

Defined in:
lib/graphql/execution/lookahead.rb

Overview

TODO dedup with interpreter

Class Method Summary collapse

Class Method Details

.get_field(schema, owner_type, field_name) ⇒ Object



377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/graphql/execution/lookahead.rb', line 377

def get_field(schema, owner_type, field_name)
  field_defn = owner_type.get_field(field_name)
  field_defn ||= if owner_type == schema.query.type_class && (entry_point_field = schema.introspection_system.entry_point(name: field_name))
    entry_point_field.type_class
  elsif (dynamic_field = schema.introspection_system.dynamic_field(name: field_name))
    dynamic_field.type_class
  else
    nil
  end

  field_defn
end