Class: GraphQL::Schema::Union
- Extended by:
- Member::AcceptsDefinition
- Defined in:
- lib/graphql/schema/union.rb
Constant Summary
Constants included from Member::GraphQLTypeNames
Member::GraphQLTypeNames::Boolean, Member::GraphQLTypeNames::ID, Member::GraphQLTypeNames::Int
Class Method Summary collapse
-
.kind ⇒ Object
-
.possible_types(*types, context: GraphQL::Query::NullContext, **options) ⇒ Object
-
.to_graphql ⇒ Object
-
.type_membership_class(membership_class = nil) ⇒ Object
Methods included from Member::HasPath
Methods included from Member::RelayShortcuts
#connection_type, #connection_type_class, #edge_type, #edge_type_class
Methods included from Member::Scoped
Methods included from Member::TypeSystemHelpers
#kind, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature
Methods included from Member::BaseDSLMethods
#accessible?, #authorized?, #default_graphql_name, #description, #graphql_name, #introspection, #introspection?, #mutation, #name, #overridden_graphql_name, #to_graphql, #visible?
Methods included from Relay::TypeExtensions
#connection_type, #define_connection, #define_edge, #edge_type
Methods included from Member::CachedGraphQLDefinition
#graphql_definition, #initialize_copy
Class Method Details
.kind ⇒ Object
44 45 46 |
# File 'lib/graphql/schema/union.rb', line 44 def kind GraphQL::TypeKinds::UNION end |
.possible_types(*types, context: GraphQL::Query::NullContext, **options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/graphql/schema/union.rb', line 8 def possible_types(*types, context: GraphQL::Query::NullContext, **) if types.any? types.each do |t| type_memberships << type_membership_class.new(self, t, ) end else visible_types = [] type_memberships.each do |type_membership| if type_membership.visible?(context) visible_types << type_membership.object_type end end visible_types end end |
.to_graphql ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/graphql/schema/union.rb', line 24 def to_graphql type_defn = GraphQL::UnionType.new type_defn.name = graphql_name type_defn.description = description type_defn.type_memberships = type_memberships if respond_to?(:resolve_type) type_defn.resolve_type = method(:resolve_type) end type_defn.[:type_class] = self type_defn end |
.type_membership_class(membership_class = nil) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/graphql/schema/union.rb', line 36 def type_membership_class(membership_class = nil) if membership_class @type_membership_class = membership_class else @type_membership_class || find_inherited_value(:type_membership_class, GraphQL::Schema::TypeMembership) end end |