Class: GraphQL::Schema::IntrospectionSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema/introspection_system.rb

Defined Under Namespace

Classes: PerFieldProxyResolve

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ IntrospectionSystem

Returns a new instance of IntrospectionSystem



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/graphql/schema/introspection_system.rb', line 7

def initialize(schema)
  @schema = schema
  @built_in_namespace = GraphQL::Introspection
  @custom_namespace = schema.introspection_namespace || @built_in_namespace

  # Use to-graphql to avoid sharing with any previous instantiations
  @schema_type = load_constant(:SchemaType).to_graphql
  @type_type = load_constant(:TypeType).to_graphql
  @field_type = load_constant(:FieldType).to_graphql
  @directive_type = load_constant(:DirectiveType).to_graphql
  @enum_value_type = load_constant(:EnumValueType).to_graphql
  @input_value_type = load_constant(:InputValueType).to_graphql
  @type_kind_enum = load_constant(:TypeKindEnum).to_graphql
  @directive_location_enum = load_constant(:DirectiveLocationEnum).to_graphql
  @entry_point_fields =
    if schema.disable_introspection_entry_points
      {}
    else
      get_fields_from_class(class_sym: :EntryPoints)
    end
  @dynamic_fields = get_fields_from_class(class_sym: :DynamicFields)
end

Instance Attribute Details

#schema_typeObject (readonly)

Returns the value of attribute schema_type



5
6
7
# File 'lib/graphql/schema/introspection_system.rb', line 5

def schema_type
  @schema_type
end

#type_typeObject (readonly)

Returns the value of attribute type_type



5
6
7
# File 'lib/graphql/schema/introspection_system.rb', line 5

def type_type
  @type_type
end

#typename_fieldObject (readonly)

Returns the value of attribute typename_field



5
6
7
# File 'lib/graphql/schema/introspection_system.rb', line 5

def typename_field
  @typename_field
end

Instance Method Details

#dynamic_field(name:) ⇒ Object



55
56
57
# File 'lib/graphql/schema/introspection_system.rb', line 55

def dynamic_field(name:)
  @dynamic_fields[name]
end

#dynamic_fieldsObject



51
52
53
# File 'lib/graphql/schema/introspection_system.rb', line 51

def dynamic_fields
  @dynamic_fields.values
end

#entry_point(name:) ⇒ Object



47
48
49
# File 'lib/graphql/schema/introspection_system.rb', line 47

def entry_point(name:)
  @entry_point_fields[name]
end

#entry_pointsObject



43
44
45
# File 'lib/graphql/schema/introspection_system.rb', line 43

def entry_points
  @entry_point_fields.values
end

#object_typesObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/graphql/schema/introspection_system.rb', line 30

def object_types
  [
    @schema_type,
    @type_type,
    @field_type,
    @directive_type,
    @enum_value_type,
    @input_value_type,
    @type_kind_enum,
    @directive_location_enum,
  ]
end