graphql 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/lib/graphql/execution/execute.rb +3 -0
  3. data/lib/graphql/execution/interpreter/runtime.rb +2 -2
  4. data/lib/graphql/execution/lookahead.rb +57 -22
  5. data/lib/graphql/introspection/input_value_type.rb +5 -1
  6. data/lib/graphql/language/parser.rb +57 -54
  7. data/lib/graphql/language/parser.y +12 -9
  8. data/lib/graphql/language/token.rb +1 -1
  9. data/lib/graphql/language/visitor.rb +1 -1
  10. data/lib/graphql/query/arguments.rb +3 -3
  11. data/lib/graphql/query/context.rb +6 -6
  12. data/lib/graphql/query/variable_validation_error.rb +14 -0
  13. data/lib/graphql/schema.rb +2 -2
  14. data/lib/graphql/schema/argument.rb +1 -1
  15. data/lib/graphql/schema/field.rb +6 -3
  16. data/lib/graphql/schema/object.rb +2 -2
  17. data/lib/graphql/schema/relay_classic_mutation.rb +1 -1
  18. data/lib/graphql/schema/rescue_middleware.rb +7 -2
  19. data/lib/graphql/schema/validation.rb +9 -4
  20. data/lib/graphql/static_validation/base_visitor.rb +8 -5
  21. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +3 -1
  22. data/lib/graphql/tracing.rb +3 -3
  23. data/lib/graphql/types.rb +1 -0
  24. data/lib/graphql/types/json.rb +25 -0
  25. data/lib/graphql/types/relay/base_edge.rb +3 -2
  26. data/lib/graphql/unauthorized_field_error.rb +1 -1
  27. data/lib/graphql/version.rb +1 -1
  28. data/spec/dummy/Gemfile.lock +157 -0
  29. data/spec/dummy/log/test.log +199 -0
  30. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4w/4wzXRZrAkwKdgYaSE0pid5eB-fer8vSfSku_NPg4rMA.cache +0 -0
  31. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7I/7IHVBiJT06QSpgLpLoJIxboQ0B-D_tMTxsvoezBTV3Q.cache +1 -0
  32. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache +1 -0
  33. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AK/AKzz1u6bGb4auXcrObA_g5LL-oV0ejNGa448AgAi_WQ.cache +1 -0
  34. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ET/ETW4uxvaYpruL8y6_ZptUH82ZowMaHIqvg5WexBFdEM.cache +3 -0
  35. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F1/F1TWpjjyA56k9Z90n5B3xRn7DUdGjX73QCkYC6k07JQ.cache +0 -0
  36. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8MUNRzORGFgr329fNM0xLaoWCXdv3BIalT7dsvLfjs.cache +2 -0
  37. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KB/KB07ZaKNC5uXJ7TjLi-WqnY6g7dq8wWp_8N3HNjBNxg.cache +2 -0
  38. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ms/MsKSimH_UCB-H1tLvDABDHuvGciuoW6kVqQWDrXU5FQ.cache +0 -0
  39. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mt/Mtci-Kim50aPOmeClD4AIicKn1d1WJ0n454IjSd94sk.cache +0 -0
  40. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QH/QHt3Tc1Y6M66Oo_pDuMyWrQNs4Pp3SMeZR5K1wJj2Ts.cache +1 -0
  41. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XU/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache +0 -0
  42. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ZI/ZIof7mZxWWCnraIFOCuV6a8QRWzKJXJnx2Xd7C0ZyX0.cache +1 -0
  43. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cG/cGc_puuPS5pZKgUcy1Y_i1L6jl5UtsiIrMH59rTzR6c.cache +3 -0
  44. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/df/dfro_B6bx3KP1Go-7jEOqqZ2j4hVRseXIc3es9PKQno.cache +1 -0
  45. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jO/jO1DfbqnG0mTULsjJJANc3fefrG2zt7DIMmcptMT628.cache +1 -0
  46. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r9/r9iU1l58a6rxkZSW5RSC52_tD-_UQuHxoMVnkfJ7Mhs.cache +1 -0
  48. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xi/xitPPFfPIyDMpaznV0sBBcw8eSCV8PJcLLWin78sCgE.cache +0 -0
  49. data/spec/dummy/tmp/screenshots/failures_test_it_handles_subscriptions.png +0 -0
  50. data/spec/graphql/authorization_spec.rb +47 -14
  51. data/spec/graphql/execution/lookahead_spec.rb +29 -2
  52. data/spec/graphql/function_spec.rb +28 -5
  53. data/spec/graphql/introspection/input_value_type_spec.rb +40 -1
  54. data/spec/graphql/language/parser_spec.rb +8 -0
  55. data/spec/graphql/query/executor_spec.rb +30 -3
  56. data/spec/graphql/schema/object_spec.rb +71 -0
  57. data/spec/graphql/schema/relay_classic_mutation_spec.rb +18 -0
  58. data/spec/graphql/schema/rescue_middleware_spec.rb +14 -0
  59. data/spec/graphql/schema/warden_spec.rb +1 -1
  60. data/spec/graphql/types/relay/base_edge_spec.rb +33 -0
  61. data/spec/integration/rails/graphql/schema_spec.rb +13 -0
  62. data/spec/integration/tmp/app/graphql/types/bird_type.rb +7 -0
  63. data/spec/support/dummy/schema.rb +19 -0
  64. data/spec/support/jazz.rb +16 -14
  65. metadata +57 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c4a10bf3dce4841a53a78308eab58db972aeeb6daade67cf019a45ad48d2c1f6
4
- data.tar.gz: ca20d0a586c0076ee47b65c09e12a39d8c52b2db4a4c232cf9d1fee95202280c
2
+ SHA1:
3
+ metadata.gz: e40125b3e84f5cd17820a8268ad2874ae7c980dc
4
+ data.tar.gz: bd888bd788b3da91473d5dbaa8a298cf89770cf7
5
5
  SHA512:
6
- metadata.gz: c3ebc480c7e4c209b319f382aae6eed1f0d1c61c6886ad620950b51dc457863f9da1af8d451f382a22a467230daa95c5d8a28fd86d1bde22f499aa9a797d6f75
7
- data.tar.gz: 86655364098750c3430395b637def8952a1bdb5082643ebe74fb0110d04114411f9077539621cd50c38ff151c64eb54c275ae0b23f248ac27a99f75e356f918d
6
+ metadata.gz: 7a9113377e811baf0011f17fbef343eafe2151d61d9ad3a26c0d6a422590e0e3e19ed0545531ec3f3ea84653534a21e66a34d006214218c52128a557bfb06b75
7
+ data.tar.gz: cee421d5d91cd63b880ba88324a840125bc20cf6e6976b85f52cdcd2bfea1c703a58c7fda50ece82aa77c0b1943fc4fa2514bba995e4a78bb4e4d6dc877c158d
@@ -128,6 +128,9 @@ module GraphQL
128
128
  field_ctx.trace("execute_field", { context: field_ctx }) do
129
129
  field_ctx.schema.middleware.invoke([parent_type, object, field, arguments, field_ctx])
130
130
  end
131
+ rescue GraphQL::UnauthorizedFieldError => err
132
+ err.field ||= field
133
+ field_ctx.schema.unauthorized_field(err)
131
134
  rescue GraphQL::UnauthorizedError => err
132
135
  field_ctx.schema.unauthorized_object(err)
133
136
  end
@@ -205,7 +205,7 @@ module GraphQL
205
205
 
206
206
  field_result = resolve_with_directives(object, ast_node) do
207
207
  # Actually call the field resolver and capture the result
208
- app_result = query.trace("execute_field", {owner: owner_type, field: field_defn, path: next_path}) do
208
+ app_result = query.trace("execute_field", {owner: owner_type, field: field_defn, path: next_path, query: query}) do
209
209
  field_defn.resolve(object, kwarg_arguments, context)
210
210
  end
211
211
  after_lazy(app_result, owner: owner_type, field: field_defn, path: next_path) do |inner_result|
@@ -398,7 +398,7 @@ module GraphQL
398
398
  @interpreter_context[:current_field] = field
399
399
  # Wrap the execution of _this_ method with tracing,
400
400
  # but don't wrap the continuation below
401
- inner_obj = query.trace("execute_field_lazy", {owner: owner, field: field, path: path}) do
401
+ inner_obj = query.trace("execute_field_lazy", {owner: owner, field: field, path: path, query: query}) do
402
402
  begin
403
403
  schema.sync_lazy(obj)
404
404
  rescue GraphQL::ExecutionError, GraphQL::UnauthorizedError => err
@@ -31,12 +31,13 @@ module GraphQL
31
31
  # @param ast_nodes [Array<GraphQL::Language::Nodes::Field>, Array<GraphQL::Language::Nodes::OperationDefinition>]
32
32
  # @param field [GraphQL::Schema::Field] if `ast_nodes` are fields, this is the field definition matching those nodes
33
33
  # @param root_type [Class] if `ast_nodes` are operation definition, this is the root type for that operation
34
- def initialize(query:, ast_nodes:, field: nil, root_type: nil)
34
+ def initialize(query:, ast_nodes:, field: nil, root_type: nil, owner_type: nil)
35
35
  @ast_nodes = ast_nodes.freeze
36
36
  @field = field
37
37
  @root_type = root_type
38
38
  @query = query
39
39
  @selected_type = @field ? @field.type.unwrap : root_type
40
+ @owner_type = owner_type
40
41
  end
41
42
 
42
43
  # @return [Array<GraphQL::Language::Nodes::Field>]
@@ -45,6 +46,14 @@ module GraphQL
45
46
  # @return [GraphQL::Schema::Field]
46
47
  attr_reader :field
47
48
 
49
+ # @return [GraphQL::Schema::Object, GraphQL::Schema::Union, GraphQL::Schema::Interface]
50
+ attr_reader :owner_type
51
+
52
+ # @return [Hash<Symbol, Object>]
53
+ def arguments
54
+ @arguments ||= @field && ArgumentHelpers.arguments(@query, nil, @field, ast_nodes.first)
55
+ end
56
+
48
57
  # True if this node has a selection on `field_name`.
49
58
  # If `field_name` is a String, it is treated as a GraphQL-style (camelized)
50
59
  # field name and used verbatim. If `field_name` is a Symbol, it is
@@ -82,7 +91,7 @@ module GraphQL
82
91
  end
83
92
 
84
93
  if next_nodes.any?
85
- Lookahead.new(query: @query, ast_nodes: next_nodes, field: next_field_defn)
94
+ Lookahead.new(query: @query, ast_nodes: next_nodes, field: next_field_defn, owner_type: selected_type)
86
95
  else
87
96
  NULL_LOOKAHEAD
88
97
  end
@@ -107,13 +116,24 @@ module GraphQL
107
116
  # @param arguments [Hash] Arguments which must match in the selection
108
117
  # @return [Array<GraphQL::Execution::Lookahead>]
109
118
  def selections(arguments: nil)
110
- subselections_by_name = {}
119
+ subselections_by_type = {}
120
+ subselections_on_type = subselections_by_type[@selected_type] = {}
121
+
111
122
  @ast_nodes.each do |node|
112
- find_selections(subselections_by_name, @selected_type, node.selections, arguments)
123
+ find_selections(subselections_by_type, subselections_on_type, @selected_type, node.selections, arguments)
113
124
  end
114
125
 
115
- # Items may be filtered out if `arguments` doesn't match
116
- subselections_by_name.values.select(&:selected?)
126
+ subselections = []
127
+
128
+ subselections_by_type.each do |type, ast_nodes_by_response_key|
129
+ ast_nodes_by_response_key.each do |response_key, ast_nodes|
130
+ field_defn = FieldHelpers.get_field(@query.schema, type, ast_nodes.first.name)
131
+ lookahead = Lookahead.new(query: @query, ast_nodes: ast_nodes, field: field_defn, owner_type: type)
132
+ subselections.push(lookahead)
133
+ end
134
+ end
135
+
136
+ subselections
117
137
  end
118
138
 
119
139
  # The method name of the field.
@@ -183,22 +203,36 @@ module GraphQL
183
203
  end
184
204
  end
185
205
 
186
- def find_selections(subselections_by_name, selected_type, ast_selections, arguments)
206
+ def find_selections(subselections_by_type, selections_on_type, selected_type, ast_selections, arguments)
187
207
  ast_selections.each do |ast_selection|
188
208
  case ast_selection
189
209
  when GraphQL::Language::Nodes::Field
190
- subselections_by_name[ast_selection.name] ||= selection(ast_selection.name, selected_type: selected_type, arguments: arguments)
210
+ response_key = ast_selection.alias || ast_selection.name
211
+ if selections_on_type.key?(response_key)
212
+ selections_on_type[response_key] << ast_selection
213
+ elsif arguments.nil? || arguments.empty?
214
+ selections_on_type[response_key] = [ast_selection]
215
+ else
216
+ field_defn = FieldHelpers.get_field(@query.schema, selected_type, ast_selection.name)
217
+ if arguments_match?(arguments, field_defn, ast_selection)
218
+ selections_on_type[response_key] = [ast_selection]
219
+ end
220
+ end
191
221
  when GraphQL::Language::Nodes::InlineFragment
222
+ on_type = selected_type
223
+ subselections_on_type = selections_on_type
192
224
  if (t = ast_selection.type)
193
225
  # Assuming this is valid, that `t` will be found.
194
- selected_type = @query.schema.types[t.name].metadata[:type_class]
226
+ on_type = @query.schema.types[t.name].metadata[:type_class]
227
+ subselections_on_type = subselections_by_type[on_type] ||= {}
195
228
  end
196
- find_selections(subselections_by_name, selected_type, ast_selection.selections, arguments)
229
+ find_selections(subselections_by_type, subselections_on_type, on_type, ast_selection.selections, arguments)
197
230
  when GraphQL::Language::Nodes::FragmentSpread
198
231
  frag_defn = @query.fragments[ast_selection.name] || raise("Invariant: Can't look ahead to nonexistent fragment #{ast_selection.name} (found: #{@query.fragments.keys})")
199
232
  # Again, assuming a valid AST
200
- selected_type = @query.schema.types[frag_defn.type.name].metadata[:type_class]
201
- find_selections(subselections_by_name, selected_type, frag_defn.selections, arguments)
233
+ on_type = @query.schema.types[frag_defn.type.name].metadata[:type_class]
234
+ subselections_on_type = subselections_by_type[on_type] ||= {}
235
+ find_selections(subselections_by_type, subselections_on_type, on_type, frag_defn.selections, arguments)
202
236
  else
203
237
  raise "Invariant: Unexpected selection type: #{ast_selection.class}"
204
238
  end
@@ -214,16 +248,8 @@ module GraphQL
214
248
  if arguments.nil? || arguments.empty?
215
249
  # No constraint applied
216
250
  matches << node
217
- else
218
- query_kwargs = ArgumentHelpers.arguments(@query, nil, field_defn, node)
219
- passes_args = arguments.all? do |arg_name, arg_value|
220
- arg_name = normalize_keyword(arg_name)
221
- # Make sure the constraint is present with a matching value
222
- query_kwargs.key?(arg_name) && query_kwargs[arg_name] == arg_value
223
- end
224
- if passes_args
225
- matches << node
226
- end
251
+ elsif arguments_match?(arguments, field_defn, node)
252
+ matches << node
227
253
  end
228
254
  end
229
255
  when GraphQL::Language::Nodes::InlineFragment
@@ -236,6 +262,15 @@ module GraphQL
236
262
  end
237
263
  end
238
264
 
265
+ def arguments_match?(arguments, field_defn, field_node)
266
+ query_kwargs = ArgumentHelpers.arguments(@query, nil, field_defn, field_node)
267
+ arguments.all? do |arg_name, arg_value|
268
+ arg_name = normalize_keyword(arg_name)
269
+ # Make sure the constraint is present with a matching value
270
+ query_kwargs.key?(arg_name) && query_kwargs[arg_name] == arg_value
271
+ end
272
+ end
273
+
239
274
  # TODO Dedup with interpreter
240
275
  module ArgumentHelpers
241
276
  module_function
@@ -19,7 +19,11 @@ module GraphQL
19
19
  else
20
20
  coerced_default_value = @object.type.coerce_result(value, @context)
21
21
  if @object.type.unwrap.is_a?(GraphQL::EnumType)
22
- coerced_default_value
22
+ if @object.type.list?
23
+ "[#{coerced_default_value.join(", ")}]"
24
+ else
25
+ coerced_default_value
26
+ end
23
27
  else
24
28
  GraphQL::Language.serialize(coerced_default_value)
25
29
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.14
3
+ # This file is automatically generated by Racc 1.4.15
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -14,7 +14,10 @@ module GraphQL
14
14
 
15
15
  module_eval(<<'...end parser.y/module_eval...', 'parser.y', 435)
16
16
 
17
+ EMPTY_ARRAY = [].freeze
18
+
17
19
  def initialize(query_string, filename:, tracer: Tracing::NullTracer)
20
+ raise GraphQL::ParseError.new("No query string was present", nil, nil, query_string) if query_string.nil?
18
21
  @query_string = query_string
19
22
  @filename = filename
20
23
  @tracer = tracer
@@ -476,24 +479,24 @@ racc_action_default = [
476
479
  -93, -97, -99, -99, -165, -160 ]
477
480
 
478
481
  racc_goto_table = [
479
- 10, 72, 59, 10, 91, 195, 129, 164, 133, 68,
480
- 102, 203, 283, 259, 227, 202, 92, 175, 119, 37,
481
- 125, 235, 37, 274, 182, 270, 245, 135, 271, 99,
482
- 274, 274, 301, 140, 118, 271, 141, 132, 304, 153,
483
- 171, 139, 152, 143, 145, 147, 149, 161, 97, 2,
484
- 167, 134, 288, 236, 311, 103, 88, 159, 246, 175,
485
- 95, 256, 99, 231, 177, 202, 266, 240, 4, 313,
486
- 117, 39, 247, 165, 121, 281, 241, 127, 179, 1,
487
- 276, 248, 249, 252, 40, 202, 183, 3, 144, 146,
488
- 148, 150, 151, 258, 154, 155, 156, 157, 286, 99,
489
- 292, 137, 202, 99, 255, 99, 251, 99, 124, 99,
490
- 221, 170, 294, 224, 67, 173, nil, 91, nil, nil,
491
- nil, nil, 172, 180, 264, nil, 41, 65, nil, nil,
492
- nil, 202, 264, nil, 189, 137, nil, 202, 137, 99,
493
- nil, nil, 264, nil, nil, nil, nil, 197, nil, nil,
494
- 202, nil, nil, 202, nil, nil, nil, nil, nil, nil,
495
- nil, nil, nil, 264, nil, nil, nil, nil, 201, nil,
496
- nil, nil, nil, 264, nil, 65, nil, 137, nil, nil,
482
+ 10, 72, 59, 10, 91, 195, 129, 132, 133, 283,
483
+ 164, 203, 68, 125, 175, 202, 102, 135, 92, 37,
484
+ 259, 227, 37, 4, 301, 182, 39, 159, 235, 99,
485
+ 304, 119, 271, 245, 274, 270, 118, 2, 140, 271,
486
+ 171, 274, 274, 167, 153, 88, 311, 139, 97, 143,
487
+ 145, 147, 149, 134, 177, 103, 175, 281, 1, 288,
488
+ 161, 256, 99, 95, 231, 202, 313, 40, 183, 3,
489
+ 117, 258, 141, 266, 121, 165, 241, 127, 152, 292,
490
+ 221, 248, 249, 224, 179, 202, 252, 276, 144, 146,
491
+ 148, 150, 151, 255, 154, 155, 156, 157, 286, 99,
492
+ 124, 137, 202, 99, 67, 99, 251, 99, 236, 99,
493
+ 264, 170, 294, 246, 240, 173, nil, 91, 264, 247,
494
+ nil, nil, 172, 180, nil, nil, 41, 65, 264, nil,
495
+ nil, 202, nil, nil, 189, 137, nil, 202, 137, 99,
496
+ nil, nil, nil, nil, nil, nil, nil, 197, nil, 264,
497
+ 202, nil, nil, 202, nil, nil, nil, nil, nil, 264,
498
+ nil, nil, nil, nil, nil, nil, nil, nil, 201, nil,
499
+ nil, nil, nil, nil, nil, 65, nil, 137, nil, nil,
497
500
  nil, nil, nil, nil, nil, nil, nil, 100, nil, nil,
498
501
  104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
499
502
  114, 115, nil, nil, nil, nil, 238, 242, 308, 122,
@@ -520,24 +523,24 @@ racc_goto_table = [
520
523
  nil, nil, nil, nil, nil, nil, 309, nil, 293 ]
521
524
 
522
525
  racc_goto_check = [
523
- 10, 13, 15, 10, 23, 79, 19, 22, 19, 28,
524
- 48, 36, 20, 45, 71, 29, 27, 55, 18, 32,
525
- 35, 71, 32, 78, 76, 30, 71, 54, 31, 49,
526
- 78, 78, 21, 70, 17, 31, 72, 14, 21, 70,
527
- 19, 48, 72, 48, 48, 48, 48, 18, 13, 2,
528
- 35, 27, 45, 73, 21, 13, 12, 14, 73, 55,
529
- 28, 36, 49, 76, 54, 29, 71, 33, 4, 20,
530
- 13, 4, 33, 27, 13, 81, 74, 13, 48, 1,
531
- 71, 74, 74, 22, 11, 29, 77, 3, 13, 13,
532
- 13, 13, 13, 44, 13, 13, 13, 13, 36, 49,
533
- 47, 10, 29, 49, 43, 49, 19, 49, 34, 49,
534
- 14, 13, 79, 14, 50, 13, nil, 23, nil, nil,
535
- nil, nil, 15, 13, 80, nil, 16, 16, nil, nil,
536
- nil, 29, 80, nil, 13, 10, nil, 29, 10, 49,
537
- nil, nil, 80, nil, nil, nil, nil, 13, nil, nil,
538
- 29, nil, nil, 29, nil, nil, nil, nil, nil, nil,
539
- nil, nil, nil, 80, nil, nil, nil, nil, 10, nil,
540
- nil, nil, nil, 80, nil, 16, nil, 10, nil, nil,
526
+ 10, 13, 15, 10, 23, 79, 19, 14, 19, 20,
527
+ 22, 36, 28, 35, 55, 29, 48, 54, 27, 32,
528
+ 45, 71, 32, 4, 21, 76, 4, 14, 71, 49,
529
+ 21, 18, 31, 71, 78, 30, 17, 2, 70, 31,
530
+ 19, 78, 78, 35, 70, 12, 21, 48, 13, 48,
531
+ 48, 48, 48, 27, 54, 13, 55, 81, 1, 45,
532
+ 18, 36, 49, 28, 76, 29, 20, 11, 77, 3,
533
+ 13, 44, 72, 71, 13, 27, 74, 13, 72, 47,
534
+ 14, 74, 74, 14, 48, 29, 22, 71, 13, 13,
535
+ 13, 13, 13, 43, 13, 13, 13, 13, 36, 49,
536
+ 34, 10, 29, 49, 50, 49, 19, 49, 73, 49,
537
+ 80, 13, 79, 73, 33, 13, nil, 23, 80, 33,
538
+ nil, nil, 15, 13, nil, nil, 16, 16, 80, nil,
539
+ nil, 29, nil, nil, 13, 10, nil, 29, 10, 49,
540
+ nil, nil, nil, nil, nil, nil, nil, 13, nil, 80,
541
+ 29, nil, nil, 29, nil, nil, nil, nil, nil, 80,
542
+ nil, nil, nil, nil, nil, nil, nil, nil, 10, nil,
543
+ nil, nil, nil, nil, nil, 16, nil, 10, nil, nil,
541
544
  nil, nil, nil, nil, nil, nil, nil, 16, nil, nil,
542
545
  16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
543
546
  16, 16, nil, nil, nil, nil, 32, 32, 19, 16,
@@ -564,15 +567,15 @@ racc_goto_check = [
564
567
  nil, nil, nil, nil, nil, nil, 16, nil, 16 ]
565
568
 
566
569
  racc_goto_pointer = [
567
- nil, 79, 49, 87, 68, nil, nil, nil, nil, nil,
568
- 0, 74, 16, -18, -60, -9, 116, -55, -71, -90,
569
- -239, -252, -114, -55, nil, nil, nil, -49, -6, -153,
570
- -213, -212, 19, -120, 14, -74, -157, nil, nil, nil,
571
- nil, nil, nil, -114, -126, -206, nil, -161, -63, -40,
572
- 99, nil, nil, nil, -74, -118, nil, nil, nil, nil,
570
+ nil, 58, 37, 69, 23, nil, nil, nil, nil, nil,
571
+ 0, 57, 5, -18, -90, -9, 116, -53, -58, -90,
572
+ -242, -260, -111, -55, nil, nil, nil, -47, -3, -153,
573
+ -203, -208, 19, -73, 6, -81, -157, nil, nil, nil,
574
+ nil, nil, nil, -125, -148, -199, nil, -182, -57, -40,
575
+ 89, nil, nil, nil, -84, -121, nil, nil, nil, nil,
573
576
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
574
- -72, -164, -69, -133, -112, nil, -118, -56, -218, -153,
575
- -103, -175 ]
577
+ -67, -157, -33, -78, -112, nil, -117, -74, -207, -153,
578
+ -117, -193 ]
576
579
 
577
580
  racc_goto_default = [
578
581
  nil, nil, nil, nil, nil, 5, 6, 7, 8, 9,
@@ -1052,7 +1055,7 @@ module_eval(<<'.,.,', 'parser.y', 57)
1052
1055
 
1053
1056
  module_eval(<<'.,.,', 'parser.y', 61)
1054
1057
  def _reduce_18(val, _values, result)
1055
- return []
1058
+ return EMPTY_ARRAY
1056
1059
  result
1057
1060
  end
1058
1061
  .,.,
@@ -1135,7 +1138,7 @@ module_eval(<<'.,.,', 'parser.y', 88)
1135
1138
 
1136
1139
  module_eval(<<'.,.,', 'parser.y', 91)
1137
1140
  def _reduce_29(val, _values, result)
1138
- return []
1141
+ return EMPTY_ARRAY
1139
1142
  result
1140
1143
  end
1141
1144
  .,.,
@@ -1267,14 +1270,14 @@ module_eval(<<'.,.,', 'parser.y', 163)
1267
1270
 
1268
1271
  module_eval(<<'.,.,', 'parser.y', 166)
1269
1272
  def _reduce_63(val, _values, result)
1270
- return []
1273
+ return EMPTY_ARRAY
1271
1274
  result
1272
1275
  end
1273
1276
  .,.,
1274
1277
 
1275
1278
  module_eval(<<'.,.,', 'parser.y', 167)
1276
1279
  def _reduce_64(val, _values, result)
1277
- return []
1280
+ return EMPTY_ARRAY
1278
1281
  result
1279
1282
  end
1280
1283
  .,.,
@@ -1374,7 +1377,7 @@ module_eval(<<'.,.,', 'parser.y', 194)
1374
1377
 
1375
1378
  module_eval(<<'.,.,', 'parser.y', 197)
1376
1379
  def _reduce_84(val, _values, result)
1377
- return []
1380
+ return EMPTY_ARRAY
1378
1381
  result
1379
1382
  end
1380
1383
  .,.,
@@ -1479,7 +1482,7 @@ module_eval(<<'.,.,', 'parser.y', 227)
1479
1482
 
1480
1483
  module_eval(<<'.,.,', 'parser.y', 230)
1481
1484
  def _reduce_99(val, _values, result)
1482
- return []
1485
+ return EMPTY_ARRAY
1483
1486
  result
1484
1487
  end
1485
1488
  .,.,
@@ -1750,7 +1753,7 @@ module_eval(<<'.,.,', 'parser.y', 353)
1750
1753
 
1751
1754
  module_eval(<<'.,.,', 'parser.y', 357)
1752
1755
  def _reduce_151(val, _values, result)
1753
- return []
1756
+ return EMPTY_ARRAY
1754
1757
  result
1755
1758
  end
1756
1759
  .,.,
@@ -1830,7 +1833,7 @@ module_eval(<<'.,.,', 'parser.y', 380)
1830
1833
 
1831
1834
  module_eval(<<'.,.,', 'parser.y', 383)
1832
1835
  def _reduce_163(val, _values, result)
1833
- return []
1836
+ return EMPTY_ARRAY
1834
1837
  result
1835
1838
  end
1836
1839
  .,.,
@@ -1852,7 +1855,7 @@ module_eval(<<'.,.,', 'parser.y', 388)
1852
1855
 
1853
1856
  module_eval(<<'.,.,', 'parser.y', 392)
1854
1857
  def _reduce_166(val, _values, result)
1855
- return []
1858
+ return EMPTY_ARRAY
1856
1859
  result
1857
1860
  end
1858
1861
  .,.,
@@ -59,7 +59,7 @@ rule
59
59
  | name
60
60
 
61
61
  variable_definitions_opt:
62
- /* none */ { return [] }
62
+ /* none */ { return EMPTY_ARRAY }
63
63
  | LPAREN variable_definitions_list RPAREN { return val[1] }
64
64
 
65
65
  variable_definitions_list:
@@ -89,7 +89,7 @@ rule
89
89
  LCURLY selection_list RCURLY { return val[1] }
90
90
 
91
91
  selection_set_opt:
92
- /* none */ { return [] }
92
+ /* none */ { return EMPTY_ARRAY }
93
93
  | selection_set { return val[0] }
94
94
 
95
95
  selection_list:
@@ -164,8 +164,8 @@ rule
164
164
  | enum_value_definitions enum_value_definition { return val[0] << val[1] }
165
165
 
166
166
  arguments_opt:
167
- /* none */ { return [] }
168
- | LPAREN RPAREN { return [] }
167
+ /* none */ { return EMPTY_ARRAY }
168
+ | LPAREN RPAREN { return EMPTY_ARRAY }
169
169
  | LPAREN arguments_list RPAREN { return val[1] }
170
170
 
171
171
  arguments_list:
@@ -195,7 +195,7 @@ rule
195
195
  variable: VAR_SIGN name { return make_node(:VariableIdentifier, name: val[1], position_source: val[0]) }
196
196
 
197
197
  list_value:
198
- LBRACKET RBRACKET { return [] }
198
+ LBRACKET RBRACKET { return EMPTY_ARRAY }
199
199
  | LBRACKET list_value_list RBRACKET { return val[1] }
200
200
 
201
201
  list_value_list:
@@ -228,7 +228,7 @@ rule
228
228
  enum_value: enum_name { return make_node(:Enum, name: val[0], position_source: val[0]) }
229
229
 
230
230
  directives_list_opt:
231
- /* none */ { return [] }
231
+ /* none */ { return EMPTY_ARRAY }
232
232
  | directives_list
233
233
 
234
234
  directives_list:
@@ -355,7 +355,7 @@ rule
355
355
  }
356
356
 
357
357
  implements_opt:
358
- /* none */ { return [] }
358
+ /* none */ { return EMPTY_ARRAY }
359
359
  | implements
360
360
 
361
361
  implements:
@@ -381,7 +381,7 @@ rule
381
381
  | input_value_definition_list input_value_definition { val[0] << val[1] }
382
382
 
383
383
  arguments_definitions_opt:
384
- /* none */ { return [] }
384
+ /* none */ { return EMPTY_ARRAY }
385
385
  | LPAREN input_value_definition_list RPAREN { return val[1] }
386
386
 
387
387
  field_definition:
@@ -390,7 +390,7 @@ rule
390
390
  }
391
391
 
392
392
  field_definition_list:
393
- /* none */ { return [] }
393
+ /* none */ { return EMPTY_ARRAY }
394
394
  | field_definition { return [val[0]] }
395
395
  | field_definition_list field_definition { val[0] << val[1] }
396
396
 
@@ -433,7 +433,10 @@ end
433
433
 
434
434
  ---- inner ----
435
435
 
436
+ EMPTY_ARRAY = [].freeze
437
+
436
438
  def initialize(query_string, filename:, tracer: Tracing::NullTracer)
439
+ raise GraphQL::ParseError.new("No query string was present", nil, nil, query_string) if query_string.nil?
437
440
  @query_string = query_string
438
441
  @filename = filename
439
442
  @tracer = tracer