Method: GraphQL::Schema::Member::HasFields::InterfaceMethods#get_field

Defined in:
lib/graphql/schema/member/has_fields.rb

#get_field(field_name, context = GraphQL::Query::NullContext.instance) ⇒ Object

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.



187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/graphql/schema/member/has_fields.rb', line 187

def get_field(field_name, context = GraphQL::Query::NullContext.instance)
  warden = Warden.from_context(context)
  skip_visible = context.respond_to?(:types) && context.types.is_a?(GraphQL::Schema::Visibility::Profile)
  for ancestor in ancestors
    if ancestor.respond_to?(:own_fields) &&
        (f_entry = ancestor.own_fields[field_name]) &&
        (skip_visible || (f_entry = Warden.visible_entry?(:visible_field?, f_entry, context, warden)))
      return f_entry
    end
  end
  nil
end