graphql 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql.rb +31 -41
  3. data/lib/graphql/argument.rb +23 -21
  4. data/lib/graphql/base_type.rb +5 -8
  5. data/lib/graphql/define/assign_argument.rb +5 -2
  6. data/lib/graphql/define/type_definer.rb +2 -1
  7. data/lib/graphql/directive.rb +34 -36
  8. data/lib/graphql/directive/include_directive.rb +3 -7
  9. data/lib/graphql/directive/skip_directive.rb +3 -7
  10. data/lib/graphql/enum_type.rb +78 -76
  11. data/lib/graphql/execution_error.rb +1 -3
  12. data/lib/graphql/field.rb +99 -95
  13. data/lib/graphql/input_object_type.rb +49 -47
  14. data/lib/graphql/interface_type.rb +31 -34
  15. data/lib/graphql/introspection.rb +19 -18
  16. data/lib/graphql/introspection/directive_location_enum.rb +8 -0
  17. data/lib/graphql/introspection/directive_type.rb +1 -3
  18. data/lib/graphql/introspection/field_type.rb +1 -1
  19. data/lib/graphql/introspection/fields_field.rb +1 -1
  20. data/lib/graphql/introspection/introspection_query.rb +1 -3
  21. data/lib/graphql/introspection/possible_types_field.rb +7 -1
  22. data/lib/graphql/introspection/schema_field.rb +13 -9
  23. data/lib/graphql/introspection/type_by_name_field.rb +13 -17
  24. data/lib/graphql/introspection/typename_field.rb +12 -8
  25. data/lib/graphql/language.rb +5 -9
  26. data/lib/graphql/language/lexer.rb +668 -0
  27. data/lib/graphql/language/lexer.rl +149 -0
  28. data/lib/graphql/language/parser.rb +842 -116
  29. data/lib/graphql/language/parser.y +264 -0
  30. data/lib/graphql/language/token.rb +21 -0
  31. data/lib/graphql/list_type.rb +33 -31
  32. data/lib/graphql/non_null_type.rb +33 -31
  33. data/lib/graphql/object_type.rb +52 -55
  34. data/lib/graphql/query.rb +83 -80
  35. data/lib/graphql/query/context.rb +5 -1
  36. data/lib/graphql/query/directive_resolution.rb +16 -0
  37. data/lib/graphql/query/executor.rb +3 -3
  38. data/lib/graphql/query/input_validation_result.rb +17 -15
  39. data/lib/graphql/query/serial_execution.rb +5 -5
  40. data/lib/graphql/query/serial_execution/execution_context.rb +4 -3
  41. data/lib/graphql/query/serial_execution/selection_resolution.rb +19 -21
  42. data/lib/graphql/query/serial_execution/value_resolution.rb +1 -1
  43. data/lib/graphql/query/type_resolver.rb +22 -18
  44. data/lib/graphql/query/variable_validation_error.rb +14 -12
  45. data/lib/graphql/schema.rb +87 -77
  46. data/lib/graphql/schema/each_item_validator.rb +16 -12
  47. data/lib/graphql/schema/field_validator.rb +14 -10
  48. data/lib/graphql/schema/implementation_validator.rb +26 -22
  49. data/lib/graphql/schema/middleware_chain.rb +2 -1
  50. data/lib/graphql/schema/possible_types.rb +34 -0
  51. data/lib/graphql/schema/printer.rb +122 -120
  52. data/lib/graphql/schema/type_expression.rb +1 -0
  53. data/lib/graphql/schema/type_map.rb +3 -10
  54. data/lib/graphql/schema/type_reducer.rb +65 -81
  55. data/lib/graphql/schema/type_validator.rb +45 -41
  56. data/lib/graphql/static_validation.rb +7 -9
  57. data/lib/graphql/static_validation/all_rules.rb +29 -24
  58. data/lib/graphql/static_validation/arguments_validator.rb +39 -35
  59. data/lib/graphql/static_validation/literal_validator.rb +44 -40
  60. data/lib/graphql/static_validation/message.rb +30 -26
  61. data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +15 -11
  62. data/lib/graphql/static_validation/rules/arguments_are_defined.rb +14 -10
  63. data/lib/graphql/static_validation/rules/directives_are_defined.rb +16 -12
  64. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +59 -0
  65. data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +25 -21
  66. data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +28 -24
  67. data/lib/graphql/static_validation/rules/fields_will_merge.rb +84 -80
  68. data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +49 -43
  69. data/lib/graphql/static_validation/rules/fragment_types_exist.rb +22 -17
  70. data/lib/graphql/static_validation/rules/fragments_are_finite.rb +19 -15
  71. data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +25 -20
  72. data/lib/graphql/static_validation/rules/fragments_are_used.rb +36 -23
  73. data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +29 -25
  74. data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +21 -17
  75. data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +79 -70
  76. data/lib/graphql/static_validation/rules/variables_are_input_types.rb +24 -20
  77. data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +122 -119
  78. data/lib/graphql/static_validation/type_stack.rb +138 -129
  79. data/lib/graphql/static_validation/validator.rb +29 -25
  80. data/lib/graphql/type_kinds.rb +42 -40
  81. data/lib/graphql/union_type.rb +22 -16
  82. data/lib/graphql/version.rb +1 -1
  83. data/readme.md +12 -27
  84. data/spec/graphql/base_type_spec.rb +3 -3
  85. data/spec/graphql/directive_spec.rb +10 -18
  86. data/spec/graphql/enum_type_spec.rb +7 -7
  87. data/spec/graphql/execution_error_spec.rb +1 -1
  88. data/spec/graphql/field_spec.rb +14 -13
  89. data/spec/graphql/id_type_spec.rb +6 -6
  90. data/spec/graphql/input_object_type_spec.rb +39 -39
  91. data/spec/graphql/interface_type_spec.rb +16 -32
  92. data/spec/graphql/introspection/directive_type_spec.rb +5 -9
  93. data/spec/graphql/introspection/input_value_type_spec.rb +10 -4
  94. data/spec/graphql/introspection/introspection_query_spec.rb +2 -2
  95. data/spec/graphql/introspection/schema_type_spec.rb +2 -2
  96. data/spec/graphql/introspection/type_type_spec.rb +34 -6
  97. data/spec/graphql/language/parser_spec.rb +299 -105
  98. data/spec/graphql/language/visitor_spec.rb +4 -4
  99. data/spec/graphql/list_type_spec.rb +11 -11
  100. data/spec/graphql/object_type_spec.rb +10 -10
  101. data/spec/graphql/query/arguments_spec.rb +7 -7
  102. data/spec/graphql/query/context_spec.rb +11 -3
  103. data/spec/graphql/query/executor_spec.rb +26 -19
  104. data/spec/graphql/query/serial_execution/execution_context_spec.rb +6 -6
  105. data/spec/graphql/query/serial_execution/value_resolution_spec.rb +2 -2
  106. data/spec/graphql/query/type_resolver_spec.rb +3 -3
  107. data/spec/graphql/query_spec.rb +6 -38
  108. data/spec/graphql/scalar_type_spec.rb +28 -19
  109. data/spec/graphql/schema/field_validator_spec.rb +1 -1
  110. data/spec/graphql/schema/middleware_chain_spec.rb +12 -1
  111. data/spec/graphql/schema/printer_spec.rb +12 -4
  112. data/spec/graphql/schema/rescue_middleware_spec.rb +1 -1
  113. data/spec/graphql/schema/type_expression_spec.rb +2 -2
  114. data/spec/graphql/schema/type_reducer_spec.rb +21 -36
  115. data/spec/graphql/schema/type_validator_spec.rb +9 -9
  116. data/spec/graphql/schema_spec.rb +1 -1
  117. data/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +4 -4
  118. data/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb +4 -4
  119. data/spec/graphql/static_validation/rules/directives_are_defined_spec.rb +5 -5
  120. data/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb +39 -0
  121. data/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb +5 -5
  122. data/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +4 -4
  123. data/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +2 -2
  124. data/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb +1 -1
  125. data/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb +2 -2
  126. data/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb +2 -2
  127. data/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb +2 -2
  128. data/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +3 -3
  129. data/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +3 -3
  130. data/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +5 -5
  131. data/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb +3 -1
  132. data/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +4 -4
  133. data/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +3 -3
  134. data/spec/graphql/static_validation/type_stack_spec.rb +3 -2
  135. data/spec/graphql/static_validation/validator_spec.rb +26 -6
  136. data/spec/graphql/union_type_spec.rb +5 -4
  137. data/spec/spec_helper.rb +2 -5
  138. data/spec/support/dairy_app.rb +30 -9
  139. data/spec/support/dairy_data.rb +1 -1
  140. data/spec/support/star_wars_data.rb +26 -26
  141. data/spec/support/star_wars_schema.rb +1 -1
  142. metadata +40 -21
  143. data/lib/graphql/language/transform.rb +0 -113
  144. data/lib/graphql/query/directive_chain.rb +0 -44
  145. data/lib/graphql/repl.rb +0 -27
  146. data/spec/graphql/language/transform_spec.rb +0 -156
@@ -11,9 +11,7 @@ module GraphQL
11
11
  hash = {
12
12
  "message" => message,
13
13
  }
14
- if ast_node.nil?
15
- hash["locations"] = []
16
- else
14
+ if ast_node
17
15
  hash["locations"] = [
18
16
  {
19
17
  "line" => ast_node.line,
@@ -1,111 +1,115 @@
1
- # {Field}s belong to {ObjectType}s and {InterfaceType}s.
2
- #
3
- # They're usually created with the `field` helper. If you create it by hand, make sure {#name} is a String.
4
- #
5
- #
6
- # @example creating a field
7
- # GraphQL::ObjectType.define do
8
- # field :name, types.String, "The name of this thing "
9
- # end
10
- #
11
- # @example handling a circular reference
12
- # # If the field's type isn't defined yet, you have two options:
13
- #
14
- # GraphQL::ObjectType.define do
15
- # # If you pass a Proc, it will be evaluated at schema build-time
16
- # field :city, -> { CityType }
17
- # # If you pass a String, it will be looked up in the global namespace at schema build-time
18
- # field :country, "CountryType"
19
- # end
20
- #
21
- # @example creating a field that accesses a different property on the object
22
- # GraphQL::ObjectType.define do
23
- # # use the `property` option:
24
- # field :firstName, types.String, property: :first_name
25
- # end
26
- #
27
- # @example defining a field, then attaching it to a type
28
- # name_field = GraphQL::Field.define do
29
- # name("Name")
30
- # type(!types.String)
31
- # description("The name of this thing")
32
- # resolve -> (object, arguments, context) { object.name }
33
- # end
34
- #
35
- # NamedType = GraphQL::ObjectType.define do
36
- # # use the `field` option:
37
- # field :name, field: name_field
38
- # end
39
- #
40
- class GraphQL::Field
41
- include GraphQL::Define::InstanceDefinable
42
- accepts_definitions :name, :description, :resolve, :type, :property, :deprecation_reason, argument: GraphQL::Define::AssignArgument
1
+ module GraphQL
2
+ # {Field}s belong to {ObjectType}s and {InterfaceType}s.
3
+ #
4
+ # They're usually created with the `field` helper. If you create it by hand, make sure {#name} is a String.
5
+ #
6
+ #
7
+ # @example creating a field
8
+ # GraphQL::ObjectType.define do
9
+ # field :name, types.String, "The name of this thing "
10
+ # end
11
+ #
12
+ # @example handling a circular reference
13
+ # # If the field's type isn't defined yet, you have two options:
14
+ #
15
+ # GraphQL::ObjectType.define do
16
+ # # If you pass a Proc, it will be evaluated at schema build-time
17
+ # field :city, -> { CityType }
18
+ # # If you pass a String, it will be looked up in the global namespace at schema build-time
19
+ # field :country, "CountryType"
20
+ # end
21
+ #
22
+ # @example creating a field that accesses a different property on the object
23
+ # GraphQL::ObjectType.define do
24
+ # # use the `property` option:
25
+ # field :firstName, types.String, property: :first_name
26
+ # end
27
+ #
28
+ # @example defining a field, then attaching it to a type
29
+ # name_field = GraphQL::Field.define do
30
+ # name("Name")
31
+ # type(!types.String)
32
+ # description("The name of this thing")
33
+ # resolve -> (object, arguments, context) { object.name }
34
+ # end
35
+ #
36
+ # NamedType = GraphQL::ObjectType.define do
37
+ # # use the `field` option:
38
+ # field :name, field: name_field
39
+ # end
40
+ #
41
+ class Field
42
+ include GraphQL::Define::InstanceDefinable
43
+ accepts_definitions :name, :description, :resolve, :type, :property, :deprecation_reason, argument: GraphQL::Define::AssignArgument
43
44
 
44
- attr_accessor :deprecation_reason, :name, :description, :type, :property
45
- attr_reader :resolve_proc
45
+ attr_accessor :deprecation_reason, :name, :description, :type, :property
46
+ attr_reader :resolve_proc
46
47
 
47
- # @return [String] The name of this field on its {GraphQL::ObjectType} (or {GraphQL::InterfaceType})
48
- attr_reader :name
48
+ # @return [String] The name of this field on its {GraphQL::ObjectType} (or {GraphQL::InterfaceType})
49
+ attr_reader :name
49
50
 
50
- # @return [Hash<String, GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
51
- attr_accessor :arguments
51
+ # @return [Hash<String, GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
52
+ attr_accessor :arguments
52
53
 
53
- def initialize
54
- @arguments = {}
55
- @resolve_proc = build_default_resolver
56
- end
54
+ def initialize
55
+ @arguments = {}
56
+ @resolve_proc = build_default_resolver
57
+ end
57
58
 
58
- # Get a value for this field
59
- # @example resolving a field value
60
- # field.resolve(obj, args, ctx)
61
- #
62
- # @param object [Object] The object this field belongs to
63
- # @param arguments [Hash] Arguments declared in the query
64
- # @param context [GraphQL::Query::Context]
65
- def resolve(object, arguments, context)
66
- @resolve_proc.call(object, arguments, context)
67
- end
59
+ # Get a value for this field
60
+ # @example resolving a field value
61
+ # field.resolve(obj, args, ctx)
62
+ #
63
+ # @param object [Object] The object this field belongs to
64
+ # @param arguments [Hash] Arguments declared in the query
65
+ # @param context [GraphQL::Query::Context]
66
+ def resolve(object, arguments, context)
67
+ @resolve_proc.call(object, arguments, context)
68
+ end
68
69
 
69
- def resolve=(resolve_proc)
70
- @resolve_proc = resolve_proc || build_default_resolver
71
- end
70
+ def resolve=(resolve_proc)
71
+ @resolve_proc = resolve_proc || build_default_resolver
72
+ end
72
73
 
73
- # Get the return type for this field.
74
- def type
75
- case @type
76
- when Proc
77
- # lazy-eval it
78
- @type = @type.call
79
- when String
80
- # Get a constant by this name
81
- @type = Object.const_get(@type)
82
- else
83
- @type
74
+ # Get the return type for this field.
75
+ def type
76
+ case @type
77
+ when Proc
78
+ # lazy-eval it
79
+ @type = @type.call
80
+ when String
81
+ # Get a constant by this name
82
+ @type = Object.const_get(@type)
83
+ else
84
+ @type
85
+ end
84
86
  end
85
- end
86
87
 
87
- # You can only set a field's name _once_ -- this to prevent
88
- # passing the same {Field} to multiple `.field` calls.
89
- #
90
- # This is important because {#name} may be used by {#resolve}.
91
- def name=(new_name)
92
- if @name.nil?
93
- @name = new_name
94
- else
95
- raise("Can't rename an already-named field. (Tried to rename \"#{@name}\" to \"#{new_name}\".) If you're passing a field with the `field:` argument, make sure it's an unused instance of GraphQL::Field.")
88
+ # You can only set a field's name _once_ -- this to prevent
89
+ # passing the same {Field} to multiple `.field` calls.
90
+ #
91
+ # This is important because {#name} may be used by {#resolve}.
92
+ def name=(new_name)
93
+ if !new_name.is_a?(String)
94
+ raise ArgumentError.new("GraphQL field names must be strings; cannot use #{new_name.inspect} (#{new_name.class.name}) as a field name.") unless new_name.is_a?(String)
95
+ elsif @name.nil?
96
+ @name = new_name
97
+ else
98
+ raise("Can't rename an already-named field. (Tried to rename \"#{@name}\" to \"#{new_name}\".) If you're passing a field with the `field:` argument, make sure it's an unused instance of GraphQL::Field.")
99
+ end
96
100
  end
97
- end
98
101
 
99
- def to_s
100
- "<Field: #{name || "not-named"}>"
101
- end
102
+ def to_s
103
+ "<Field: #{name || "not-named"}>"
104
+ end
102
105
 
103
- private
106
+ private
104
107
 
105
- def build_default_resolver
106
- -> (obj, args, ctx) do
107
- resolve_method = self.property || self.name
108
- obj.public_send(resolve_method)
108
+ def build_default_resolver
109
+ -> (obj, args, ctx) do
110
+ resolve_method = self.property || self.name
111
+ obj.public_send(resolve_method)
112
+ end
109
113
  end
110
114
  end
111
115
  end
@@ -1,66 +1,68 @@
1
- # A complex input type for a field argument.
2
- #
3
- # @example An input type with name and number
4
- # PlayerInput = GraphQL::InputObjectType.define do
5
- # name("Player")
6
- # input_field :name, !types.String
7
- # input_field :number, !types.Int
8
- # end
9
- #
10
- class GraphQL::InputObjectType < GraphQL::BaseType
11
- accepts_definitions input_field: GraphQL::Define::AssignArgument
1
+ module GraphQL
2
+ # A complex input type for a field argument.
3
+ #
4
+ # @example An input type with name and number
5
+ # PlayerInput = GraphQL::InputObjectType.define do
6
+ # name("Player")
7
+ # input_field :name, !types.String
8
+ # input_field :number, !types.Int
9
+ # end
10
+ #
11
+ class InputObjectType < GraphQL::BaseType
12
+ accepts_definitions input_field: GraphQL::Define::AssignArgument
12
13
 
13
- # @return [Hash<String, GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
14
- attr_accessor :arguments
14
+ # @return [Hash<String, GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
15
+ attr_accessor :arguments
15
16
 
16
- alias :input_fields :arguments
17
+ alias :input_fields :arguments
17
18
 
18
- def initialize
19
- @arguments = {}
20
- end
19
+ def initialize
20
+ @arguments = {}
21
+ end
21
22
 
22
- def kind
23
- GraphQL::TypeKinds::INPUT_OBJECT
24
- end
23
+ def kind
24
+ GraphQL::TypeKinds::INPUT_OBJECT
25
+ end
25
26
 
26
- def validate_non_null_input(input)
27
- result = GraphQL::Query::InputValidationResult.new
27
+ def validate_non_null_input(input)
28
+ result = GraphQL::Query::InputValidationResult.new
28
29
 
29
- # Items in the input that are unexpected
30
- input.each do |name, value|
31
- if arguments[name].nil?
32
- result.add_problem("Field is not defined on #{self.name}", [name])
30
+ # Items in the input that are unexpected
31
+ input.each do |name, value|
32
+ if arguments[name].nil?
33
+ result.add_problem("Field is not defined on #{self.name}", [name])
34
+ end
33
35
  end
34
- end
35
36
 
36
- # Items in the input that are expected, but have invalid values
37
- invalid_fields = arguments.map do |name, field|
38
- field_result = field.type.validate_input(input[name])
39
- if !field_result.valid?
40
- result.merge_result!(name, field_result)
37
+ # Items in the input that are expected, but have invalid values
38
+ invalid_fields = arguments.map do |name, field|
39
+ field_result = field.type.validate_input(input[name])
40
+ if !field_result.valid?
41
+ result.merge_result!(name, field_result)
42
+ end
41
43
  end
44
+
45
+ result
42
46
  end
43
47
 
44
- result
45
- end
48
+ def coerce_non_null_input(value)
49
+ input_values = {}
46
50
 
47
- def coerce_non_null_input(value)
48
- input_values = {}
51
+ arguments.each do |input_key, input_field_defn|
52
+ field_value = value[input_key]
53
+ field_value = input_field_defn.type.coerce_input(field_value)
49
54
 
50
- arguments.each do |input_key, input_field_defn|
51
- field_value = value[input_key]
52
- field_value = input_field_defn.type.coerce_input(field_value)
55
+ # Try getting the default value
56
+ if field_value.nil?
57
+ field_value = input_field_defn.default_value
58
+ end
53
59
 
54
- # Try getting the default value
55
- if field_value.nil?
56
- field_value = input_field_defn.default_value
60
+ if !field_value.nil?
61
+ input_values[input_key] = field_value
62
+ end
57
63
  end
58
64
 
59
- if !field_value.nil?
60
- input_values[input_key] = field_value
61
- end
65
+ GraphQL::Query::Arguments.new(input_values)
62
66
  end
63
-
64
- GraphQL::Query::Arguments.new(input_values)
65
67
  end
66
68
  end
@@ -1,41 +1,38 @@
1
- # A collection of types which implement the same fields
2
- #
3
- # @example An interface with three required fields
4
- # DeviceInterface = GraphQL::InterfaceType.define do
5
- # name("Device")
6
- # description("Hardware devices for computing")
7
- #
8
- # field :ram, types.String
9
- # field :processor, ProcessorType
10
- # field :release_year, types.Int
11
- # end
12
- #
13
- class GraphQL::InterfaceType < GraphQL::BaseType
14
- include GraphQL::BaseType::HasPossibleTypes
15
- accepts_definitions :resolve_type, field: GraphQL::Define::AssignObjectField
1
+ module GraphQL
2
+ # A collection of types which implement the same fields
3
+ #
4
+ # @example An interface with three required fields
5
+ # DeviceInterface = GraphQL::InterfaceType.define do
6
+ # name("Device")
7
+ # description("Hardware devices for computing")
8
+ #
9
+ # field :ram, types.String
10
+ # field :processor, ProcessorType
11
+ # field :release_year, types.Int
12
+ # end
13
+ #
14
+ class InterfaceType < GraphQL::BaseType
15
+ include GraphQL::BaseType::HasPossibleTypes
16
+ accepts_definitions :resolve_type, field: GraphQL::Define::AssignObjectField
16
17
 
17
- attr_accessor :fields
18
+ attr_accessor :fields
18
19
 
19
- def initialize
20
- @fields = {}
21
- end
20
+ def initialize
21
+ @fields = {}
22
+ end
22
23
 
23
- def kind
24
- GraphQL::TypeKinds::INTERFACE
25
- end
24
+ def kind
25
+ GraphQL::TypeKinds::INTERFACE
26
+ end
26
27
 
27
- # @return [Array<GraphQL::ObjectType>] Types which declare that they implement this interface
28
- def possible_types
29
- @possible_types ||= []
30
- end
31
-
32
- # @return [GraphQL::Field] The defined field for `field_name`
33
- def get_field(field_name)
34
- fields[field_name]
35
- end
28
+ # @return [GraphQL::Field] The defined field for `field_name`
29
+ def get_field(field_name)
30
+ fields[field_name]
31
+ end
36
32
 
37
- # @return [Array<GraphQL::Field>] All fields on this type
38
- def all_fields
39
- fields.values
33
+ # @return [Array<GraphQL::Field>] All fields on this type
34
+ def all_fields
35
+ fields.values
36
+ end
40
37
  end
41
38
  end
@@ -3,24 +3,25 @@ module GraphQL
3
3
  end
4
4
  end
5
5
 
6
- require 'graphql/introspection/typename_field'
7
- require 'graphql/introspection/input_value_type'
8
- require 'graphql/introspection/enum_value_type'
9
- require 'graphql/introspection/type_kind_enum'
6
+ require "graphql/introspection/typename_field"
7
+ require "graphql/introspection/input_value_type"
8
+ require "graphql/introspection/enum_value_type"
9
+ require "graphql/introspection/type_kind_enum"
10
10
 
11
- require 'graphql/introspection/fields_field'
12
- require 'graphql/introspection/of_type_field'
13
- require 'graphql/introspection/input_fields_field'
14
- require 'graphql/introspection/possible_types_field'
15
- require 'graphql/introspection/enum_values_field'
16
- require 'graphql/introspection/interfaces_field'
11
+ require "graphql/introspection/fields_field"
12
+ require "graphql/introspection/of_type_field"
13
+ require "graphql/introspection/input_fields_field"
14
+ require "graphql/introspection/possible_types_field"
15
+ require "graphql/introspection/enum_values_field"
16
+ require "graphql/introspection/interfaces_field"
17
17
 
18
- require 'graphql/introspection/type_type'
19
- require 'graphql/introspection/arguments_field'
20
- require 'graphql/introspection/field_type'
18
+ require "graphql/introspection/type_type"
19
+ require "graphql/introspection/arguments_field"
20
+ require "graphql/introspection/field_type"
21
21
 
22
- require 'graphql/introspection/directive_type'
23
- require 'graphql/introspection/schema_type'
24
- require 'graphql/introspection/schema_field'
25
- require 'graphql/introspection/type_by_name_field'
26
- require 'graphql/introspection/introspection_query'
22
+ require "graphql/introspection/directive_location_enum"
23
+ require "graphql/introspection/directive_type"
24
+ require "graphql/introspection/schema_type"
25
+ require "graphql/introspection/schema_field"
26
+ require "graphql/introspection/type_by_name_field"
27
+ require "graphql/introspection/introspection_query"