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



367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/graphql/execution/lookahead.rb', line 367

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