Method: GraphQL::Schema::Member::HasFields::ObjectMethods#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.
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/graphql/schema/member/has_fields.rb', line 218 def get_field(field_name, context = GraphQL::Query::NullContext.instance) # Objects need to check that the interface implementation is visible, too warden = Warden.from_context(context) ancs = ancestors skip_visible = context.respond_to?(:types) && context.types.is_a?(GraphQL::Schema::Visibility::Profile) i = 0 while (ancestor = ancs[i]) if ancestor.respond_to?(:own_fields) && visible_interface_implementation?(ancestor, context, warden) && (f_entry = ancestor.own_fields[field_name]) && (skip_visible || (f_entry = Warden.visible_entry?(:visible_field?, f_entry, context, warden))) return (skip_visible ? f_entry : f_entry.ensure_loaded) end i += 1 end nil end |