Method: GraphQL::ObjectType#interfaces

Defined in:
lib/graphql/object_type.rb

#interfaces(ctx = GraphQL::Query::NullContext) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/graphql/object_type.rb', line 44

def interfaces(ctx = GraphQL::Query::NullContext)
  ensure_defined
  visible_ifaces = []
  unfiltered = ctx == GraphQL::Query::NullContext
  [@structural_interface_type_memberships, @inherited_interface_type_memberships].each do |tms|
    tms.each do |type_membership|
      if unfiltered || type_membership.visible?(ctx)
        # if this is derived from a class-based object, we have to
        # get the `.graphql_definition` of the attached interface.
        visible_ifaces << GraphQL::BaseType.resolve_related_type(type_membership.abstract_type)
      end
    end
  end

  visible_ifaces
end