graphql 1.12.1 → 1.12.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/install_generator.rb +4 -1
  3. data/lib/generators/graphql/loader_generator.rb +1 -0
  4. data/lib/generators/graphql/mutation_generator.rb +1 -0
  5. data/lib/generators/graphql/relay.rb +55 -0
  6. data/lib/generators/graphql/relay_generator.rb +4 -46
  7. data/lib/generators/graphql/type_generator.rb +1 -0
  8. data/lib/graphql.rb +5 -3
  9. data/lib/graphql/analysis/analyze_query.rb +1 -1
  10. data/lib/graphql/analysis/ast.rb +1 -1
  11. data/lib/graphql/backtrace/inspect_result.rb +0 -1
  12. data/lib/graphql/backtrace/table.rb +0 -1
  13. data/lib/graphql/backtrace/traced_error.rb +0 -1
  14. data/lib/graphql/backtrace/tracer.rb +4 -8
  15. data/lib/graphql/backwards_compatibility.rb +1 -1
  16. data/lib/graphql/base_type.rb +1 -1
  17. data/lib/graphql/compatibility/execution_specification.rb +1 -1
  18. data/lib/graphql/compatibility/lazy_execution_specification.rb +1 -1
  19. data/lib/graphql/compatibility/query_parser_specification.rb +1 -1
  20. data/lib/graphql/compatibility/schema_parser_specification.rb +1 -1
  21. data/lib/graphql/dataloader.rb +102 -92
  22. data/lib/graphql/dataloader/null_dataloader.rb +5 -5
  23. data/lib/graphql/dataloader/request.rb +1 -6
  24. data/lib/graphql/dataloader/request_all.rb +1 -4
  25. data/lib/graphql/dataloader/source.rb +20 -6
  26. data/lib/graphql/define/instance_definable.rb +1 -1
  27. data/lib/graphql/deprecated_dsl.rb +4 -4
  28. data/lib/graphql/deprecation.rb +13 -0
  29. data/lib/graphql/execution/errors.rb +1 -1
  30. data/lib/graphql/execution/execute.rb +1 -1
  31. data/lib/graphql/execution/interpreter.rb +3 -3
  32. data/lib/graphql/execution/interpreter/arguments_cache.rb +37 -14
  33. data/lib/graphql/execution/interpreter/resolve.rb +33 -25
  34. data/lib/graphql/execution/interpreter/runtime.rb +36 -74
  35. data/lib/graphql/execution/multiplex.rb +22 -23
  36. data/lib/graphql/function.rb +1 -1
  37. data/lib/graphql/internal_representation/document.rb +2 -2
  38. data/lib/graphql/internal_representation/rewrite.rb +1 -1
  39. data/lib/graphql/language.rb +1 -0
  40. data/lib/graphql/language/cache.rb +37 -0
  41. data/lib/graphql/language/parser.rb +15 -5
  42. data/lib/graphql/language/parser.y +15 -5
  43. data/lib/graphql/object_type.rb +0 -2
  44. data/lib/graphql/pagination/connection.rb +15 -1
  45. data/lib/graphql/pagination/connections.rb +2 -1
  46. data/lib/graphql/pagination/relation_connection.rb +5 -1
  47. data/lib/graphql/parse_error.rb +0 -1
  48. data/lib/graphql/query.rb +8 -2
  49. data/lib/graphql/query/arguments.rb +1 -1
  50. data/lib/graphql/query/arguments_cache.rb +0 -1
  51. data/lib/graphql/query/context.rb +1 -3
  52. data/lib/graphql/query/executor.rb +0 -1
  53. data/lib/graphql/query/null_context.rb +3 -2
  54. data/lib/graphql/query/serial_execution.rb +1 -1
  55. data/lib/graphql/query/variable_validation_error.rb +1 -1
  56. data/lib/graphql/railtie.rb +9 -1
  57. data/lib/graphql/relay/base_connection.rb +2 -2
  58. data/lib/graphql/relay/mutation.rb +1 -1
  59. data/lib/graphql/relay/node.rb +3 -3
  60. data/lib/graphql/relay/range_add.rb +10 -5
  61. data/lib/graphql/relay/type_extensions.rb +2 -2
  62. data/lib/graphql/schema.rb +14 -13
  63. data/lib/graphql/schema/argument.rb +61 -0
  64. data/lib/graphql/schema/field.rb +12 -7
  65. data/lib/graphql/schema/field/connection_extension.rb +1 -0
  66. data/lib/graphql/schema/find_inherited_value.rb +3 -1
  67. data/lib/graphql/schema/input_object.rb +6 -2
  68. data/lib/graphql/schema/member/has_arguments.rb +43 -56
  69. data/lib/graphql/schema/member/has_fields.rb +1 -4
  70. data/lib/graphql/schema/member/instrumentation.rb +0 -1
  71. data/lib/graphql/schema/middleware_chain.rb +1 -1
  72. data/lib/graphql/schema/resolver.rb +28 -1
  73. data/lib/graphql/schema/timeout_middleware.rb +1 -1
  74. data/lib/graphql/schema/validation.rb +2 -2
  75. data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +2 -2
  76. data/lib/graphql/static_validation/validator.rb +2 -2
  77. data/lib/graphql/subscriptions/event.rb +0 -1
  78. data/lib/graphql/subscriptions/instrumentation.rb +0 -1
  79. data/lib/graphql/subscriptions/serialize.rb +0 -1
  80. data/lib/graphql/subscriptions/subscription_root.rb +1 -1
  81. data/lib/graphql/tracing/active_support_notifications_tracing.rb +2 -1
  82. data/lib/graphql/tracing/skylight_tracing.rb +1 -1
  83. data/lib/graphql/types/relay/connection_behaviors.rb +25 -3
  84. data/lib/graphql/upgrader/member.rb +1 -1
  85. data/lib/graphql/upgrader/schema.rb +1 -1
  86. data/lib/graphql/version.rb +1 -1
  87. data/readme.md +1 -1
  88. metadata +6 -87
@@ -35,7 +35,7 @@ module GraphQL
35
35
  @queries = queries
36
36
  @queries.each { |q| q.multiplex = self }
37
37
  @context = context
38
- @context[:dataloader] = @dataloader = @schema.dataloader_class.new(context)
38
+ @context[:dataloader] = @dataloader = @schema.dataloader_class.new
39
39
  @tracers = schema.tracers + (context[:tracers] || [])
40
40
  # Support `context: {backtrace: true}`
41
41
  if context[:backtrace] && !@tracers.include?(GraphQL::Backtrace::Tracer)
@@ -74,6 +74,24 @@ module GraphQL
74
74
  end
75
75
  end
76
76
 
77
+ # @param query [GraphQL::Query]
78
+ def begin_query(results, idx, query, multiplex)
79
+ operation = query.selected_operation
80
+ result = if operation.nil? || !query.valid? || query.context.errors.any?
81
+ NO_OPERATION
82
+ else
83
+ begin
84
+ # These were checked to be the same in `#supports_multiplexing?`
85
+ query.schema.query_execution_strategy.begin_query(query, multiplex)
86
+ rescue GraphQL::ExecutionError => err
87
+ query.context.errors << err
88
+ NO_OPERATION
89
+ end
90
+ end
91
+ results[idx] = result
92
+ nil
93
+ end
94
+
77
95
  private
78
96
 
79
97
  def run_as_multiplex(multiplex)
@@ -83,15 +101,13 @@ module GraphQL
83
101
  # Do as much eager evaluation of the query as possible
84
102
  results = []
85
103
  queries.each_with_index do |query, idx|
86
- multiplex.dataloader.enqueue {
87
- results[idx] = begin_query(query, multiplex)
88
- }
104
+ multiplex.dataloader.append_job { begin_query(results, idx, query, multiplex) }
89
105
  end
90
106
 
91
107
  multiplex.dataloader.run
92
108
 
93
109
  # Then, work through lazy results in a breadth-first way
94
- multiplex.dataloader.enqueue {
110
+ multiplex.dataloader.append_job {
95
111
  multiplex.schema.query_execution_strategy.finish_multiplex(results, multiplex)
96
112
  }
97
113
  multiplex.dataloader.run
@@ -112,23 +128,6 @@ module GraphQL
112
128
  raise
113
129
  end
114
130
 
115
- # @param query [GraphQL::Query]
116
- # @return [Hash] The initial result (may not be finished if there are lazy values)
117
- def begin_query(query, multiplex)
118
- operation = query.selected_operation
119
- if operation.nil? || !query.valid? || query.context.errors.any?
120
- NO_OPERATION
121
- else
122
- begin
123
- # These were checked to be the same in `#supports_multiplexing?`
124
- query.schema.query_execution_strategy.begin_query(query, multiplex)
125
- rescue GraphQL::ExecutionError => err
126
- query.context.errors << err
127
- NO_OPERATION
128
- end
129
- end
130
- end
131
-
132
131
  # @param data_result [Hash] The result for the "data" key, if any
133
132
  # @param query [GraphQL::Query] The query which was run
134
133
  # @return [Hash] final result of this query, including all values and errors
@@ -156,7 +155,7 @@ module GraphQL
156
155
 
157
156
  # use the old `query_execution_strategy` etc to run this query
158
157
  def run_one_legacy(schema, query)
159
- warn "Multiplex.run_one_legacy will be removed from GraphQL-Ruby 2.0, upgrade to the Interpreter to avoid this deprecated codepath: https://graphql-ruby.org/queries/interpreter.html"
158
+ GraphQL::Deprecation.warn "Multiplex.run_one_legacy will be removed from GraphQL-Ruby 2.0, upgrade to the Interpreter to avoid this deprecated codepath: https://graphql-ruby.org/queries/interpreter.html"
160
159
 
161
160
  query.result_values = if !query.valid?
162
161
  all_errors = query.validation_errors + query.analysis_errors + query.context.errors
@@ -3,7 +3,7 @@ module GraphQL
3
3
  # @api deprecated
4
4
  class Function
5
5
  def self.inherited(subclass)
6
- warn "GraphQL::Function (used for #{subclass}) will be removed from GraphQL-Ruby 2.0, please upgrade to resolvers: https://graphql-ruby.org/fields/resolvers.html"
6
+ GraphQL::Deprecation.warn "GraphQL::Function (used for #{subclass}) will be removed from GraphQL-Ruby 2.0, please upgrade to resolvers: https://graphql-ruby.org/fields/resolvers.html"
7
7
  end
8
8
 
9
9
  # @return [Hash<String => GraphQL::Argument>] Arguments, keyed by name
@@ -14,12 +14,12 @@ module GraphQL
14
14
  end
15
15
 
16
16
  def [](key)
17
- warn "#{self.class}#[] is deprecated; use `operation_definitions[]` instead"
17
+ GraphQL::Deprecation.warn "#{self.class}#[] is deprecated; use `operation_definitions[]` instead"
18
18
  operation_definitions[key]
19
19
  end
20
20
 
21
21
  def each(&block)
22
- warn "#{self.class}#each is deprecated; use `operation_definitions.each` instead"
22
+ GraphQL::Deprecation.warn "#{self.class}#each is deprecated; use `operation_definitions.each` instead"
23
23
  operation_definitions.each(&block)
24
24
  end
25
25
  end
@@ -60,7 +60,7 @@ module GraphQL
60
60
 
61
61
  # @return [Hash<String, Node>] Roots of this query
62
62
  def operations
63
- warn "#{self.class}#operations is deprecated; use `document.operation_definitions` instead"
63
+ GraphQL::Deprecation.warn "#{self.class}#operations is deprecated; use `document.operation_definitions` instead"
64
64
  @document.operation_definitions
65
65
  end
66
66
 
@@ -6,6 +6,7 @@ require "graphql/language/document_from_schema_definition"
6
6
  require "graphql/language/generation"
7
7
  require "graphql/language/lexer"
8
8
  require "graphql/language/nodes"
9
+ require "graphql/language/cache"
9
10
  require "graphql/language/parser"
10
11
  require "graphql/language/token"
11
12
  require "graphql/language/visitor"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql/version'
4
+ require 'digest/sha2'
5
+
6
+ module GraphQL
7
+ module Language
8
+ class Cache
9
+ def initialize(path)
10
+ @path = path
11
+ end
12
+
13
+ DIGEST = Digest::SHA256.new << GraphQL::VERSION
14
+ def fetch(filename)
15
+ hash = DIGEST.dup << filename
16
+ begin
17
+ hash << File.mtime(filename).to_i.to_s
18
+ rescue SystemCallError
19
+ return yield
20
+ end
21
+ cache_path = @path.join(hash.to_s)
22
+
23
+ if cache_path.exist?
24
+ Marshal.load(cache_path.read)
25
+ else
26
+ payload = yield
27
+ tmp_path = "#{cache_path}.#{rand}"
28
+
29
+ @path.mkpath
30
+ File.binwrite(tmp_path, Marshal.dump(payload))
31
+ File.rename(tmp_path, cache_path.to_s)
32
+ payload
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -41,12 +41,22 @@ def parse_document
41
41
  end
42
42
  end
43
43
 
44
- def self.parse(query_string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
45
- self.new(query_string, filename: filename, tracer: tracer).parse_document
46
- end
44
+ class << self
45
+ attr_accessor :cache
46
+
47
+ def parse(query_string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
48
+ new(query_string, filename: filename, tracer: tracer).parse_document
49
+ end
47
50
 
48
- def self.parse_file(filename, tracer: GraphQL::Tracing::NullTracer)
49
- self.parse(File.read(filename), filename: filename, tracer: tracer)
51
+ def parse_file(filename, tracer: GraphQL::Tracing::NullTracer)
52
+ if cache
53
+ cache.fetch(filename) do
54
+ parse(File.read(filename), filename: filename, tracer: tracer)
55
+ end
56
+ else
57
+ parse(File.read(filename), filename: filename, tracer: tracer)
58
+ end
59
+ end
50
60
  end
51
61
 
52
62
  private
@@ -462,12 +462,22 @@ def parse_document
462
462
  end
463
463
  end
464
464
 
465
- def self.parse(query_string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
466
- self.new(query_string, filename: filename, tracer: tracer).parse_document
467
- end
465
+ class << self
466
+ attr_accessor :cache
467
+
468
+ def parse(query_string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
469
+ new(query_string, filename: filename, tracer: tracer).parse_document
470
+ end
468
471
 
469
- def self.parse_file(filename, tracer: GraphQL::Tracing::NullTracer)
470
- self.parse(File.read(filename), filename: filename, tracer: tracer)
472
+ def parse_file(filename, tracer: GraphQL::Tracing::NullTracer)
473
+ if cache
474
+ cache.fetch(filename) do
475
+ parse(File.read(filename), filename: filename, tracer: tracer)
476
+ end
477
+ else
478
+ parse(File.read(filename), filename: filename, tracer: tracer)
479
+ end
480
+ end
471
481
  end
472
482
 
473
483
  private
@@ -121,8 +121,6 @@ module GraphQL
121
121
  iface = GraphQL::BaseType.resolve_related_type(type_membership.abstract_type)
122
122
  if iface.is_a?(GraphQL::InterfaceType)
123
123
  @clean_inherited_fields.merge!(iface.fields)
124
- else
125
- pp iface
126
124
  end
127
125
  end
128
126
  @clean_inherited_fields
@@ -45,6 +45,9 @@ module GraphQL
45
45
  end
46
46
  end
47
47
 
48
+ # @return [Hash<Symbol => Object>] The field arguments from the field that returned this connection
49
+ attr_accessor :arguments
50
+
48
51
  # @param items [Object] some unpaginated collection item, like an `Array` or `ActiveRecord::Relation`
49
52
  # @param context [Query::Context]
50
53
  # @param parent [Object] The object this collection belongs to
@@ -52,8 +55,9 @@ module GraphQL
52
55
  # @param after [String, nil] A cursor for pagination, if the client provided one
53
56
  # @param last [Integer, nil] Limit parameter from the client, if provided
54
57
  # @param before [String, nil] A cursor for pagination, if the client provided one.
58
+ # @param arguments [Hash] The arguments to the field that returned the collection wrapped by this connection
55
59
  # @param max_page_size [Integer, nil] A configured value to cap the result size. Applied as `first` if neither first or last are given.
56
- def initialize(items, parent: nil, field: nil, context: nil, first: nil, after: nil, max_page_size: :not_given, last: nil, before: nil, edge_class: nil)
60
+ def initialize(items, parent: nil, field: nil, context: nil, first: nil, after: nil, max_page_size: :not_given, last: nil, before: nil, edge_class: nil, arguments: nil)
57
61
  @items = items
58
62
  @parent = parent
59
63
  @context = context
@@ -62,6 +66,7 @@ module GraphQL
62
66
  @after_value = after
63
67
  @last_value = last
64
68
  @before_value = before
69
+ @arguments = arguments
65
70
  @edge_class = edge_class || self.class::Edge
66
71
  # This is only true if the object was _initialized_ with an override
67
72
  # or if one is assigned later.
@@ -105,6 +110,15 @@ module GraphQL
105
110
  end
106
111
  end
107
112
 
113
+ # This is called by `Relay::RangeAdd` -- it can be overridden
114
+ # when `item` needs some modifications based on this connection's state.
115
+ #
116
+ # @param item [Object] An item newly added to `items`
117
+ # @return [Edge]
118
+ def range_add_edge(item)
119
+ edge_class.new(item, self)
120
+ end
121
+
108
122
  attr_writer :last
109
123
  # @return [Integer, nil] A clamped `last` value. (The underlying instance variable doesn't have limits on it)
110
124
  def last
@@ -23,7 +23,7 @@ module GraphQL
23
23
 
24
24
  def self.use(schema_defn)
25
25
  if schema_defn.plugins.any? { |(plugin, args)| plugin == self }
26
- warn("#{self} is now the default, remove `use #{self}` from #{caller(2,1).first}")
26
+ GraphQL::Deprecation.warn("#{self} is now the default, remove `use #{self}` from #{caller(2,1).first}")
27
27
  end
28
28
  schema_defn.connections = self.new(schema: schema_defn)
29
29
  end
@@ -84,6 +84,7 @@ module GraphQL
84
84
  after: arguments[:after],
85
85
  last: arguments[:last],
86
86
  before: arguments[:before],
87
+ arguments: arguments,
87
88
  edge_class: edge_class_for_field(field),
88
89
  )
89
90
  end
@@ -32,7 +32,11 @@ module GraphQL
32
32
  @has_next_page = if before_offset && before_offset > 0
33
33
  true
34
34
  elsif first
35
- relation_count(set_limit(sliced_nodes, first + 1)) == first + 1
35
+ if @nodes && @nodes.count < first
36
+ false
37
+ else
38
+ relation_count(set_limit(sliced_nodes, first + 1)) == first + 1
39
+ end
36
40
  else
37
41
  false
38
42
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # test_via: language/parser.rb
3
2
  module GraphQL
4
3
  class ParseError < GraphQL::Error
5
4
  attr_reader :line, :col, :query
data/lib/graphql/query.rb CHANGED
@@ -251,12 +251,18 @@ module GraphQL
251
251
  # @param parent_object [GraphQL::Schema::Object]
252
252
  # @return Hash{Symbol => Object}
253
253
  def arguments_for(ast_node, definition, parent_object: nil)
254
+ if interpreter?
255
+ arguments_cache.fetch(ast_node, definition, parent_object)
256
+ else
257
+ arguments_cache[ast_node][definition]
258
+ end
259
+ end
260
+
261
+ def arguments_cache
254
262
  if interpreter?
255
263
  @arguments_cache ||= Execution::Interpreter::ArgumentsCache.new(self)
256
- @arguments_cache.fetch(ast_node, definition, parent_object)
257
264
  else
258
265
  @arguments_cache ||= ArgumentsCache.build(self)
259
- @arguments_cache[ast_node][definition]
260
266
  end
261
267
  end
262
268
 
@@ -22,7 +22,7 @@ module GraphQL
22
22
  method_names.each do |method_name|
23
23
  # Don't define a helper method if it would override something.
24
24
  if method_defined?(method_name)
25
- warn(
25
+ GraphQL::Deprecation.warn(
26
26
  "Unable to define a helper for argument with name '#{method_name}' "\
27
27
  "as this is a reserved name. Add `method_access: false` to stop this warning."
28
28
  )
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # test_via: ../query.rb
3
2
  module GraphQL
4
3
  class Query
5
4
  module ArgumentsCache
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # test_via: ../execution/execute.rb
3
- # test_via: ../execution/lazy.rb
4
2
  module GraphQL
5
3
  class Query
6
4
  # Expose some query-specific info to field resolve functions.
@@ -159,7 +157,7 @@ module GraphQL
159
157
  end
160
158
 
161
159
  def dataloader
162
- @dataloader ||= query.multiplex.dataloader
160
+ @dataloader ||= query.multiplex ? query.multiplex.dataloader : schema.dataloader_class.new
163
161
  end
164
162
 
165
163
  # @api private
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # test_via: ../query.rb
3
2
  module GraphQL
4
3
  class Query
5
4
  class Executor
@@ -9,10 +9,11 @@ module GraphQL
9
9
  def visible_type?(t); true; end
10
10
  end
11
11
 
12
- attr_reader :schema, :query, :warden
12
+ attr_reader :schema, :query, :warden, :dataloader
13
13
 
14
14
  def initialize
15
15
  @query = nil
16
+ @dataloader = GraphQL::Dataloader::NullDataloader.new
16
17
  @schema = GraphQL::Schema.new
17
18
  @warden = NullWarden.new(
18
19
  GraphQL::Filter.new,
@@ -36,7 +37,7 @@ module GraphQL
36
37
  @instance = self.new
37
38
  end
38
39
 
39
- def_delegators :instance, :query, :schema, :warden, :interpreter?
40
+ def_delegators :instance, :query, :schema, :warden, :interpreter?, :dataloader
40
41
  end
41
42
  end
42
43
  end
@@ -16,7 +16,7 @@ module GraphQL
16
16
  # @param query_object [GraphQL::Query] the query object for this execution
17
17
  # @return [Hash] a spec-compliant GraphQL result, as a hash
18
18
  def execute(ast_operation, root_type, query_object)
19
- warn "#{self.class} will be removed in GraphQL-Ruby 2.0, please upgrade to the Interpreter: https://graphql-ruby.org/queries/interpreter.html"
19
+ GraphQL::Deprecation.warn "#{self.class} will be removed in GraphQL-Ruby 2.0, please upgrade to the Interpreter: https://graphql-ruby.org/queries/interpreter.html"
20
20
  operation_resolution.resolve(
21
21
  query_object.irep_selection,
22
22
  root_type,
@@ -23,7 +23,7 @@ module GraphQL
23
23
  # a one level deep merge explicitly. However beyond that only show the
24
24
  # latest value and problems.
25
25
  super.merge({ "extensions" => { "value" => value, "problems" => validation_result.problems }}) do |key, oldValue, newValue|
26
- if oldValue.respond_to? merge
26
+ if oldValue.respond_to?(:merge)
27
27
  oldValue.merge(newValue)
28
28
  else
29
29
  newValue
@@ -1,8 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
3
  module GraphQL
5
4
  class Railtie < Rails::Railtie
5
+ config.before_configuration do
6
+ # Bootsnap compile cache has similar expiration properties,
7
+ # so we assume that if the user has bootsnap setup it's ok
8
+ # to piggy back on it.
9
+ if ::Object.const_defined?("Bootsnap::CompileCache::ISeq") && Bootsnap::CompileCache::ISeq.cache_dir
10
+ Language::Parser.cache ||= Language::Cache.new(Pathname.new(Bootsnap::CompileCache::ISeq.cache_dir).join('graphql'))
11
+ end
12
+ end
13
+
6
14
  rake_tasks do
7
15
  # Defer this so that you only need the `parser` gem when you _run_ the upgrader
8
16
  def load_upgraders
@@ -59,11 +59,11 @@ module GraphQL
59
59
  # @param parent [Object] The object which this collection belongs to
60
60
  # @param context [GraphQL::Query::Context] The context from the field being resolved
61
61
  def initialize(nodes, arguments, field: nil, max_page_size: nil, parent: nil, context: nil)
62
- warn "GraphQL::Relay::BaseConnection (used for #{self.class}) will be removed from GraphQL-Ruby 2.0, use GraphQL::Pagination::Connections instead: https://graphql-ruby.org/pagination/overview.html"
62
+ GraphQL::Deprecation.warn "GraphQL::Relay::BaseConnection (used for #{self.class}) will be removed from GraphQL-Ruby 2.0, use GraphQL::Pagination::Connections instead: https://graphql-ruby.org/pagination/overview.html"
63
63
 
64
64
  deprecated_caller = caller(0, 10).find { |c| !c.include?("lib/graphql") }
65
65
  if deprecated_caller
66
- warn " -> called from #{deprecated_caller}"
66
+ GraphQL::Deprecation.warn " -> called from #{deprecated_caller}"
67
67
  end
68
68
 
69
69
  @context = context