graphql 1.13.16 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of graphql might be problematic. Click here for more details.

Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/analysis/ast/query_complexity.rb +1 -1
  3. data/lib/graphql/analysis/ast/query_depth.rb +0 -1
  4. data/lib/graphql/analysis/ast/visitor.rb +1 -1
  5. data/lib/graphql/analysis/ast.rb +0 -10
  6. data/lib/graphql/analysis.rb +0 -7
  7. data/lib/graphql/backtrace/table.rb +0 -18
  8. data/lib/graphql/backtrace/tracer.rb +1 -2
  9. data/lib/graphql/backtrace.rb +2 -8
  10. data/lib/graphql/dig.rb +1 -1
  11. data/lib/graphql/execution/errors.rb +1 -9
  12. data/lib/graphql/execution/interpreter/runtime.rb +2 -9
  13. data/lib/graphql/execution/interpreter.rb +0 -22
  14. data/lib/graphql/execution/lazy.rb +1 -1
  15. data/lib/graphql/execution/lookahead.rb +6 -13
  16. data/lib/graphql/execution/multiplex.rb +50 -107
  17. data/lib/graphql/execution.rb +11 -3
  18. data/lib/graphql/introspection/dynamic_fields.rb +3 -8
  19. data/lib/graphql/introspection/entry_points.rb +2 -15
  20. data/lib/graphql/language/document_from_schema_definition.rb +0 -17
  21. data/lib/graphql/pagination/connections.rb +2 -28
  22. data/lib/graphql/query/context.rb +1 -185
  23. data/lib/graphql/query/input_validation_result.rb +0 -9
  24. data/lib/graphql/query/literal_input.rb +8 -13
  25. data/lib/graphql/query/validation_pipeline.rb +6 -34
  26. data/lib/graphql/query/variable_validation_error.rb +2 -2
  27. data/lib/graphql/query/variables.rb +8 -31
  28. data/lib/graphql/query.rb +5 -34
  29. data/lib/graphql/railtie.rb +0 -104
  30. data/lib/graphql/relay/range_add.rb +0 -4
  31. data/lib/graphql/relay.rb +0 -15
  32. data/lib/graphql/schema/addition.rb +1 -8
  33. data/lib/graphql/schema/argument.rb +1 -25
  34. data/lib/graphql/schema/build_from_definition.rb +0 -1
  35. data/lib/graphql/schema/directive.rb +0 -21
  36. data/lib/graphql/schema/enum.rb +3 -19
  37. data/lib/graphql/schema/enum_value.rb +0 -22
  38. data/lib/graphql/schema/field.rb +2 -185
  39. data/lib/graphql/schema/input_object.rb +11 -57
  40. data/lib/graphql/schema/interface.rb +0 -25
  41. data/lib/graphql/schema/introspection_system.rb +3 -8
  42. data/lib/graphql/schema/late_bound_type.rb +2 -2
  43. data/lib/graphql/schema/list.rb +3 -24
  44. data/lib/graphql/schema/loader.rb +0 -1
  45. data/lib/graphql/schema/member/base_dsl_methods.rb +0 -5
  46. data/lib/graphql/schema/member/build_type.rb +4 -6
  47. data/lib/graphql/schema/member/has_arguments.rb +14 -18
  48. data/lib/graphql/schema/member/has_fields.rb +2 -2
  49. data/lib/graphql/schema/member/has_interfaces.rb +0 -2
  50. data/lib/graphql/schema/member/validates_input.rb +2 -2
  51. data/lib/graphql/schema/member.rb +0 -6
  52. data/lib/graphql/schema/mutation.rb +0 -9
  53. data/lib/graphql/schema/non_null.rb +3 -9
  54. data/lib/graphql/schema/object.rb +0 -40
  55. data/lib/graphql/schema/relay_classic_mutation.rb +17 -28
  56. data/lib/graphql/schema/scalar.rb +1 -16
  57. data/lib/graphql/schema/union.rb +0 -16
  58. data/lib/graphql/schema/warden.rb +1 -1
  59. data/lib/graphql/schema/wrapper.rb +0 -5
  60. data/lib/graphql/schema.rb +106 -945
  61. data/lib/graphql/static_validation/base_visitor.rb +4 -21
  62. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +12 -12
  63. data/lib/graphql/static_validation/validator.rb +2 -24
  64. data/lib/graphql/static_validation.rb +0 -2
  65. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
  66. data/lib/graphql/subscriptions/event.rb +1 -1
  67. data/lib/graphql/subscriptions/instrumentation.rb +0 -51
  68. data/lib/graphql/subscriptions.rb +4 -13
  69. data/lib/graphql/tracing/data_dog_tracing.rb +2 -19
  70. data/lib/graphql/tracing/platform_tracing.rb +4 -31
  71. data/lib/graphql/tracing.rb +0 -1
  72. data/lib/graphql/types/relay/connection_behaviors.rb +2 -6
  73. data/lib/graphql/types/relay/default_relay.rb +0 -10
  74. data/lib/graphql/types/relay/node_behaviors.rb +5 -1
  75. data/lib/graphql/types/relay.rb +0 -2
  76. data/lib/graphql/version.rb +1 -1
  77. data/lib/graphql.rb +1 -65
  78. metadata +6 -131
  79. data/lib/graphql/analysis/analyze_query.rb +0 -98
  80. data/lib/graphql/analysis/field_usage.rb +0 -45
  81. data/lib/graphql/analysis/max_query_complexity.rb +0 -26
  82. data/lib/graphql/analysis/max_query_depth.rb +0 -26
  83. data/lib/graphql/analysis/query_complexity.rb +0 -88
  84. data/lib/graphql/analysis/query_depth.rb +0 -43
  85. data/lib/graphql/analysis/reducer_state.rb +0 -48
  86. data/lib/graphql/argument.rb +0 -131
  87. data/lib/graphql/authorization.rb +0 -82
  88. data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
  89. data/lib/graphql/backwards_compatibility.rb +0 -61
  90. data/lib/graphql/base_type.rb +0 -232
  91. data/lib/graphql/boolean_type.rb +0 -2
  92. data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
  93. data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
  94. data/lib/graphql/compatibility/execution_specification.rb +0 -436
  95. data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
  96. data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
  97. data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
  98. data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
  99. data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
  100. data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
  101. data/lib/graphql/compatibility.rb +0 -5
  102. data/lib/graphql/define/assign_argument.rb +0 -12
  103. data/lib/graphql/define/assign_connection.rb +0 -13
  104. data/lib/graphql/define/assign_enum_value.rb +0 -18
  105. data/lib/graphql/define/assign_global_id_field.rb +0 -11
  106. data/lib/graphql/define/assign_mutation_function.rb +0 -34
  107. data/lib/graphql/define/assign_object_field.rb +0 -42
  108. data/lib/graphql/define/defined_object_proxy.rb +0 -53
  109. data/lib/graphql/define/instance_definable.rb +0 -255
  110. data/lib/graphql/define/no_definition_error.rb +0 -7
  111. data/lib/graphql/define/non_null_with_bang.rb +0 -16
  112. data/lib/graphql/define/type_definer.rb +0 -31
  113. data/lib/graphql/define.rb +0 -31
  114. data/lib/graphql/deprecated_dsl.rb +0 -55
  115. data/lib/graphql/directive/deprecated_directive.rb +0 -2
  116. data/lib/graphql/directive/include_directive.rb +0 -2
  117. data/lib/graphql/directive/skip_directive.rb +0 -2
  118. data/lib/graphql/directive.rb +0 -107
  119. data/lib/graphql/enum_type.rb +0 -133
  120. data/lib/graphql/execution/execute.rb +0 -333
  121. data/lib/graphql/execution/flatten.rb +0 -40
  122. data/lib/graphql/execution/typecast.rb +0 -50
  123. data/lib/graphql/field/resolve.rb +0 -59
  124. data/lib/graphql/field.rb +0 -226
  125. data/lib/graphql/float_type.rb +0 -2
  126. data/lib/graphql/function.rb +0 -128
  127. data/lib/graphql/id_type.rb +0 -2
  128. data/lib/graphql/input_object_type.rb +0 -138
  129. data/lib/graphql/int_type.rb +0 -2
  130. data/lib/graphql/interface_type.rb +0 -72
  131. data/lib/graphql/internal_representation/document.rb +0 -27
  132. data/lib/graphql/internal_representation/node.rb +0 -206
  133. data/lib/graphql/internal_representation/print.rb +0 -51
  134. data/lib/graphql/internal_representation/rewrite.rb +0 -184
  135. data/lib/graphql/internal_representation/scope.rb +0 -88
  136. data/lib/graphql/internal_representation/visit.rb +0 -36
  137. data/lib/graphql/internal_representation.rb +0 -7
  138. data/lib/graphql/list_type.rb +0 -80
  139. data/lib/graphql/non_null_type.rb +0 -71
  140. data/lib/graphql/object_type.rb +0 -130
  141. data/lib/graphql/query/arguments.rb +0 -189
  142. data/lib/graphql/query/arguments_cache.rb +0 -24
  143. data/lib/graphql/query/executor.rb +0 -52
  144. data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
  145. data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
  146. data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
  147. data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
  148. data/lib/graphql/query/serial_execution.rb +0 -40
  149. data/lib/graphql/relay/array_connection.rb +0 -83
  150. data/lib/graphql/relay/base_connection.rb +0 -189
  151. data/lib/graphql/relay/connection_instrumentation.rb +0 -54
  152. data/lib/graphql/relay/connection_resolve.rb +0 -43
  153. data/lib/graphql/relay/connection_type.rb +0 -54
  154. data/lib/graphql/relay/edge.rb +0 -27
  155. data/lib/graphql/relay/edge_type.rb +0 -19
  156. data/lib/graphql/relay/edges_instrumentation.rb +0 -39
  157. data/lib/graphql/relay/global_id_resolve.rb +0 -17
  158. data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
  159. data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
  160. data/lib/graphql/relay/mutation/resolve.rb +0 -56
  161. data/lib/graphql/relay/mutation/result.rb +0 -38
  162. data/lib/graphql/relay/mutation.rb +0 -106
  163. data/lib/graphql/relay/node.rb +0 -39
  164. data/lib/graphql/relay/page_info.rb +0 -7
  165. data/lib/graphql/relay/relation_connection.rb +0 -188
  166. data/lib/graphql/relay/type_extensions.rb +0 -32
  167. data/lib/graphql/scalar_type.rb +0 -91
  168. data/lib/graphql/schema/catchall_middleware.rb +0 -35
  169. data/lib/graphql/schema/default_parse_error.rb +0 -10
  170. data/lib/graphql/schema/default_type_error.rb +0 -17
  171. data/lib/graphql/schema/member/accepts_definition.rb +0 -164
  172. data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -58
  173. data/lib/graphql/schema/member/instrumentation.rb +0 -131
  174. data/lib/graphql/schema/middleware_chain.rb +0 -82
  175. data/lib/graphql/schema/possible_types.rb +0 -44
  176. data/lib/graphql/schema/rescue_middleware.rb +0 -60
  177. data/lib/graphql/schema/timeout_middleware.rb +0 -88
  178. data/lib/graphql/schema/traversal.rb +0 -228
  179. data/lib/graphql/schema/validation.rb +0 -313
  180. data/lib/graphql/static_validation/default_visitor.rb +0 -15
  181. data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
  182. data/lib/graphql/string_type.rb +0 -2
  183. data/lib/graphql/subscriptions/subscription_root.rb +0 -76
  184. data/lib/graphql/tracing/skylight_tracing.rb +0 -70
  185. data/lib/graphql/types/relay/node_field.rb +0 -24
  186. data/lib/graphql/types/relay/nodes_field.rb +0 -43
  187. data/lib/graphql/union_type.rb +0 -115
  188. data/lib/graphql/upgrader/member.rb +0 -937
  189. data/lib/graphql/upgrader/schema.rb +0 -38
@@ -89,9 +89,9 @@ module GraphQL
89
89
  case late_bound_type
90
90
  when GraphQL::Schema::LateBoundType
91
91
  @schema.get_type(late_bound_type.name)
92
- when GraphQL::Schema::List, GraphQL::ListType
92
+ when GraphQL::Schema::List
93
93
  resolve_late_binding(late_bound_type.of_type).to_list_type
94
- when GraphQL::Schema::NonNull, GraphQL::NonNullType
94
+ when GraphQL::Schema::NonNull
95
95
  resolve_late_binding(late_bound_type.of_type).to_non_null_type
96
96
  when Module
97
97
  # It's a normal type -- no change required
@@ -103,12 +103,7 @@ module GraphQL
103
103
 
104
104
  def load_constant(class_name)
105
105
  const = @custom_namespace.const_get(class_name)
106
- if @class_based
107
- dup_type_class(const)
108
- else
109
- # Use `.to_graphql` to get a freshly-made version, not shared between schemas
110
- const.deprecated_to_graphql
111
- end
106
+ dup_type_class(const)
112
107
  rescue NameError
113
108
  # Dup the built-in so that the cached fields aren't shared
114
109
  dup_type_class(@built_in_namespace.const_get(class_name))
@@ -16,11 +16,11 @@ module GraphQL
16
16
  end
17
17
 
18
18
  def to_non_null_type
19
- @to_non_null_type ||= GraphQL::NonNullType.new(of_type: self)
19
+ @to_non_null_type ||= GraphQL::Schema::NonNull.new(self)
20
20
  end
21
21
 
22
22
  def to_list_type
23
- @to_list_type ||= GraphQL::ListType.new(of_type: self)
23
+ @to_list_type ||= GraphQL::Schema::List.new(self)
24
24
  end
25
25
 
26
26
  def inspect
@@ -8,12 +8,6 @@ module GraphQL
8
8
  class List < GraphQL::Schema::Wrapper
9
9
  include Schema::Member::ValidatesInput
10
10
 
11
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
12
-
13
- def to_graphql
14
- @of_type.graphql_definition(silence_deprecation_warning: true).to_list_type
15
- end
16
-
17
11
  # @return [GraphQL::TypeKinds::LIST]
18
12
  def kind
19
13
  GraphQL::TypeKinds::LIST
@@ -51,24 +45,15 @@ module GraphQL
51
45
  end
52
46
  end
53
47
 
54
- def validate_non_null_input(value, ctx, max_errors: nil)
48
+ def validate_non_null_input(value, ctx)
55
49
  result = GraphQL::Query::InputValidationResult.new
56
50
  ensure_array(value).each_with_index do |item, index|
57
51
  item_result = of_type.validate_input(item, ctx)
58
- unless item_result.valid?
59
- if max_errors
60
- if max_errors == 0
61
- add_max_errros_reached_message(result)
62
- break
63
- end
64
-
65
- max_errors -= 1
66
- end
67
-
52
+ if !item_result.valid?
68
53
  result.merge_result!(index, item_result)
69
54
  end
70
55
  end
71
- result.valid? ? nil : result
56
+ result
72
57
  end
73
58
 
74
59
  private
@@ -81,12 +66,6 @@ module GraphQL
81
66
  [value]
82
67
  end
83
68
  end
84
-
85
- def add_max_errros_reached_message(result)
86
- message = "Too many errors processing list variable, max validation error limit reached. Execution aborted"
87
- item_result = GraphQL::Query::InputValidationResult.from_problem(message)
88
- result.merge_result!(nil, item_result)
89
- end
90
69
  end
91
70
  end
92
71
  end
@@ -202,7 +202,6 @@ module GraphQL
202
202
  description: arg["description"],
203
203
  deprecation_reason: arg["deprecationReason"],
204
204
  required: false,
205
- method_access: false,
206
205
  camelize: false,
207
206
  }
208
207
 
@@ -94,11 +94,6 @@ module GraphQL
94
94
  end
95
95
  end
96
96
 
97
- # @return [GraphQL::BaseType] Convert this type to a legacy-style object.
98
- def to_graphql
99
- raise GraphQL::RequiredImplementationMissingError
100
- end
101
-
102
97
  alias :unwrap :itself
103
98
 
104
99
  # Creates the default name for a schema member.
@@ -35,18 +35,16 @@ module GraphQL
35
35
  else
36
36
  maybe_type = constantize(type_expr)
37
37
  case maybe_type
38
- when GraphQL::BaseType
39
- maybe_type
40
38
  when Module
41
39
  # This is a way to check that it's the right kind of module:
42
- if maybe_type.respond_to?(:graphql_definition)
40
+ if maybe_type.respond_to?(:kind)
43
41
  maybe_type
44
42
  else
45
43
  raise ArgumentError, "Unexpected class/module found for GraphQL type: #{type_expr} (must be type definition class/module)"
46
44
  end
47
45
  end
48
46
  end
49
- when GraphQL::BaseType, GraphQL::Schema::LateBoundType
47
+ when GraphQL::Schema::LateBoundType
50
48
  type_expr
51
49
  when Array
52
50
  case type_expr.length
@@ -68,7 +66,7 @@ module GraphQL
68
66
  type_expr
69
67
  when Module
70
68
  # This is a way to check that it's the right kind of module:
71
- if type_expr.respond_to?(:graphql_definition)
69
+ if type_expr.respond_to?(:kind)
72
70
  type_expr
73
71
  else
74
72
  # Eg `String` => GraphQL::Types::String
@@ -100,7 +98,7 @@ module GraphQL
100
98
 
101
99
  def to_type_name(something)
102
100
  case something
103
- when GraphQL::BaseType, GraphQL::Schema::LateBoundType
101
+ when GraphQL::Schema::LateBoundType
104
102
  something.unwrap.name
105
103
  when Array
106
104
  to_type_name(something.first)
@@ -14,7 +14,7 @@ module GraphQL
14
14
  end
15
15
 
16
16
  # @see {GraphQL::Schema::Argument#initialize} for parameters
17
- # @return [GraphQL::Schema::Argument] An instance of {arguments_class}, created from `*args`
17
+ # @return [GraphQL::Schema::Argument] An instance of {argument_class}, created from `*args`
18
18
  def argument(*args, **kwargs, &block)
19
19
  kwargs[:owner] = self
20
20
  loads = kwargs[:loads]
@@ -291,26 +291,22 @@ module GraphQL
291
291
  # This object was loaded successfully
292
292
  # and resolved to the right type,
293
293
  # now apply the `.authorized?` class method if there is one
294
- if (class_based_type = application_object_type.type_class)
295
- context.schema.after_lazy(class_based_type.authorized?(application_object, context)) do |authed|
296
- if authed
297
- application_object
294
+ context.schema.after_lazy(application_object_type.authorized?(application_object, context)) do |authed|
295
+ if authed
296
+ application_object
297
+ else
298
+ err = GraphQL::UnauthorizedError.new(
299
+ object: application_object,
300
+ type: application_object_type,
301
+ context: context,
302
+ )
303
+ if self.respond_to?(:unauthorized_object)
304
+ err.set_backtrace(caller)
305
+ unauthorized_object(err)
298
306
  else
299
- err = GraphQL::UnauthorizedError.new(
300
- object: application_object,
301
- type: class_based_type,
302
- context: context,
303
- )
304
- if self.respond_to?(:unauthorized_object)
305
- err.set_backtrace(caller)
306
- unauthorized_object(err)
307
- else
308
- raise err
309
- end
307
+ raise err
310
308
  end
311
309
  end
312
- else
313
- application_object
314
310
  end
315
311
  end
316
312
  end
@@ -103,10 +103,10 @@ module GraphQL
103
103
  end
104
104
 
105
105
  def global_id_field(field_name, **kwargs)
106
- id_resolver = GraphQL::Relay::GlobalIdResolve.new(type: self)
106
+ type = self
107
107
  field field_name, "ID", **kwargs, null: false
108
108
  define_method(field_name) do
109
- id_resolver.call(object, {}, context)
109
+ context.schema.id_from_object(object, type, context)
110
110
  end
111
111
  end
112
112
 
@@ -23,8 +23,6 @@ module GraphQL
23
23
  int.interfaces.each do |next_interface|
24
24
  implements(next_interface)
25
25
  end
26
- elsif int.is_a?(GraphQL::InterfaceType)
27
- new_memberships << int.type_membership_class.new(int, self, **options)
28
26
  elsif int.is_a?(String) || int.is_a?(GraphQL::Schema::LateBoundType)
29
27
  if options.any?
30
28
  raise ArgumentError, "`implements(...)` doesn't support options with late-loaded types yet. Remove #{options} and open an issue to request this feature."
@@ -8,11 +8,11 @@ module GraphQL
8
8
  validate_input(val, ctx).valid?
9
9
  end
10
10
 
11
- def validate_input(val, ctx, max_errors: nil)
11
+ def validate_input(val, ctx)
12
12
  if val.nil?
13
13
  GraphQL::Query::InputValidationResult.new
14
14
  else
15
- validate_non_null_input(val, ctx, max_errors: max_errors) || Query::InputValidationResult::VALID
15
+ validate_non_null_input(val, ctx)
16
16
  end
17
17
  end
18
18
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'graphql/schema/member/accepts_definition'
3
2
  require 'graphql/schema/member/base_dsl_methods'
4
- require 'graphql/schema/member/cached_graphql_definition'
5
3
  require 'graphql/schema/member/graphql_type_names'
6
4
  require 'graphql/schema/member/has_ast_node'
7
5
  require 'graphql/schema/member/has_directives'
@@ -14,7 +12,6 @@ require 'graphql/schema/member/relay_shortcuts'
14
12
  require 'graphql/schema/member/scoped'
15
13
  require 'graphql/schema/member/type_system_helpers'
16
14
  require 'graphql/schema/member/validates_input'
17
- require "graphql/relay/type_extensions"
18
15
 
19
16
  module GraphQL
20
17
  class Schema
@@ -24,8 +21,6 @@ module GraphQL
24
21
  # @api private
25
22
  class Member
26
23
  include GraphQLTypeNames
27
- extend CachedGraphQLDefinition
28
- extend GraphQL::Relay::TypeExtensions
29
24
  extend BaseDSLMethods
30
25
  extend BaseDSLMethods::ConfigurationExtension
31
26
  introspection(false)
@@ -41,5 +36,4 @@ end
41
36
 
42
37
  require 'graphql/schema/member/has_arguments'
43
38
  require 'graphql/schema/member/has_fields'
44
- require 'graphql/schema/member/instrumentation'
45
39
  require 'graphql/schema/member/build_type'
@@ -63,15 +63,6 @@ module GraphQL
63
63
  extend GraphQL::Schema::Resolver::HasPayloadType
64
64
 
65
65
  class << self
66
- # Override this method to handle legacy-style usages of `MyMutation.field`
67
- def field(*args, **kwargs, &block)
68
- if args.empty?
69
- raise ArgumentError, "#{name}.field is used for adding fields to this mutation. Use `mutation: #{name}` to attach this mutation instead."
70
- else
71
- super
72
- end
73
- end
74
-
75
66
  def visible?(context)
76
67
  true
77
68
  end
@@ -8,13 +8,7 @@ module GraphQL
8
8
  class NonNull < GraphQL::Schema::Wrapper
9
9
  include Schema::Member::ValidatesInput
10
10
 
11
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
12
-
13
- def to_graphql
14
- @of_type.graphql_definition(silence_deprecation_warning: true).to_non_null_type
15
- end
16
-
17
- # @return [GraphQL::TypeKinds::NON_NULL]
11
+ # @return [GraphQL::TypeKinds::NON_NULL]
18
12
  def kind
19
13
  GraphQL::TypeKinds::NON_NULL
20
14
  end
@@ -37,13 +31,13 @@ module GraphQL
37
31
  "#<#{self.class.name} @of_type=#{@of_type.inspect}>"
38
32
  end
39
33
 
40
- def validate_input(value, ctx, max_errors: nil)
34
+ def validate_input(value, ctx)
41
35
  if value.nil?
42
36
  result = GraphQL::Query::InputValidationResult.new
43
37
  result.add_problem("Expected value to not be null")
44
38
  result
45
39
  else
46
- of_type.validate_input(value, ctx, max_errors: max_errors)
40
+ of_type.validate_input(value, ctx)
47
41
  end
48
42
  end
49
43
 
@@ -5,7 +5,6 @@ require "graphql/query/null_context"
5
5
  module GraphQL
6
6
  class Schema
7
7
  class Object < GraphQL::Schema::Member
8
- extend GraphQL::Schema::Member::AcceptsDefinition
9
8
  extend GraphQL::Schema::Member::HasFields
10
9
  extend GraphQL::Schema::Member::HasInterfaces
11
10
 
@@ -104,45 +103,6 @@ module GraphQL
104
103
  super
105
104
  end
106
105
 
107
- # @return [Hash<String => GraphQL::Schema::Field>] All of this object's fields, indexed by name
108
- # @see get_field A faster way to find one field by name ({#fields} merges hashes of inherited fields; {#get_field} just looks up one field.)
109
- def fields(context = GraphQL::Query::NullContext)
110
- all_fields = super
111
- # This adds fields from legacy-style interfaces only.
112
- # Multi-fields are not supported here.
113
- interfaces.each do |int|
114
- if int.is_a?(GraphQL::InterfaceType)
115
- int_f = {}
116
- int.fields.each do |name, legacy_field| # rubocop:disable Development/ContextIsPassedCop -- legacy-related
117
- int_f[name] = field_class.from_options(name, field: legacy_field)
118
- end
119
- all_fields = int_f.merge(all_fields)
120
- end
121
- end
122
- all_fields
123
- end
124
-
125
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
126
-
127
- # @return [GraphQL::ObjectType]
128
- def to_graphql
129
- obj_type = GraphQL::ObjectType.new
130
- obj_type.name = graphql_name
131
- obj_type.description = description
132
- obj_type.structural_interface_type_memberships = interface_type_memberships
133
- obj_type.introspection = introspection
134
- obj_type.mutation = mutation
135
- obj_type.ast_node = ast_node
136
- fields.each do |field_name, field_inst| # rubocop:disable Development/ContextIsPassedCop -- legacy-related
137
- field_defn = field_inst.to_graphql(silence_deprecation_warning: true)
138
- obj_type.fields[field_defn.name] = field_defn # rubocop:disable Development/ContextIsPassedCop -- legacy-related
139
- end
140
-
141
- obj_type.metadata[:type_class] = self
142
-
143
- obj_type
144
- end
145
-
146
106
  def kind
147
107
  GraphQL::TypeKinds::OBJECT
148
108
  end
@@ -29,25 +29,19 @@ module GraphQL
29
29
  # Override {GraphQL::Schema::Resolver#resolve_with_support} to
30
30
  # delete `client_mutation_id` from the kwargs.
31
31
  def resolve_with_support(**inputs)
32
- # Without the interpreter, the inputs are unwrapped by an instrumenter.
33
- # But when using the interpreter, no instrumenters are applied.
34
- if context.interpreter?
35
- input = inputs[:input].to_kwargs
36
-
37
- new_extras = field ? field.extras : []
38
- all_extras = self.class.extras + new_extras
39
-
40
- # Transfer these from the top-level hash to the
41
- # shortcutted `input:` object
42
- all_extras.each do |ext|
43
- # It's possible that the `extra` was not passed along by this point,
44
- # don't re-add it if it wasn't given here.
45
- if inputs.key?(ext)
46
- input[ext] = inputs[ext]
47
- end
32
+ input = inputs[:input].to_kwargs
33
+
34
+ new_extras = field ? field.extras : []
35
+ all_extras = self.class.extras + new_extras
36
+
37
+ # Transfer these from the top-level hash to the
38
+ # shortcutted `input:` object
39
+ all_extras.each do |ext|
40
+ # It's possible that the `extra` was not passed along by this point,
41
+ # don't re-add it if it wasn't given here.
42
+ if inputs.key?(ext)
43
+ input[ext] = inputs[ext]
48
44
  end
49
- else
50
- input = inputs
51
45
  end
52
46
 
53
47
  if input
@@ -66,17 +60,12 @@ module GraphQL
66
60
  super()
67
61
  end
68
62
 
69
- # Again, this is done by an instrumenter when using non-interpreter execution.
70
- if context.interpreter?
71
- context.schema.after_lazy(return_value) do |return_hash|
72
- # It might be an error
73
- if return_hash.is_a?(Hash)
74
- return_hash[:client_mutation_id] = client_mutation_id
75
- end
76
- return_hash
63
+ context.schema.after_lazy(return_value) do |return_hash|
64
+ # It might be an error
65
+ if return_hash.is_a?(Hash)
66
+ return_hash[:client_mutation_id] = client_mutation_id
77
67
  end
78
- else
79
- return_value
68
+ return_hash
80
69
  end
81
70
  end
82
71
 
@@ -2,7 +2,6 @@
2
2
  module GraphQL
3
3
  class Schema
4
4
  class Scalar < GraphQL::Schema::Member
5
- extend GraphQL::Schema::Member::AcceptsDefinition
6
5
  extend GraphQL::Schema::Member::ValidatesInput
7
6
 
8
7
  class << self
@@ -14,20 +13,6 @@ module GraphQL
14
13
  val
15
14
  end
16
15
 
17
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
18
-
19
- def to_graphql
20
- type_defn = GraphQL::ScalarType.new
21
- type_defn.name = graphql_name
22
- type_defn.description = description
23
- type_defn.coerce_result = method(:coerce_result)
24
- type_defn.coerce_input = method(:coerce_input)
25
- type_defn.metadata[:type_class] = self
26
- type_defn.default_scalar = default_scalar
27
- type_defn.ast_node = ast_node
28
- type_defn
29
- end
30
-
31
16
  def kind
32
17
  GraphQL::TypeKinds::SCALAR
33
18
  end
@@ -55,7 +40,7 @@ module GraphQL
55
40
  @default_scalar ||= false
56
41
  end
57
42
 
58
- def validate_non_null_input(value, ctx, max_errors: nil)
43
+ def validate_non_null_input(value, ctx)
59
44
  result = Query::InputValidationResult.new
60
45
  coerced_result = begin
61
46
  ctx.query.with_error_handling do
@@ -2,7 +2,6 @@
2
2
  module GraphQL
3
3
  class Schema
4
4
  class Union < GraphQL::Schema::Member
5
- extend GraphQL::Schema::Member::AcceptsDefinition
6
5
  extend GraphQL::Schema::Member::HasUnresolvedTypeError
7
6
 
8
7
  class << self
@@ -33,21 +32,6 @@ module GraphQL
33
32
  type_memberships.map(&:object_type)
34
33
  end
35
34
 
36
- prepend GraphQL::Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
37
-
38
- def to_graphql
39
- type_defn = GraphQL::UnionType.new
40
- type_defn.name = graphql_name
41
- type_defn.description = description
42
- type_defn.ast_node = ast_node
43
- type_defn.type_memberships = type_memberships
44
- if respond_to?(:resolve_type)
45
- type_defn.resolve_type = method(:resolve_type)
46
- end
47
- type_defn.metadata[:type_class] = self
48
- type_defn
49
- end
50
-
51
35
  def type_membership_class(membership_class = nil)
52
36
  if membership_class
53
37
  @type_membership_class = membership_class
@@ -85,7 +85,7 @@ module GraphQL
85
85
  # @param context [GraphQL::Query::Context]
86
86
  # @param schema [GraphQL::Schema]
87
87
  def initialize(filter, context:, schema:)
88
- @schema = schema.interpreter? ? schema : schema.graphql_definition
88
+ @schema = schema
89
89
  # Cache these to avoid repeated hits to the inheritance chain when one isn't present
90
90
  @query = @schema.query
91
91
  @mutation = @schema.mutation
@@ -3,7 +3,6 @@
3
3
  module GraphQL
4
4
  class Schema
5
5
  class Wrapper
6
- include GraphQL::Schema::Member::CachedGraphQLDefinition
7
6
  include GraphQL::Schema::Member::TypeSystemHelpers
8
7
 
9
8
  # @return [Class, Module] The inner type of this wrapping type, the type of which one or more objects may be present.
@@ -13,10 +12,6 @@ module GraphQL
13
12
  @of_type = of_type
14
13
  end
15
14
 
16
- def to_graphql
17
- raise GraphQL::RequiredImplementationMissingError
18
- end
19
-
20
15
  def unwrap
21
16
  @of_type.unwrap
22
17
  end