Class: GraphQL::Client::Schema::UnionType

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Module
Instance Chain:
self, BaseType, Module
Inherits: Module
  • Object
Defined in: lib/graphql/client/schema/union_type.rb

Class Method Summary

Instance Attribute Summary

BaseType - Included


Internal: Get owner schema Module container.


Public: Get associated GraphQL::BaseType with for this class.

Instance Method Summary

BaseType - Included


Internal: Cast JSON value to wrapped value.


Internal: Get list wrapper of this type class.


Internal: Get non-nullable wrapper of this type class.

Constructor Details

.new(type) ⇒ UnionType

[ GitHub ]

# File 'lib/graphql/client/schema/union_type.rb', line 11

def initialize(type)
  unless type.kind.union?
    raise "expected type to be a Union, but was #{type.class}"

  @type = type

Instance Method Details

#define_class(definition, ast_nodes)

[ GitHub ]

# File 'lib/graphql/client/schema/union_type.rb', line 23

def define_class(definition, ast_nodes)
  possible_type_names = definition.client.possible_types(type).map(&:graphql_name)
  possible_types = possible_type_names.map { |concrete_type_name|
    schema_module.get_class(concrete_type_name).define_class(definition, ast_nodes)


[ GitHub ]

# File 'lib/graphql/client/schema/union_type.rb', line 19

def new(types)
  PossibleTypes.new(type, types)