graphql 1.12.0 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql.rb +1 -1
  3. data/lib/graphql/analysis/analyze_query.rb +1 -1
  4. data/lib/graphql/analysis/ast.rb +1 -1
  5. data/lib/graphql/backwards_compatibility.rb +1 -1
  6. data/lib/graphql/base_type.rb +1 -1
  7. data/lib/graphql/compatibility/execution_specification.rb +1 -1
  8. data/lib/graphql/compatibility/lazy_execution_specification.rb +1 -1
  9. data/lib/graphql/compatibility/query_parser_specification.rb +1 -1
  10. data/lib/graphql/compatibility/schema_parser_specification.rb +1 -1
  11. data/lib/graphql/dataloader.rb +6 -5
  12. data/lib/graphql/dataloader/null_dataloader.rb +1 -1
  13. data/lib/graphql/define/assign_global_id_field.rb +1 -1
  14. data/lib/graphql/define/instance_definable.rb +1 -1
  15. data/lib/graphql/define/type_definer.rb +5 -5
  16. data/lib/graphql/deprecated_dsl.rb +4 -4
  17. data/lib/graphql/deprecation.rb +13 -0
  18. data/lib/graphql/execution/errors.rb +1 -1
  19. data/lib/graphql/execution/execute.rb +1 -1
  20. data/lib/graphql/execution/interpreter.rb +1 -1
  21. data/lib/graphql/execution/interpreter/runtime.rb +3 -1
  22. data/lib/graphql/execution/multiplex.rb +1 -1
  23. data/lib/graphql/function.rb +1 -1
  24. data/lib/graphql/internal_representation/document.rb +2 -2
  25. data/lib/graphql/internal_representation/rewrite.rb +1 -1
  26. data/lib/graphql/pagination/connections.rb +1 -1
  27. data/lib/graphql/query/arguments.rb +1 -1
  28. data/lib/graphql/query/serial_execution.rb +1 -1
  29. data/lib/graphql/relay/base_connection.rb +2 -2
  30. data/lib/graphql/relay/connection_instrumentation.rb +4 -4
  31. data/lib/graphql/relay/mutation.rb +1 -1
  32. data/lib/graphql/relay/node.rb +3 -3
  33. data/lib/graphql/relay/type_extensions.rb +2 -2
  34. data/lib/graphql/schema.rb +5 -5
  35. data/lib/graphql/schema/field.rb +2 -2
  36. data/lib/graphql/schema/middleware_chain.rb +1 -1
  37. data/lib/graphql/schema/timeout_middleware.rb +1 -1
  38. data/lib/graphql/schema/validation.rb +2 -2
  39. data/lib/graphql/static_validation/validator.rb +4 -2
  40. data/lib/graphql/subscriptions/subscription_root.rb +1 -1
  41. data/lib/graphql/tracing/skylight_tracing.rb +1 -1
  42. data/lib/graphql/upgrader/member.rb +1 -1
  43. data/lib/graphql/upgrader/schema.rb +1 -1
  44. data/lib/graphql/version.rb +1 -1
  45. metadata +21 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 433f1170eb17ab192761efcd8c27cf9efe5f952ab47b501baca270e33d6007cd
4
- data.tar.gz: c56045f746385ae37ebd0f82116aad10782e9265c13e0e85e39488ef3db02c74
3
+ metadata.gz: 6af72a84f88b98df67d9b5497ad882cf802c10ebebdf98659680e4506d8f1ace
4
+ data.tar.gz: 394f6c964e8a0dea5b8675ca4a8188d14851fb77cd4220d61d2ff9fd2d701bc7
5
5
  SHA512:
6
- metadata.gz: 6d580c78b6b659602067fcfd3043eff7ef2b20da1d50c1ca2b234614d864e1a232cb65e7456cfdf85764523f30bd5232823ea19b4664208aef875cc68e2e5fc9
7
- data.tar.gz: 172bc16fadfeee1f022646498dd2ce359bd885fb96ddbeeab50f7583d27811501e583194dd582a7cf47d63545c2fe00c4fa4625b6b247155f537ff4a6de60ac1
6
+ metadata.gz: '0938a34d796c956d2a51a937a30e12110f89560e6c4bf35aa33a79ff955753bec492b86bc77b6c011cb34635231b3bd8bab52238c780bb9301fbb6f4612c26b8'
7
+ data.tar.gz: 1c29d0e2554ec54ae931a08cad3e552465bea9bc62b6fd11d40701d0dea3c15b7310d6d850780cb22d48db913cc71ee21ac15345b6cff86a38b964ac7b458e39
@@ -149,7 +149,7 @@ require "graphql/unauthorized_error"
149
149
  require "graphql/unauthorized_field_error"
150
150
  require "graphql/load_application_object_failed_error"
151
151
  require "graphql/dataloader"
152
-
152
+ require "graphql/deprecation"
153
153
 
154
154
  module GraphQL
155
155
  # Ruby has `deprecate_constant`,
@@ -43,7 +43,7 @@ module GraphQL
43
43
  # @param analyzers [Array<#call>] Objects that respond to `#call(memo, visit_type, irep_node)`
44
44
  # @return [Array<Any>] Results from those analyzers
45
45
  def analyze_query(query, analyzers, multiplex_states: [])
46
- warn "Legacy analysis will be removed in GraphQL-Ruby 2.0, please upgrade to AST Analysis: https://graphql-ruby.org/queries/ast_analysis.html (schema: #{query.schema})"
46
+ GraphQL::Deprecation.warn "Legacy analysis will be removed in GraphQL-Ruby 2.0, please upgrade to AST Analysis: https://graphql-ruby.org/queries/ast_analysis.html (schema: #{query.schema})"
47
47
 
48
48
  query.trace("analyze_query", { query: query }) do
49
49
  analyzers_to_run = analyzers.select do |analyzer|
@@ -15,7 +15,7 @@ module GraphQL
15
15
  def use(schema_class)
16
16
  if schema_class.analysis_engine == self
17
17
  definition_line = caller(2, 1).first
18
- warn("GraphQL::Analysis::AST is now the default; remove `use GraphQL::Analysis::AST` from the schema definition (#{definition_line})")
18
+ GraphQL::Deprecation.warn("GraphQL::Analysis::AST is now the default; remove `use GraphQL::Analysis::AST` from the schema definition (#{definition_line})")
19
19
  else
20
20
  schema_class.analysis_engine = self
21
21
  end
@@ -22,7 +22,7 @@ module GraphQL
22
22
  backtrace = caller(0, 20)
23
23
  # Find the first line in the trace that isn't library internals:
24
24
  user_line = backtrace.find {|l| l !~ /lib\/graphql/ }
25
- warn(message + "\n" + user_line + "\n")
25
+ GraphQL::Deprecation.warn(message + "\n" + user_line + "\n")
26
26
  wrapper = last ? LastArgumentsWrapper : FirstArgumentsWrapper
27
27
  wrapper.new(callable, from)
28
28
  else
@@ -224,7 +224,7 @@ module GraphQL
224
224
  private
225
225
 
226
226
  def warn_deprecated_coerce(alt_method_name)
227
- warn("Coercing without a context is deprecated; use `#{alt_method_name}` if you don't want context-awareness")
227
+ GraphQL::Deprecation.warn("Coercing without a context is deprecated; use `#{alt_method_name}` if you don't want context-awareness")
228
228
  end
229
229
  end
230
230
  end
@@ -32,7 +32,7 @@ module GraphQL
32
32
  # @param execution_strategy [<#new, #execute>] An execution strategy class
33
33
  # @return [Class<Minitest::Test>] A test suite for this execution strategy
34
34
  def self.build_suite(execution_strategy)
35
- warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
35
+ GraphQL::Deprecation.warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
36
36
  Class.new(Minitest::Test) do
37
37
  class << self
38
38
  attr_accessor :counter_schema, :specification_schema
@@ -7,7 +7,7 @@ module GraphQL
7
7
  # @param execution_strategy [<#new, #execute>] An execution strategy class
8
8
  # @return [Class<Minitest::Test>] A test suite for this execution strategy
9
9
  def self.build_suite(execution_strategy)
10
- warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
10
+ GraphQL::Deprecation.warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
11
11
 
12
12
  Class.new(Minitest::Test) do
13
13
  class << self
@@ -11,7 +11,7 @@ module GraphQL
11
11
  # @yieldreturn [GraphQL::Language::Nodes::Document]
12
12
  # @return [Class<Minitest::Test>] A test suite for this parse function
13
13
  def self.build_suite(&block)
14
- warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
14
+ GraphQL::Deprecation.warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
15
15
 
16
16
  Class.new(Minitest::Test) do
17
17
  include QueryAssertions
@@ -8,7 +8,7 @@ module GraphQL
8
8
  # @yieldreturn [GraphQL::Language::Nodes::Document]
9
9
  # @return [Class<Minitest::Test>] A test suite for this parse function
10
10
  def self.build_suite(&block)
11
- warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
11
+ GraphQL::Deprecation.warn "#{self} will be removed from GraphQL-Ruby 2.0. There is no replacement, please open an issue on GitHub if you need support."
12
12
 
13
13
  Class.new(Minitest::Test) do
14
14
  @@parse_fn = block
@@ -36,7 +36,7 @@ module GraphQL
36
36
  }
37
37
  }
38
38
  @waiting_fibers = []
39
- @yielded_fibers = Set.new
39
+ @yielded_fibers = {}
40
40
  end
41
41
 
42
42
  # @return [Hash] the {Multiplex} context
@@ -69,9 +69,10 @@ module GraphQL
69
69
  nil
70
70
  end
71
71
 
72
- # @return [Boolean] Returns true if the current Fiber has yielded once via Dataloader
73
- def yielded?
74
- @yielded_fibers.include?(Fiber.current)
72
+ # @param path [Array<String, Integer>] A graphql response path
73
+ # @return [Boolean] True if the current Fiber has yielded once via Dataloader at {path}
74
+ def yielded?(path)
75
+ @yielded_fibers[Fiber.current] == path
75
76
  end
76
77
 
77
78
  # Run all Fibers until they're all done
@@ -160,7 +161,7 @@ module GraphQL
160
161
  if fiber.alive?
161
162
  if !@yielded_fibers.include?(fiber)
162
163
  # This fiber hasn't yielded yet, we should enqueue a continuation fiber
163
- @yielded_fibers.add(fiber)
164
+ @yielded_fibers[fiber] = current_runtime.progress_path
164
165
  current_runtime.enqueue_selections_fiber
165
166
  end
166
167
  fiber_stack << fiber
@@ -15,7 +15,7 @@ module GraphQL
15
15
  # executed sychronously.
16
16
  def run; end
17
17
  def yield; end
18
- def yielded?; false; end
18
+ def yielded?(_path); false; end
19
19
  end
20
20
  end
21
21
  end
@@ -4,7 +4,7 @@ module GraphQL
4
4
  module AssignGlobalIdField
5
5
  def self.call(type_defn, field_name, **field_kwargs)
6
6
  resolve = GraphQL::Relay::GlobalIdResolve.new(type: type_defn)
7
- GraphQL::Define::AssignObjectField.call(type_defn, field_name, **field_kwargs, type: GraphQL::DEPRECATED_ID_TYPE.to_non_null_type, resolve: resolve)
7
+ GraphQL::Define::AssignObjectField.call(type_defn, field_name, **field_kwargs, type: GraphQL::Deprecation_ID_TYPE.to_non_null_type, resolve: resolve)
8
8
  end
9
9
  end
10
10
  end
@@ -11,7 +11,7 @@ module GraphQL
11
11
  end
12
12
 
13
13
  if deprecated_caller
14
- warn <<-ERR
14
+ GraphQL::Deprecation.warn <<-ERR
15
15
  #{self}.define will be removed in GraphQL-Ruby 2.0; use a class-based definition instead. See https://graphql-ruby.org/schema/class_based_api.html.
16
16
  -> called from #{deprecated_caller}
17
17
  ERR
@@ -7,11 +7,11 @@ module GraphQL
7
7
  class TypeDefiner
8
8
  include Singleton
9
9
  # rubocop:disable Naming/MethodName
10
- def Int; GraphQL::DEPRECATED_INT_TYPE; end
11
- def String; GraphQL::DEPRECATED_STRING_TYPE; end
12
- def Float; GraphQL::DEPRECATED_FLOAT_TYPE; end
13
- def Boolean; GraphQL::DEPRECATED_BOOLEAN_TYPE; end
14
- def ID; GraphQL::DEPRECATED_ID_TYPE; end
10
+ def Int; GraphQL::Deprecation_INT_TYPE; end
11
+ def String; GraphQL::Deprecation_STRING_TYPE; end
12
+ def Float; GraphQL::Deprecation_FLOAT_TYPE; end
13
+ def Boolean; GraphQL::Deprecation_BOOLEAN_TYPE; end
14
+ def ID; GraphQL::Deprecation_ID_TYPE; end
15
15
  # rubocop:enable Naming/MethodName
16
16
 
17
17
  # Make a {ListType} which wraps the input type
@@ -4,13 +4,13 @@ module GraphQL
4
4
  #
5
5
  # 1. Scoped by file (CRuby only), add to the top of the file:
6
6
  #
7
- # using GraphQL::DeprecatedDSL
7
+ # using GraphQL::DeprecationDSL
8
8
  #
9
9
  # (This is a "refinement", there are also other ways to scope it.)
10
10
  #
11
11
  # 2. Global application, add before schema definition:
12
12
  #
13
- # GraphQL::DeprecatedDSL.activate
13
+ # GraphQL::DeprecationDSL.activate
14
14
  #
15
15
  module DeprecatedDSL
16
16
  TYPE_CLASSES = [
@@ -24,7 +24,7 @@ module GraphQL
24
24
 
25
25
  def self.activate
26
26
  deprecated_caller = caller(1, 1).first
27
- warn "DeprecatedDSL will be removed from GraphQL-Ruby 2.0, use `.to_non_null_type` instead of `!` and remove `.activate` from #{deprecated_caller}"
27
+ GraphQL::Deprecation.warn "DeprecatedDSL will be removed from GraphQL-Ruby 2.0, use `.to_non_null_type` instead of `!` and remove `.activate` from #{deprecated_caller}"
28
28
  TYPE_CLASSES.each { |c| c.extend(Methods) }
29
29
  GraphQL::Schema::List.include(Methods)
30
30
  GraphQL::Schema::NonNull.include(Methods)
@@ -33,7 +33,7 @@ module GraphQL
33
33
  module Methods
34
34
  def !
35
35
  deprecated_caller = caller(1, 1).first
36
- warn "DeprecatedDSL will be removed from GraphQL-Ruby 2.0, use `.to_non_null_type` instead of `!` at #{deprecated_caller}"
36
+ GraphQL::Deprecation.warn "DeprecatedDSL will be removed from GraphQL-Ruby 2.0, use `.to_non_null_type` instead of `!` at #{deprecated_caller}"
37
37
  to_non_null_type
38
38
  end
39
39
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphQL
4
+ module Deprecation
5
+ def self.warn(message)
6
+ if defined?(ActiveSupport::Deprecation)
7
+ ActiveSupport::Deprecation.warn(message)
8
+ else
9
+ Kernel.warn(message)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -20,7 +20,7 @@ module GraphQL
20
20
  def self.use(schema)
21
21
  if schema.plugins.any? { |(plugin, kwargs)| plugin == self }
22
22
  definition_line = caller(2, 1).first
23
- warn("GraphQL::Execution::Errors is now installed by default, remove `use GraphQL::Execution::Errors` from #{definition_line}")
23
+ GraphQL::Deprecation.warn("GraphQL::Execution::Errors is now installed by default, remove `use GraphQL::Execution::Errors` from #{definition_line}")
24
24
  end
25
25
  schema.error_handler = self.new(schema)
26
26
  end
@@ -25,7 +25,7 @@ module GraphQL
25
25
  end
26
26
 
27
27
  def execute(ast_operation, root_type, query)
28
- warn "#{self.class} will be removed in GraphQL-Ruby 2.0, please upgrade to the Interpreter: https://graphql-ruby.org/queries/interpreter.html"
28
+ 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"
29
29
  result = resolve_root_selection(query)
30
30
  lazy_resolve_root_selection(result, **{query: query})
31
31
  GraphQL::Execution::Flatten.call(query.context)
@@ -25,7 +25,7 @@ module GraphQL
25
25
  def self.use(schema_class)
26
26
  if schema_class.interpreter?
27
27
  definition_line = caller(2, 1).first
28
- warn("GraphQL::Execution::Interpreter is now the default; remove `use GraphQL::Execution::Interpreter` from the schema definition (#{definition_line})")
28
+ GraphQL::Deprecation.warn("GraphQL::Execution::Interpreter is now the default; remove `use GraphQL::Execution::Interpreter` from the schema definition (#{definition_line})")
29
29
  else
30
30
  schema_class.query_execution_strategy(self)
31
31
  schema_class.mutation_execution_strategy(self)
@@ -188,13 +188,15 @@ module GraphQL
188
188
  evaluate_selection(path, result_name, field_ast_nodes_or_ast_node, scoped_context, owner_object, owner_type, is_eager_selection)
189
189
  # The dataloader knows if ^^ that selection halted and later selections were executed in another fiber.
190
190
  # If that's the case, then don't continue execution here.
191
- if @dataloader.yielded?
191
+ if @dataloader.yielded?(path)
192
192
  break
193
193
  end
194
194
  end
195
195
  nil
196
196
  end
197
197
 
198
+ attr_reader :progress_path
199
+
198
200
  # @return [void]
199
201
  def evaluate_selection(path, result_name, field_ast_nodes_or_ast_node, scoped_context, owner_object, owner_type, is_eager_field)
200
202
  # As a performance optimization, the hash key will be a `Node` if
@@ -156,7 +156,7 @@ module GraphQL
156
156
 
157
157
  # use the old `query_execution_strategy` etc to run this query
158
158
  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"
159
+ 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
160
 
161
161
  query.result_values = if !query.valid?
162
162
  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
 
@@ -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
@@ -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
  )
@@ -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,
@@ -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
@@ -10,10 +10,10 @@ module GraphQL
10
10
  def self.default_arguments
11
11
  @default_arguments ||= begin
12
12
  argument_definitions = [
13
- ["first", GraphQL::DEPRECATED_INT_TYPE, "Returns the first _n_ elements from the list."],
14
- ["after", GraphQL::DEPRECATED_STRING_TYPE, "Returns the elements in the list that come after the specified cursor."],
15
- ["last", GraphQL::DEPRECATED_INT_TYPE, "Returns the last _n_ elements from the list."],
16
- ["before", GraphQL::DEPRECATED_STRING_TYPE, "Returns the elements in the list that come before the specified cursor."],
13
+ ["first", GraphQL::Deprecation_INT_TYPE, "Returns the first _n_ elements from the list."],
14
+ ["after", GraphQL::Deprecation_STRING_TYPE, "Returns the elements in the list that come after the specified cursor."],
15
+ ["last", GraphQL::Deprecation_INT_TYPE, "Returns the last _n_ elements from the list."],
16
+ ["before", GraphQL::Deprecation_STRING_TYPE, "Returns the elements in the list that come before the specified cursor."],
17
17
  ]
18
18
 
19
19
  argument_definitions.reduce({}) do |memo, arg_defn|
@@ -30,7 +30,7 @@ module GraphQL
30
30
  alias :input_fields :arguments
31
31
 
32
32
  def initialize
33
- warn "GraphQL::Relay::Mutation will be removed from GraphQL-Ruby 2.0, use GraphQL::Schema::RelayClassicMutation instead: https://graphql-ruby.org/mutations/mutation_classes"
33
+ GraphQL::Deprecation.warn "GraphQL::Relay::Mutation will be removed from GraphQL-Ruby 2.0, use GraphQL::Schema::RelayClassicMutation instead: https://graphql-ruby.org/mutations/mutation_classes"
34
34
  @fields = {}
35
35
  @arguments = {}
36
36
  @has_generated_return_type = false
@@ -5,7 +5,7 @@ module GraphQL
5
5
  module Node
6
6
  # @return [GraphQL::Field] a field for finding objects by their global ID.
7
7
  def self.field(**kwargs, &block)
8
- warn "GraphQL::Relay::Node.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodeField instead"
8
+ GraphQL::Deprecation.warn "GraphQL::Relay::Node.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodeField instead"
9
9
  # We have to define it fresh each time because
10
10
  # its name will be modified and its description
11
11
  # _may_ be modified.
@@ -19,7 +19,7 @@ module GraphQL
19
19
  end
20
20
 
21
21
  def self.plural_field(**kwargs, &block)
22
- warn "GraphQL::Relay::Nodes.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodesField instead"
22
+ GraphQL::Deprecation.warn "GraphQL::Relay::Nodes.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodesField instead"
23
23
  field = GraphQL::Types::Relay::NodesField.graphql_definition
24
24
 
25
25
  if kwargs.any? || block
@@ -31,7 +31,7 @@ module GraphQL
31
31
 
32
32
  # @return [GraphQL::InterfaceType] The interface which all Relay types must implement
33
33
  def self.interface
34
- warn "GraphQL::Relay::Node.interface will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::Node instead"
34
+ GraphQL::Deprecation.warn "GraphQL::Relay::Node.interface will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::Node instead"
35
35
  @interface ||= GraphQL::Types::Relay::Node.graphql_definition
36
36
  end
37
37
  end
@@ -12,7 +12,7 @@ module GraphQL
12
12
  # Define a custom connection type for this object type
13
13
  # @return [GraphQL::ObjectType]
14
14
  def define_connection(**kwargs, &block)
15
- warn ".connection_type and .define_connection will be removed from GraphQL-Ruby 2.0, use class-based type definitions instead: https://graphql-ruby.org/schema/class_based_api.html"
15
+ GraphQL::Deprecation.warn ".connection_type and .define_connection will be removed from GraphQL-Ruby 2.0, use class-based type definitions instead: https://graphql-ruby.org/schema/class_based_api.html"
16
16
  GraphQL::Relay::ConnectionType.create_type(self, **kwargs, &block)
17
17
  end
18
18
 
@@ -24,7 +24,7 @@ module GraphQL
24
24
  # Define a custom edge type for this object type
25
25
  # @return [GraphQL::ObjectType]
26
26
  def define_edge(**kwargs, &block)
27
- warn ".edge_type and .define_edge will be removed from GraphQL-Ruby 2.0, use class-based type definitions instead: https://graphql-ruby.org/schema/class_based_api.html"
27
+ GraphQL::Deprecation.warn ".edge_type and .define_edge will be removed from GraphQL-Ruby 2.0, use class-based type definitions instead: https://graphql-ruby.org/schema/class_based_api.html"
28
28
  GraphQL::Relay::EdgeType.create_type(self, **kwargs, &block)
29
29
  end
30
30
  end
@@ -184,7 +184,7 @@ module GraphQL
184
184
  },
185
185
  query_analyzer: ->(schema, analyzer) {
186
186
  if analyzer == GraphQL::Authorization::Analyzer
187
- warn("The Authorization query analyzer is deprecated. Authorizing at query runtime is generally a better idea.")
187
+ GraphQL::Deprecation.warn("The Authorization query analyzer is deprecated. Authorizing at query runtime is generally a better idea.")
188
188
  end
189
189
  schema.query_analyzers << analyzer
190
190
  },
@@ -1564,7 +1564,7 @@ module GraphQL
1564
1564
 
1565
1565
  def instrument(instrument_step, instrumenter, options = {})
1566
1566
  if instrument_step == :field
1567
- warn "Field instrumentation (#{instrumenter.inspect}) will be removed in GraphQL-Ruby 2.0, please upgrade to field extensions: https://graphql-ruby.org/type_definitions/field_extensions.html"
1567
+ GraphQL::Deprecation.warn "Field instrumentation (#{instrumenter.inspect}) will be removed in GraphQL-Ruby 2.0, please upgrade to field extensions: https://graphql-ruby.org/type_definitions/field_extensions.html"
1568
1568
  end
1569
1569
 
1570
1570
  step = if instrument_step == :field && options[:after_built_ins]
@@ -1614,7 +1614,7 @@ module GraphQL
1614
1614
 
1615
1615
  def query_analyzer(new_analyzer)
1616
1616
  if new_analyzer == GraphQL::Authorization::Analyzer
1617
- warn("The Authorization query analyzer is deprecated. Authorizing at query runtime is generally a better idea.")
1617
+ GraphQL::Deprecation.warn("The Authorization query analyzer is deprecated. Authorizing at query runtime is generally a better idea.")
1618
1618
  end
1619
1619
  own_query_analyzers << new_analyzer
1620
1620
  end
@@ -1625,7 +1625,7 @@ module GraphQL
1625
1625
 
1626
1626
  def middleware(new_middleware = nil)
1627
1627
  if new_middleware
1628
- warn "Middleware will be removed in GraphQL-Ruby 2.0, please upgrade to Field Extensions: https://graphql-ruby.org/type_definitions/field_extensions.html"
1628
+ GraphQL::Deprecation.warn "Middleware will be removed in GraphQL-Ruby 2.0, please upgrade to Field Extensions: https://graphql-ruby.org/type_definitions/field_extensions.html"
1629
1629
  own_middleware << new_middleware
1630
1630
  else
1631
1631
  # TODO make sure this is cached when running a query
@@ -1702,7 +1702,7 @@ module GraphQL
1702
1702
  if interpreter? && !defined?(@subscription_extension_added) && subscription && self.subscriptions
1703
1703
  @subscription_extension_added = true
1704
1704
  if subscription.singleton_class.ancestors.include?(Subscriptions::SubscriptionRoot)
1705
- warn("`extend Subscriptions::SubscriptionRoot` is no longer required; you may remove it from #{self}'s `subscription` root type (#{subscription}).")
1705
+ GraphQL::Deprecation.warn("`extend Subscriptions::SubscriptionRoot` is no longer required; you may remove it from #{self}'s `subscription` root type (#{subscription}).")
1706
1706
  else
1707
1707
  subscription.fields.each do |name, field|
1708
1708
  field.extension(Subscriptions::DefaultSubscriptionResolveExtension)
@@ -83,10 +83,10 @@ module GraphQL
83
83
  def self.from_options(name = nil, type = nil, desc = nil, resolver: nil, mutation: nil, subscription: nil,**kwargs, &block)
84
84
  if kwargs[:field]
85
85
  if kwargs[:field].is_a?(GraphQL::Field) && kwargs[:field] == GraphQL::Types::Relay::NodeField.graphql_definition
86
- warn("Legacy-style `GraphQL::Relay::Node.field` is being added to a class-based type. See `GraphQL::Types::Relay::NodeField` for a replacement.")
86
+ GraphQL::Deprecation.warn("Legacy-style `GraphQL::Relay::Node.field` is being added to a class-based type. See `GraphQL::Types::Relay::NodeField` for a replacement.")
87
87
  return GraphQL::Types::Relay::NodeField
88
88
  elsif kwargs[:field].is_a?(GraphQL::Field) && kwargs[:field] == GraphQL::Types::Relay::NodesField.graphql_definition
89
- warn("Legacy-style `GraphQL::Relay::Node.plural_field` is being added to a class-based type. See `GraphQL::Types::Relay::NodesField` for a replacement.")
89
+ GraphQL::Deprecation.warn("Legacy-style `GraphQL::Relay::Node.plural_field` is being added to a class-based type. See `GraphQL::Types::Relay::NodesField` for a replacement.")
90
90
  return GraphQL::Types::Relay::NodesField
91
91
  end
92
92
  end
@@ -71,7 +71,7 @@ module GraphQL
71
71
 
72
72
  def wrap(callable)
73
73
  if BackwardsCompatibility.get_arity(callable) == 6
74
- warn("Middleware that takes a next_middleware parameter is deprecated (#{callable.inspect}); instead, accept a block and use yield.")
74
+ GraphQL::Deprecation.warn("Middleware that takes a next_middleware parameter is deprecated (#{callable.inspect}); instead, accept a block and use yield.")
75
75
  MiddlewareWrapper.new(callable)
76
76
  else
77
77
  callable
@@ -30,7 +30,7 @@ module GraphQL
30
30
  def initialize(max_seconds:, context_key: nil, &block)
31
31
  @max_seconds = max_seconds
32
32
  if context_key
33
- warn("TimeoutMiddleware's `context_key` is ignored, timeout data is now stored in isolated storage")
33
+ GraphQL::Deprecation.warn("TimeoutMiddleware's `context_key` is ignored, timeout data is now stored in isolated storage")
34
34
  end
35
35
  @error_handler = block
36
36
  end
@@ -203,7 +203,7 @@ module GraphQL
203
203
  RESERVED_TYPE_NAME = ->(type) {
204
204
  if type.name.start_with?('__') && !type.introspection?
205
205
  # TODO: make this a hard failure in a later version
206
- warn("Name #{type.name.inspect} must not begin with \"__\", which is reserved by GraphQL introspection.")
206
+ GraphQL::Deprecation.warn("Name #{type.name.inspect} must not begin with \"__\", which is reserved by GraphQL introspection.")
207
207
  nil
208
208
  else
209
209
  # ok name
@@ -213,7 +213,7 @@ module GraphQL
213
213
  RESERVED_NAME = ->(named_thing) {
214
214
  if named_thing.name.start_with?('__')
215
215
  # TODO: make this a hard failure in a later version
216
- warn("Name #{named_thing.name.inspect} must not begin with \"__\", which is reserved by GraphQL introspection.")
216
+ GraphQL::Deprecation.warn("Name #{named_thing.name.inspect} must not begin with \"__\", which is reserved by GraphQL introspection.")
217
217
  nil
218
218
  else
219
219
  # no worries
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require "timeout"
3
+
2
4
  module GraphQL
3
5
  module StaticValidation
4
6
  # Initialized with a {GraphQL::Schema}, then it can validate {GraphQL::Language::Nodes::Documents}s based on that schema.
@@ -43,8 +45,8 @@ module GraphQL
43
45
  unless (legacy_rules = rules_to_use - GraphQL::StaticValidation::ALL_RULES).empty?
44
46
  legacy_rules.each do |rule_class_or_module|
45
47
  if rule_class_or_module.method_defined?(:validate)
46
- warn "Legacy validator rules will be removed from GraphQL-Ruby 2.0, use a module instead (see the built-in rules: https://github.com/rmosolgo/graphql-ruby/tree/master/lib/graphql/static_validation/rules)"
47
- warn " -> Legacy validator: #{rule_class_or_module}"
48
+ GraphQL::Deprecation.warn "Legacy validator rules will be removed from GraphQL-Ruby 2.0, use a module instead (see the built-in rules: https://github.com/rmosolgo/graphql-ruby/tree/master/lib/graphql/static_validation/rules)"
49
+ GraphQL::Deprecation.warn " -> Legacy validator: #{rule_class_or_module}"
48
50
  rule_class_or_module.new.validate(context)
49
51
  end
50
52
  end
@@ -6,7 +6,7 @@ module GraphQL
6
6
  # @deprecated This module is no longer needed.
7
7
  module SubscriptionRoot
8
8
  def self.extended(child_cls)
9
- warn "`extend GraphQL::Subscriptions::SubscriptionRoot` is no longer required; you can remove it from your Subscription type (#{child_cls})"
9
+ GraphQL::Deprecation.warn "`extend GraphQL::Subscriptions::SubscriptionRoot` is no longer required; you can remove it from your Subscription type (#{child_cls})"
10
10
  child_cls.include(InstanceMethods)
11
11
  end
12
12
 
@@ -18,7 +18,7 @@ module GraphQL
18
18
  # This is not advised if you run more than one query per HTTP request, for example, with `graphql-client` or multiplexing.
19
19
  # It can also be specified per-query with `context[:set_skylight_endpoint_name]`.
20
20
  def initialize(options = {})
21
- warn("GraphQL::Tracing::SkylightTracing is deprecated and will be removed in GraphQL-Ruby 2.0, please enable Skylight's GraphQL probe instead: https://www.skylight.io/support/getting-more-from-skylight#graphql.")
21
+ GraphQL::Deprecation.warn("GraphQL::Tracing::SkylightTracing is deprecated and will be removed in GraphQL-Ruby 2.0, please enable Skylight's GraphQL probe instead: https://www.skylight.io/support/getting-more-from-skylight#graphql.")
22
22
  @set_endpoint_name = options.fetch(:set_endpoint_name, false)
23
23
  super
24
24
  end
@@ -771,7 +771,7 @@ module GraphQL
771
771
 
772
772
  class Member
773
773
  def initialize(member, skip: SkipOnNullKeyword, type_transforms: DEFAULT_TYPE_TRANSFORMS, field_transforms: DEFAULT_FIELD_TRANSFORMS, clean_up_transforms: DEFAULT_CLEAN_UP_TRANSFORMS)
774
- warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
774
+ GraphQL::Deprecation.warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
775
775
  @member = member
776
776
  @skip = skip
777
777
  @type_transforms = type_transforms
@@ -4,7 +4,7 @@ module GraphQL
4
4
  module Upgrader
5
5
  class Schema
6
6
  def initialize(schema)
7
- warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
7
+ GraphQL::Deprecation.warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
8
8
  @schema = schema
9
9
  end
10
10
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.12.0"
3
+ VERSION = "1.12.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -318,6 +318,20 @@ dependencies:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
320
  version: 1.5.0
321
+ - !ruby/object:Gem::Dependency
322
+ name: webrick
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
321
335
  description: A plain-Ruby implementation of GraphQL.
322
336
  email:
323
337
  - rdmosolgo@gmail.com
@@ -419,6 +433,7 @@ files:
419
433
  - lib/graphql/define/non_null_with_bang.rb
420
434
  - lib/graphql/define/type_definer.rb
421
435
  - lib/graphql/deprecated_dsl.rb
436
+ - lib/graphql/deprecation.rb
422
437
  - lib/graphql/dig.rb
423
438
  - lib/graphql/directive.rb
424
439
  - lib/graphql/directive/deprecated_directive.rb
@@ -766,7 +781,7 @@ metadata:
766
781
  source_code_uri: https://github.com/rmosolgo/graphql-ruby
767
782
  bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
768
783
  mailing_list_uri: https://tinyletter.com/graphql-ruby
769
- post_install_message:
784
+ post_install_message:
770
785
  rdoc_options: []
771
786
  require_paths:
772
787
  - lib
@@ -781,8 +796,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
781
796
  - !ruby/object:Gem::Version
782
797
  version: '0'
783
798
  requirements: []
784
- rubygems_version: 3.2.3
785
- signing_key:
799
+ rubygems_version: 3.0.3
800
+ signing_key:
786
801
  specification_version: 4
787
802
  summary: A GraphQL language and runtime for Ruby
788
803
  test_files: []