graphql 1.13.23 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) 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 +6 -13
  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/directive_type.rb +2 -2
  19. data/lib/graphql/introspection/dynamic_fields.rb +3 -8
  20. data/lib/graphql/introspection/entry_points.rb +2 -15
  21. data/lib/graphql/introspection/field_type.rb +1 -1
  22. data/lib/graphql/introspection/schema_type.rb +2 -2
  23. data/lib/graphql/introspection/type_type.rb +5 -5
  24. data/lib/graphql/language/document_from_schema_definition.rb +0 -17
  25. data/lib/graphql/pagination/connections.rb +2 -28
  26. data/lib/graphql/query/context.rb +1 -185
  27. data/lib/graphql/query/input_validation_result.rb +0 -9
  28. data/lib/graphql/query/literal_input.rb +8 -13
  29. data/lib/graphql/query/validation_pipeline.rb +6 -34
  30. data/lib/graphql/query/variable_validation_error.rb +2 -2
  31. data/lib/graphql/query/variables.rb +8 -31
  32. data/lib/graphql/query.rb +5 -34
  33. data/lib/graphql/railtie.rb +0 -104
  34. data/lib/graphql/relay/range_add.rb +0 -4
  35. data/lib/graphql/relay.rb +0 -15
  36. data/lib/graphql/schema/addition.rb +1 -8
  37. data/lib/graphql/schema/argument.rb +1 -25
  38. data/lib/graphql/schema/build_from_definition.rb +0 -1
  39. data/lib/graphql/schema/directive.rb +1 -22
  40. data/lib/graphql/schema/enum.rb +3 -19
  41. data/lib/graphql/schema/enum_value.rb +0 -22
  42. data/lib/graphql/schema/field.rb +22 -220
  43. data/lib/graphql/schema/input_object.rb +11 -57
  44. data/lib/graphql/schema/interface.rb +1 -30
  45. data/lib/graphql/schema/introspection_system.rb +3 -8
  46. data/lib/graphql/schema/late_bound_type.rb +2 -2
  47. data/lib/graphql/schema/list.rb +3 -24
  48. data/lib/graphql/schema/loader.rb +0 -1
  49. data/lib/graphql/schema/member/base_dsl_methods.rb +1 -6
  50. data/lib/graphql/schema/member/build_type.rb +4 -6
  51. data/lib/graphql/schema/member/has_arguments.rb +16 -20
  52. data/lib/graphql/schema/member/has_fields.rb +3 -3
  53. data/lib/graphql/schema/member/has_interfaces.rb +1 -13
  54. data/lib/graphql/schema/member/validates_input.rb +2 -2
  55. data/lib/graphql/schema/member.rb +0 -6
  56. data/lib/graphql/schema/mutation.rb +0 -9
  57. data/lib/graphql/schema/non_null.rb +3 -9
  58. data/lib/graphql/schema/object.rb +0 -40
  59. data/lib/graphql/schema/relay_classic_mutation.rb +17 -28
  60. data/lib/graphql/schema/scalar.rb +1 -16
  61. data/lib/graphql/schema/union.rb +0 -16
  62. data/lib/graphql/schema/warden.rb +3 -12
  63. data/lib/graphql/schema/wrapper.rb +0 -5
  64. data/lib/graphql/schema.rb +106 -945
  65. data/lib/graphql/static_validation/base_visitor.rb +4 -21
  66. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +12 -12
  67. data/lib/graphql/static_validation/validator.rb +2 -24
  68. data/lib/graphql/static_validation.rb +0 -2
  69. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
  70. data/lib/graphql/subscriptions/event.rb +1 -1
  71. data/lib/graphql/subscriptions/instrumentation.rb +0 -51
  72. data/lib/graphql/subscriptions.rb +4 -13
  73. data/lib/graphql/tracing/data_dog_tracing.rb +16 -20
  74. data/lib/graphql/tracing/platform_tracing.rb +4 -32
  75. data/lib/graphql/tracing.rb +0 -1
  76. data/lib/graphql/types/relay/connection_behaviors.rb +2 -6
  77. data/lib/graphql/types/relay/default_relay.rb +0 -10
  78. data/lib/graphql/types/relay/node_behaviors.rb +5 -1
  79. data/lib/graphql/types/relay.rb +0 -2
  80. data/lib/graphql/types/string.rb +1 -1
  81. data/lib/graphql/version.rb +1 -1
  82. data/lib/graphql.rb +1 -66
  83. metadata +28 -167
  84. data/lib/graphql/analysis/analyze_query.rb +0 -98
  85. data/lib/graphql/analysis/field_usage.rb +0 -45
  86. data/lib/graphql/analysis/max_query_complexity.rb +0 -26
  87. data/lib/graphql/analysis/max_query_depth.rb +0 -26
  88. data/lib/graphql/analysis/query_complexity.rb +0 -88
  89. data/lib/graphql/analysis/query_depth.rb +0 -43
  90. data/lib/graphql/analysis/reducer_state.rb +0 -48
  91. data/lib/graphql/argument.rb +0 -131
  92. data/lib/graphql/authorization.rb +0 -82
  93. data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
  94. data/lib/graphql/backwards_compatibility.rb +0 -61
  95. data/lib/graphql/base_type.rb +0 -232
  96. data/lib/graphql/boolean_type.rb +0 -2
  97. data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
  98. data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
  99. data/lib/graphql/compatibility/execution_specification.rb +0 -436
  100. data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
  101. data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
  102. data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
  103. data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
  104. data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
  105. data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
  106. data/lib/graphql/compatibility.rb +0 -5
  107. data/lib/graphql/define/assign_argument.rb +0 -12
  108. data/lib/graphql/define/assign_connection.rb +0 -13
  109. data/lib/graphql/define/assign_enum_value.rb +0 -18
  110. data/lib/graphql/define/assign_global_id_field.rb +0 -11
  111. data/lib/graphql/define/assign_mutation_function.rb +0 -34
  112. data/lib/graphql/define/assign_object_field.rb +0 -42
  113. data/lib/graphql/define/defined_object_proxy.rb +0 -53
  114. data/lib/graphql/define/instance_definable.rb +0 -255
  115. data/lib/graphql/define/no_definition_error.rb +0 -7
  116. data/lib/graphql/define/non_null_with_bang.rb +0 -16
  117. data/lib/graphql/define/type_definer.rb +0 -31
  118. data/lib/graphql/define.rb +0 -31
  119. data/lib/graphql/deprecated_dsl.rb +0 -55
  120. data/lib/graphql/directive/deprecated_directive.rb +0 -2
  121. data/lib/graphql/directive/include_directive.rb +0 -2
  122. data/lib/graphql/directive/skip_directive.rb +0 -2
  123. data/lib/graphql/directive.rb +0 -107
  124. data/lib/graphql/enum_type.rb +0 -133
  125. data/lib/graphql/execution/execute.rb +0 -333
  126. data/lib/graphql/execution/flatten.rb +0 -40
  127. data/lib/graphql/execution/typecast.rb +0 -50
  128. data/lib/graphql/field/resolve.rb +0 -59
  129. data/lib/graphql/field.rb +0 -226
  130. data/lib/graphql/float_type.rb +0 -2
  131. data/lib/graphql/function.rb +0 -128
  132. data/lib/graphql/id_type.rb +0 -2
  133. data/lib/graphql/input_object_type.rb +0 -138
  134. data/lib/graphql/int_type.rb +0 -2
  135. data/lib/graphql/interface_type.rb +0 -72
  136. data/lib/graphql/internal_representation/document.rb +0 -27
  137. data/lib/graphql/internal_representation/node.rb +0 -206
  138. data/lib/graphql/internal_representation/print.rb +0 -51
  139. data/lib/graphql/internal_representation/rewrite.rb +0 -184
  140. data/lib/graphql/internal_representation/scope.rb +0 -88
  141. data/lib/graphql/internal_representation/visit.rb +0 -36
  142. data/lib/graphql/internal_representation.rb +0 -7
  143. data/lib/graphql/list_type.rb +0 -80
  144. data/lib/graphql/non_null_type.rb +0 -71
  145. data/lib/graphql/object_type.rb +0 -130
  146. data/lib/graphql/query/arguments.rb +0 -189
  147. data/lib/graphql/query/arguments_cache.rb +0 -24
  148. data/lib/graphql/query/executor.rb +0 -52
  149. data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
  150. data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
  151. data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
  152. data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
  153. data/lib/graphql/query/serial_execution.rb +0 -40
  154. data/lib/graphql/relay/array_connection.rb +0 -83
  155. data/lib/graphql/relay/base_connection.rb +0 -189
  156. data/lib/graphql/relay/connection_instrumentation.rb +0 -54
  157. data/lib/graphql/relay/connection_resolve.rb +0 -43
  158. data/lib/graphql/relay/connection_type.rb +0 -54
  159. data/lib/graphql/relay/edge.rb +0 -27
  160. data/lib/graphql/relay/edge_type.rb +0 -19
  161. data/lib/graphql/relay/edges_instrumentation.rb +0 -39
  162. data/lib/graphql/relay/global_id_resolve.rb +0 -17
  163. data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
  164. data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
  165. data/lib/graphql/relay/mutation/resolve.rb +0 -56
  166. data/lib/graphql/relay/mutation/result.rb +0 -38
  167. data/lib/graphql/relay/mutation.rb +0 -106
  168. data/lib/graphql/relay/node.rb +0 -39
  169. data/lib/graphql/relay/page_info.rb +0 -7
  170. data/lib/graphql/relay/relation_connection.rb +0 -188
  171. data/lib/graphql/relay/type_extensions.rb +0 -32
  172. data/lib/graphql/scalar_type.rb +0 -91
  173. data/lib/graphql/schema/catchall_middleware.rb +0 -35
  174. data/lib/graphql/schema/default_parse_error.rb +0 -10
  175. data/lib/graphql/schema/default_type_error.rb +0 -17
  176. data/lib/graphql/schema/member/accepts_definition.rb +0 -164
  177. data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -58
  178. data/lib/graphql/schema/member/instrumentation.rb +0 -131
  179. data/lib/graphql/schema/middleware_chain.rb +0 -82
  180. data/lib/graphql/schema/possible_types.rb +0 -44
  181. data/lib/graphql/schema/rescue_middleware.rb +0 -60
  182. data/lib/graphql/schema/timeout_middleware.rb +0 -88
  183. data/lib/graphql/schema/traversal.rb +0 -228
  184. data/lib/graphql/schema/validation.rb +0 -313
  185. data/lib/graphql/static_validation/default_visitor.rb +0 -15
  186. data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
  187. data/lib/graphql/string_type.rb +0 -2
  188. data/lib/graphql/subscriptions/subscription_root.rb +0 -76
  189. data/lib/graphql/tracing/skylight_tracing.rb +0 -70
  190. data/lib/graphql/types/relay/node_field.rb +0 -24
  191. data/lib/graphql/types/relay/nodes_field.rb +0 -43
  192. data/lib/graphql/union_type.rb +0 -115
  193. data/lib/graphql/upgrader/member.rb +0 -937
  194. data/lib/graphql/upgrader/schema.rb +0 -38
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  module GraphQL
4
3
  class Railtie < Rails::Railtie
5
4
  config.before_configuration do
@@ -10,108 +9,5 @@ module GraphQL
10
9
  Language::Parser.cache ||= Language::Cache.new(Pathname.new(Bootsnap::CompileCache::ISeq.cache_dir).join('graphql'))
11
10
  end
12
11
  end
13
-
14
- rake_tasks do
15
- # Defer this so that you only need the `parser` gem when you _run_ the upgrader
16
- def load_upgraders
17
- require_relative './upgrader/member'
18
- require_relative './upgrader/schema'
19
- end
20
-
21
- namespace :graphql do
22
- task :upgrade, [:dir] do |t, args|
23
- unless (dir = args[:dir])
24
- fail 'You have to give me a directory where your GraphQL schema and types live. ' \
25
- 'For example: `bin/rake graphql:upgrade[app/graphql/**/*]`'
26
- end
27
-
28
- Dir[dir].each do |file|
29
- # Members (types, interfaces, etc.)
30
- if file =~ /.*_(type|interface|enum|union|)\.rb$/
31
- Rake::Task["graphql:upgrade:member"].execute(Struct.new(:member_file).new(file))
32
- end
33
- end
34
-
35
- puts "Upgrade complete! Note that this is a best-effort approach, and may very well contain some bugs."
36
- puts "Don't forget to create the base objects. For example, you could run:"
37
- puts "\tbin/rake graphql:upgrade:create_base_objects[app/graphql]"
38
- end
39
-
40
- namespace :upgrade do
41
- task :create_base_objects, [:base_dir] do |t, args|
42
- unless (base_dir = args[:base_dir])
43
- fail 'You have to give me a directory where your GraphQL types live. ' \
44
- 'For example: `bin/rake graphql:upgrade:create_base_objects[app/graphql]`'
45
- end
46
-
47
- destination_file = File.join(base_dir, "types", "base_scalar.rb")
48
- unless File.exists?(destination_file)
49
- FileUtils.mkdir_p(File.dirname(destination_file))
50
- File.open(destination_file, 'w') do |f|
51
- f.puts "class Types::BaseScalar < GraphQL::Schema::Scalar\nend"
52
- end
53
- end
54
-
55
- destination_file = File.join(base_dir, "types", "base_input_object.rb")
56
- unless File.exists?(destination_file)
57
- FileUtils.mkdir_p(File.dirname(destination_file))
58
- File.open(destination_file, 'w') do |f|
59
- f.puts "class Types::BaseInputObject < GraphQL::Schema::InputObject\nend"
60
- end
61
- end
62
-
63
- destination_file = File.join(base_dir, "types", "base_enum.rb")
64
- unless File.exists?(destination_file)
65
- FileUtils.mkdir_p(File.dirname(destination_file))
66
- File.open(destination_file, 'w') do |f|
67
- f.puts "class Types::BaseEnum < GraphQL::Schema::Enum\nend"
68
- end
69
- end
70
-
71
- destination_file = File.join(base_dir, "types", "base_union.rb")
72
- unless File.exists?(destination_file)
73
- FileUtils.mkdir_p(File.dirname(destination_file))
74
- File.open(destination_file, 'w') do |f|
75
- f.puts "class Types::BaseUnion < GraphQL::Schema::Union\nend"
76
- end
77
- end
78
-
79
- destination_file = File.join(base_dir, "types", "base_interface.rb")
80
- unless File.exists?(destination_file)
81
- FileUtils.mkdir_p(File.dirname(destination_file))
82
- File.open(destination_file, 'w') do |f|
83
- f.puts "module Types::BaseInterface\n include GraphQL::Schema::Interface\nend"
84
- end
85
- end
86
-
87
- destination_file = File.join(base_dir, "types", "base_object.rb")
88
- unless File.exists?(destination_file)
89
- File.open(destination_file, 'w') do |f|
90
- f.puts "class Types::BaseObject < GraphQL::Schema::Object\nend"
91
- end
92
- end
93
- end
94
-
95
- task :schema, [:schema_file] do |t, args|
96
- schema_file = args.schema_file
97
- load_upgraders
98
- upgrader = GraphQL::Upgrader::Schema.new File.read(schema_file)
99
-
100
- puts "- Transforming schema #{schema_file}"
101
- File.open(schema_file, 'w') { |f| f.write upgrader.upgrade }
102
- end
103
-
104
- task :member, [:member_file] do |t, args|
105
- member_file = args.member_file
106
- load_upgraders
107
- upgrader = GraphQL::Upgrader::Member.new File.read(member_file)
108
- next unless upgrader.upgradeable?
109
-
110
- puts "- Transforming member #{member_file}"
111
- File.open(member_file, 'w') { |f| f.write upgrader.upgrade }
112
- end
113
- end
114
- end
115
- end
116
12
  end
117
13
  end
@@ -35,10 +35,6 @@ module GraphQL
35
35
  # @param context [GraphQL::Query::Context] The surrounding `ctx`, will be passed to the connection if provided (this is required for cursor encoders)
36
36
  # @param edge_class [Class] The class to wrap `item` with (defaults to the connection's edge class)
37
37
  def initialize(collection:, item:, parent: nil, context: nil, edge_class: nil)
38
- if context.nil?
39
- caller_loc = caller(2, 1).first
40
- GraphQL::Deprecation.warn("`context: ...` will be required by `RangeAdd.new` in GraphQL-Ruby 2.0. Add `context: context` to the call at #{caller_loc}.")
41
- end
42
38
  if context && context.schema.new_connections?
43
39
  conn_class = context.schema.connections.wrapper_for(collection)
44
40
  # The rest will be added by ConnectionExtension
data/lib/graphql/relay.rb CHANGED
@@ -1,18 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'graphql/relay/page_info'
4
- require 'graphql/relay/edge'
5
- require 'graphql/relay/edge_type'
6
- require 'graphql/relay/edges_instrumentation'
7
- require 'graphql/relay/base_connection'
8
- require 'graphql/relay/array_connection'
9
3
  require 'graphql/relay/range_add'
10
- require 'graphql/relay/relation_connection'
11
- require 'graphql/relay/mongo_relation_connection'
12
- require 'graphql/relay/global_id_resolve'
13
- require 'graphql/relay/mutation'
14
- require 'graphql/relay/node'
15
- require 'graphql/relay/connection_instrumentation'
16
- require 'graphql/relay/connection_resolve'
17
- require 'graphql/relay/connection_type'
18
- require 'graphql/relay/type_extensions'
@@ -136,14 +136,7 @@ module GraphQL
136
136
  end
137
137
 
138
138
  def add_type(type, owner:, late_types:, path:)
139
- if type.respond_to?(:metadata) && type.metadata.is_a?(Hash)
140
- type_class = type.metadata[:type_class]
141
- if type_class.nil?
142
- raise ArgumentError, "Can't add legacy type: #{type} (#{type.class})"
143
- else
144
- type = type_class
145
- end
146
- elsif type.is_a?(String) || type.is_a?(GraphQL::Schema::LateBoundType)
139
+ if type.is_a?(String) || type.is_a?(GraphQL::Schema::LateBoundType)
147
140
  late_types << [owner, type]
148
141
  return
149
142
  end
@@ -2,8 +2,6 @@
2
2
  module GraphQL
3
3
  class Schema
4
4
  class Argument
5
- include GraphQL::Schema::Member::CachedGraphQLDefinition
6
- include GraphQL::Schema::Member::AcceptsDefinition
7
5
  include GraphQL::Schema::Member::HasPath
8
6
  include GraphQL::Schema::Member::HasAstNode
9
7
  include GraphQL::Schema::Member::HasDirectives
@@ -44,12 +42,11 @@ module GraphQL
44
42
  # @param prepare [Symbol] A method to call to transform this argument's valuebefore sending it to field resolution
45
43
  # @param camelize [Boolean] if true, the name will be camelized when building the schema
46
44
  # @param from_resolver [Boolean] if true, a Resolver class defined this argument
47
- # @param method_access [Boolean] If false, don't build method access on legacy {Query::Arguments} instances.
48
45
  # @param directives [Hash{Class => Hash}]
49
46
  # @param deprecation_reason [String]
50
47
  # @param validates [Hash, nil] Options for building validators, if any should be applied
51
48
  # @param replace_null_with_default [Boolean] if `true`, incoming values of `null` will be replaced with the configured `default_value`
52
- def initialize(arg_name = nil, type_expr = nil, desc = nil, required: true, type: nil, name: nil, loads: nil, description: nil, ast_node: nil, default_value: NO_DEFAULT, as: nil, from_resolver: false, camelize: true, prepare: nil, method_access: true, owner:, validates: nil, directives: nil, deprecation_reason: nil, replace_null_with_default: false, &definition_block)
49
+ def initialize(arg_name = nil, type_expr = nil, desc = nil, required: true, type: nil, name: nil, loads: nil, description: nil, ast_node: nil, default_value: NO_DEFAULT, as: nil, from_resolver: false, camelize: true, prepare: nil, owner:, validates: nil, directives: nil, deprecation_reason: nil, replace_null_with_default: false, &definition_block)
53
50
  arg_name ||= name
54
51
  @name = -(camelize ? Member::BuildType.camelize(arg_name.to_s) : arg_name.to_s)
55
52
  @type_expr = type_expr || type
@@ -70,7 +67,6 @@ module GraphQL
70
67
  @prepare = prepare
71
68
  @ast_node = ast_node
72
69
  @from_resolver = from_resolver
73
- @method_access = method_access
74
70
  self.deprecation_reason = deprecation_reason
75
71
 
76
72
  if directives
@@ -169,26 +165,6 @@ module GraphQL
169
165
  true
170
166
  end
171
167
 
172
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
173
-
174
- def to_graphql
175
- argument = GraphQL::Argument.new
176
- argument.name = @name
177
- argument.type = -> { type }
178
- argument.description = @description
179
- argument.metadata[:type_class] = self
180
- argument.as = @as
181
- argument.ast_node = ast_node
182
- argument.method_access = @method_access
183
- if NO_DEFAULT != @default_value
184
- argument.default_value = @default_value
185
- end
186
- if self.deprecation_reason
187
- argument.deprecation_reason = self.deprecation_reason
188
- end
189
- argument
190
- end
191
-
192
168
  def type=(new_type)
193
169
  validate_input_type(new_type)
194
170
  # This isn't true for LateBoundTypes, but we can assume those will
@@ -365,7 +365,6 @@ module GraphQL
365
365
  deprecation_reason: builder.build_deprecation_reason(argument_defn.directives),
366
366
  ast_node: argument_defn,
367
367
  camelize: false,
368
- method_access: false,
369
368
  directives: prepare_directives(argument_defn, type_resolver),
370
369
  **default_value_kwargs
371
370
  )
@@ -8,7 +8,6 @@ module GraphQL
8
8
  # - {.resolve}: Wraps field resolution (so it should call `yield` to continue)
9
9
  class Directive < GraphQL::Schema::Member
10
10
  extend GraphQL::Schema::Member::HasArguments
11
- extend GraphQL::Schema::Member::AcceptsDefinition
12
11
 
13
12
  class << self
14
13
  # Directives aren't types, they don't have kinds.
@@ -22,7 +21,7 @@ module GraphQL
22
21
  # but downcase the first letter.
23
22
  def default_graphql_name
24
23
  @default_graphql_name ||= begin
25
- camelized_name = super.dup
24
+ camelized_name = super
26
25
  camelized_name[0] = camelized_name[0].downcase
27
26
  camelized_name
28
27
  end
@@ -55,26 +54,6 @@ module GraphQL
55
54
  default_directive
56
55
  end
57
56
 
58
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
59
-
60
- def to_graphql
61
- defn = GraphQL::Directive.new
62
- defn.name = self.graphql_name
63
- defn.description = self.description
64
- defn.locations = self.locations
65
- defn.default_directive = self.default_directive
66
- defn.ast_node = ast_node
67
- defn.metadata[:type_class] = self
68
- all_argument_definitions.each do |arg_defn|
69
- arg_graphql = arg_defn.to_graphql(silence_deprecation_warning: true)
70
- defn.arguments[arg_graphql.name] = arg_graphql # rubocop:disable Development/ContextIsPassedCop -- legacy-related
71
- end
72
- # Make a reference to a classic-style Arguments class
73
- defn.arguments_class = GraphQL::Query::Arguments.construct_arguments_class(defn)
74
-
75
- defn
76
- end
77
-
78
57
  # If false, this part of the query won't be evaluated
79
58
  def include?(_object, arguments, context)
80
59
  static_include?(arguments, context)
@@ -20,10 +20,9 @@ module GraphQL
20
20
  # end
21
21
  class Schema
22
22
  class Enum < GraphQL::Schema::Member
23
- extend GraphQL::Schema::Member::AcceptsDefinition
24
23
  extend GraphQL::Schema::Member::ValidatesInput
25
24
 
26
- class UnresolvedValueError < GraphQL::EnumType::UnresolvedValueError
25
+ class UnresolvedValueError < GraphQL::Error
27
26
  def initialize(value:, enum:, context:)
28
27
  fix_message = ", but this isn't a valid value for `#{enum.graphql_name}`. Update the field or resolver to return one of `#{enum.graphql_name}`'s values instead."
29
28
  message = if (cp = context[:current_path]) && (cf = context[:current_field])
@@ -108,22 +107,6 @@ module GraphQL
108
107
  enum_values(context).each_with_object({}) { |val, obj| obj[val.graphql_name] = val }
109
108
  end
110
109
 
111
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
112
-
113
- # @return [GraphQL::EnumType]
114
- def to_graphql
115
- enum_type = GraphQL::EnumType.new
116
- enum_type.name = graphql_name
117
- enum_type.description = description
118
- enum_type.introspection = introspection
119
- enum_type.ast_node = ast_node
120
- values.each do |name, val|
121
- enum_type.add_value(val.deprecated_to_graphql)
122
- end
123
- enum_type.metadata[:type_class] = self
124
- enum_type
125
- end
126
-
127
110
  # @return [Class] for handling `value(...)` inputs and building `GraphQL::Enum::EnumValue`s out of them
128
111
  def enum_value_class(new_enum_value_class = nil)
129
112
  if new_enum_value_class
@@ -139,8 +122,9 @@ module GraphQL
139
122
  GraphQL::TypeKinds::ENUM
140
123
  end
141
124
 
142
- def validate_non_null_input(value_name, ctx, max_errors: nil)
125
+ def validate_non_null_input(value_name, ctx)
143
126
  result = GraphQL::Query::InputValidationResult.new
127
+
144
128
  allowed_values = ctx.warden.enum_values(self)
145
129
  matching_value = allowed_values.find { |v| v.graphql_name == value_name }
146
130
 
@@ -13,12 +13,6 @@ module GraphQL
13
13
  # # arguments to `value(...)` in Enum classes are passed here
14
14
  # super
15
15
  # end
16
- #
17
- # def to_graphql
18
- # enum_value = super
19
- # # customize the derived GraphQL::EnumValue here
20
- # enum_value
21
- # end
22
16
  # end
23
17
  #
24
18
  # class BaseEnum < GraphQL::Schema::Enum
@@ -26,8 +20,6 @@ module GraphQL
26
20
  # enum_value_class CustomEnumValue
27
21
  # end
28
22
  class EnumValue < GraphQL::Schema::Member
29
- include GraphQL::Schema::Member::CachedGraphQLDefinition
30
- include GraphQL::Schema::Member::AcceptsDefinition
31
23
  include GraphQL::Schema::Member::HasPath
32
24
  include GraphQL::Schema::Member::HasAstNode
33
25
  include GraphQL::Schema::Member::HasDirectives
@@ -73,20 +65,6 @@ module GraphQL
73
65
  @value
74
66
  end
75
67
 
76
- prepend Schema::Member::CachedGraphQLDefinition::DeprecatedToGraphQL
77
-
78
- # @return [GraphQL::EnumType::EnumValue] A runtime-ready object derived from this object
79
- def to_graphql
80
- enum_value = GraphQL::EnumType::EnumValue.new
81
- enum_value.name = @graphql_name
82
- enum_value.description = @description
83
- enum_value.value = @value
84
- enum_value.deprecation_reason = self.deprecation_reason
85
- enum_value.metadata[:type_class] = self
86
- enum_value.ast_node = ast_node
87
- enum_value
88
- end
89
-
90
68
  def inspect
91
69
  "#<#{self.class} #{path} @value=#{@value.inspect}#{description ? " @description=#{description.inspect}" : ""}>"
92
70
  end