graphql 1.9.17 → 1.9.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/argument.rb +2 -2
- data/lib/graphql/define/assign_object_field.rb +2 -2
- data/lib/graphql/define/defined_object_proxy.rb +8 -2
- data/lib/graphql/define/instance_definable.rb +6 -1
- data/lib/graphql/execution/execute.rb +1 -1
- data/lib/graphql/execution/multiplex.rb +3 -3
- data/lib/graphql/language/document_from_schema_definition.rb +9 -3
- data/lib/graphql/language/nodes.rb +2 -2
- data/lib/graphql/query.rb +0 -1
- data/lib/graphql/query/context.rb +2 -5
- data/lib/graphql/relay/node.rb +2 -2
- data/lib/graphql/schema.rb +46 -5
- data/lib/graphql/schema/build_from_definition.rb +26 -9
- data/lib/graphql/schema/directive.rb +7 -1
- data/lib/graphql/schema/introspection_system.rb +4 -1
- data/lib/graphql/schema/loader.rb +9 -3
- data/lib/graphql/schema/mutation.rb +1 -1
- data/lib/graphql/schema/relay_classic_mutation.rb +1 -1
- data/lib/graphql/schema/resolver.rb +1 -1
- data/lib/graphql/schema/subscription.rb +5 -5
- data/lib/graphql/schema/type_membership.rb +1 -1
- data/lib/graphql/schema/union.rb +1 -1
- data/lib/graphql/subscriptions.rb +2 -2
- data/lib/graphql/union_type.rb +11 -4
- data/lib/graphql/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dac791a669cb749de7dbbadbff748e28661e952b13a39ca288d94dd062a6f091
|
4
|
+
data.tar.gz: 4b95ab1279ba396004a3e0c1e3093ebbd45cdb07f3080e3445eb5c1d9a055741
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee1e35c609f8cb231bbcddf1349f74911f0979a5811046de0172912ea984bd20b2034173be2e3722bcf323b582b0bf072fb1849e5c4bfa0d141a24006b412a5f
|
7
|
+
data.tar.gz: 91b97da692780076730ff580cfb5281f6116ee85ea097b1d7eaeed16c9f57f4ea936b6da9bc20c1015d8a63638eb054c096e47c2e802afea06ce76956e5753eb
|
data/lib/graphql/argument.rb
CHANGED
@@ -134,9 +134,9 @@ module GraphQL
|
|
134
134
|
end
|
135
135
|
|
136
136
|
if type_or_argument.is_a?(GraphQL::Argument)
|
137
|
-
type_or_argument.redefine(kwargs, &block)
|
137
|
+
type_or_argument.redefine(**kwargs, &block)
|
138
138
|
else
|
139
|
-
GraphQL::Argument.define(kwargs, &block)
|
139
|
+
GraphQL::Argument.define(**kwargs, &block)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
@@ -32,10 +32,16 @@ module GraphQL
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Lookup a function from the dictionary and call it if it's found.
|
35
|
-
def method_missing(name, *args, &block)
|
35
|
+
def method_missing(name, *args, **kwargs, &block)
|
36
36
|
definition = @dictionary[name]
|
37
37
|
if definition
|
38
|
-
|
38
|
+
# Avoid passing `kwargs` when it's not used.
|
39
|
+
# Ruby 2.7 does fine here, but older Rubies receive too many arguments.
|
40
|
+
if kwargs.any?
|
41
|
+
definition.call(@target, *args, **kwargs, &block)
|
42
|
+
else
|
43
|
+
definition.call(@target, *args, &block)
|
44
|
+
end
|
39
45
|
else
|
40
46
|
msg = "#{@target.class.name} can't define '#{name}'"
|
41
47
|
raise NoDefinitionError, msg, caller
|
@@ -154,7 +154,12 @@ module GraphQL
|
|
154
154
|
defn_proxy = DefinedObjectProxy.new(self)
|
155
155
|
# Apply definition from `define(...)` kwargs
|
156
156
|
defn.define_keywords.each do |keyword, value|
|
157
|
-
|
157
|
+
# Don't splat string hashes, which blows up on Rubies before 2.7
|
158
|
+
if value.is_a?(Hash) && value.each_key.all? { |k| k.is_a?(Symbol) }
|
159
|
+
defn_proxy.public_send(keyword, **value)
|
160
|
+
else
|
161
|
+
defn_proxy.public_send(keyword, value)
|
162
|
+
end
|
158
163
|
end
|
159
164
|
# and/or apply definition from `define { ... }` block
|
160
165
|
if defn.define_proc
|
@@ -20,7 +20,7 @@ module GraphQL
|
|
20
20
|
|
21
21
|
def execute(ast_operation, root_type, query)
|
22
22
|
result = resolve_root_selection(query)
|
23
|
-
lazy_resolve_root_selection(result, {query: query})
|
23
|
+
lazy_resolve_root_selection(result, **{query: query})
|
24
24
|
GraphQL::Execution::Flatten.call(query.context)
|
25
25
|
end
|
26
26
|
|
@@ -44,9 +44,9 @@ module GraphQL
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class << self
|
47
|
-
def run_all(schema, query_options,
|
48
|
-
queries = query_options.map { |opts| GraphQL::Query.new(schema, nil, opts) }
|
49
|
-
run_queries(schema, queries,
|
47
|
+
def run_all(schema, query_options, **kwargs)
|
48
|
+
queries = query_options.map { |opts| GraphQL::Query.new(schema, nil, **opts) }
|
49
|
+
run_queries(schema, queries, **kwargs)
|
50
50
|
end
|
51
51
|
|
52
52
|
# @param schema [GraphQL::Schema]
|
@@ -23,10 +23,16 @@ module GraphQL
|
|
23
23
|
@include_built_in_scalars = include_built_in_scalars
|
24
24
|
@include_built_in_directives = include_built_in_directives
|
25
25
|
|
26
|
+
filter = GraphQL::Filter.new(only: only, except: except)
|
27
|
+
if @schema.respond_to?(:visible?)
|
28
|
+
filter = filter.merge(only: @schema.method(:visible?))
|
29
|
+
end
|
30
|
+
|
31
|
+
schema_context = schema.context_class.new(query: nil, object: nil, schema: schema, values: context)
|
26
32
|
@warden = GraphQL::Schema::Warden.new(
|
27
|
-
|
33
|
+
filter,
|
28
34
|
schema: @schema,
|
29
|
-
context:
|
35
|
+
context: schema_context,
|
30
36
|
)
|
31
37
|
end
|
32
38
|
|
@@ -250,7 +256,7 @@ module GraphQL
|
|
250
256
|
definitions = []
|
251
257
|
definitions << build_schema_node if include_schema_node?
|
252
258
|
definitions += build_directive_nodes(warden.directives)
|
253
|
-
definitions += build_type_definition_nodes(warden.
|
259
|
+
definitions += build_type_definition_nodes(warden.reachable_types)
|
254
260
|
definitions
|
255
261
|
end
|
256
262
|
|
@@ -25,7 +25,7 @@ module GraphQL
|
|
25
25
|
# Initialize a node by extracting its position,
|
26
26
|
# then calling the class's `initialize_node` method.
|
27
27
|
# @param options [Hash] Initial attributes for this node
|
28
|
-
def initialize(options={})
|
28
|
+
def initialize(options = {})
|
29
29
|
if options.key?(:position_source)
|
30
30
|
position_source = options.delete(:position_source)
|
31
31
|
@line = position_source.line
|
@@ -34,7 +34,7 @@ module GraphQL
|
|
34
34
|
|
35
35
|
@filename = options.delete(:filename)
|
36
36
|
|
37
|
-
initialize_node(options)
|
37
|
+
initialize_node(**options)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Value equality
|
data/lib/graphql/query.rb
CHANGED
@@ -143,9 +143,9 @@ module GraphQL
|
|
143
143
|
# Make a new context which delegates key lookup to `values`
|
144
144
|
# @param query [GraphQL::Query] the query who owns this context
|
145
145
|
# @param values [Hash] A hash of arbitrary values which will be accessible at query-time
|
146
|
-
def initialize(query:,
|
146
|
+
def initialize(query:, schema: query.schema, values:, object:)
|
147
147
|
@query = query
|
148
|
-
@schema =
|
148
|
+
@schema = schema
|
149
149
|
@provided_values = values || {}
|
150
150
|
@object = object
|
151
151
|
# Namespaced storage, where user-provided values are in `nil` namespace:
|
@@ -334,6 +334,3 @@ module GraphQL
|
|
334
334
|
end
|
335
335
|
end
|
336
336
|
end
|
337
|
-
|
338
|
-
|
339
|
-
GraphQL::Schema::Context = GraphQL::Query::Context
|
data/lib/graphql/relay/node.rb
CHANGED
@@ -11,7 +11,7 @@ module GraphQL
|
|
11
11
|
field = GraphQL::Types::Relay::NodeField.graphql_definition
|
12
12
|
|
13
13
|
if kwargs.any? || block
|
14
|
-
field = field.redefine(kwargs, &block)
|
14
|
+
field = field.redefine(**kwargs, &block)
|
15
15
|
end
|
16
16
|
|
17
17
|
field
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
field = GraphQL::Types::Relay::NodesField.graphql_definition
|
22
22
|
|
23
23
|
if kwargs.any? || block
|
24
|
-
field = field.redefine(kwargs, &block)
|
24
|
+
field = field.redefine(**kwargs, &block)
|
25
25
|
end
|
26
26
|
|
27
27
|
field
|
data/lib/graphql/schema.rb
CHANGED
@@ -99,6 +99,8 @@ module GraphQL
|
|
99
99
|
mutation: ->(schema, t) { schema.mutation = t.respond_to?(:graphql_definition) ? t.graphql_definition : t },
|
100
100
|
subscription: ->(schema, t) { schema.subscription = t.respond_to?(:graphql_definition) ? t.graphql_definition : t },
|
101
101
|
disable_introspection_entry_points: ->(schema) { schema.disable_introspection_entry_points = true },
|
102
|
+
disable_schema_introspection_entry_point: ->(schema) { schema.disable_schema_introspection_entry_point = true },
|
103
|
+
disable_type_introspection_entry_point: ->(schema) { schema.disable_type_introspection_entry_point = true },
|
102
104
|
directives: ->(schema, directives) { schema.directives = directives.reduce({}) { |m, d| m[d.name] = d; m } },
|
103
105
|
directive: ->(schema, directive) { schema.directives[directive.graphql_name] = directive },
|
104
106
|
instrument: ->(schema, type, instrumenter, after_built_ins: false) {
|
@@ -154,6 +156,12 @@ module GraphQL
|
|
154
156
|
# [Boolean] True if this object disables the introspection entry point fields
|
155
157
|
attr_accessor :disable_introspection_entry_points
|
156
158
|
|
159
|
+
# [Boolean] True if this object disables the __schema introspection entry point field
|
160
|
+
attr_accessor :disable_schema_introspection_entry_point
|
161
|
+
|
162
|
+
# [Boolean] True if this object disables the __type introspection entry point field
|
163
|
+
attr_accessor :disable_type_introspection_entry_point
|
164
|
+
|
157
165
|
class << self
|
158
166
|
attr_writer :default_execution_strategy
|
159
167
|
end
|
@@ -203,6 +211,8 @@ module GraphQL
|
|
203
211
|
@interpreter = false
|
204
212
|
@error_bubbling = false
|
205
213
|
@disable_introspection_entry_points = false
|
214
|
+
@disable_schema_introspection_entry_point = false
|
215
|
+
@disable_type_introspection_entry_point = false
|
206
216
|
end
|
207
217
|
|
208
218
|
# @return [Boolean] True if using the new {GraphQL::Execution::Interpreter}
|
@@ -272,7 +282,7 @@ module GraphQL
|
|
272
282
|
query = GraphQL::Query.new(self, document: doc, context: context)
|
273
283
|
validator_opts = { schema: self }
|
274
284
|
rules && (validator_opts[:rules] = rules)
|
275
|
-
validator = GraphQL::StaticValidation::Validator.new(validator_opts)
|
285
|
+
validator = GraphQL::StaticValidation::Validator.new(**validator_opts)
|
276
286
|
res = validator.validate(query)
|
277
287
|
res[:errors]
|
278
288
|
end
|
@@ -679,9 +689,12 @@ module GraphQL
|
|
679
689
|
end
|
680
690
|
|
681
691
|
# Return the GraphQL::Language::Document IDL AST for the schema
|
692
|
+
# @param context [Hash]
|
693
|
+
# @param only [<#call(member, ctx)>]
|
694
|
+
# @param except [<#call(member, ctx)>]
|
682
695
|
# @return [GraphQL::Language::Document]
|
683
|
-
def to_document
|
684
|
-
GraphQL::Language::DocumentFromSchemaDefinition.new(self).document
|
696
|
+
def to_document(only: nil, except: nil, context: {})
|
697
|
+
GraphQL::Language::DocumentFromSchemaDefinition.new(self, only: only, except: except, context: context).document
|
685
698
|
end
|
686
699
|
|
687
700
|
# Return the Hash response of {Introspection::INTROSPECTION_QUERY}.
|
@@ -732,13 +745,15 @@ module GraphQL
|
|
732
745
|
:union_memberships,
|
733
746
|
:get_field, :root_types, :references_to, :type_from_ast,
|
734
747
|
:possible_types,
|
735
|
-
:disable_introspection_entry_points
|
748
|
+
:disable_introspection_entry_points=,
|
749
|
+
:disable_schema_introspection_entry_point=,
|
750
|
+
:disable_type_introspection_entry_point=
|
736
751
|
|
737
752
|
def graphql_definition
|
738
753
|
@graphql_definition ||= to_graphql
|
739
754
|
end
|
740
755
|
|
741
|
-
def use(plugin, options
|
756
|
+
def use(plugin, **options)
|
742
757
|
own_plugins << [plugin, options]
|
743
758
|
end
|
744
759
|
|
@@ -758,6 +773,8 @@ module GraphQL
|
|
758
773
|
schema_defn.default_max_page_size = default_max_page_size
|
759
774
|
schema_defn.orphan_types = orphan_types
|
760
775
|
schema_defn.disable_introspection_entry_points = disable_introspection_entry_points?
|
776
|
+
schema_defn.disable_schema_introspection_entry_point = disable_schema_introspection_entry_point?
|
777
|
+
schema_defn.disable_type_introspection_entry_point = disable_type_introspection_entry_point?
|
761
778
|
|
762
779
|
prepped_dirs = {}
|
763
780
|
directives.each { |k, v| prepped_dirs[k] = v.graphql_definition}
|
@@ -913,6 +930,14 @@ module GraphQL
|
|
913
930
|
@disable_introspection_entry_points = true
|
914
931
|
end
|
915
932
|
|
933
|
+
def disable_schema_introspection_entry_point
|
934
|
+
@disable_schema_introspection_entry_point = true
|
935
|
+
end
|
936
|
+
|
937
|
+
def disable_type_introspection_entry_point
|
938
|
+
@disable_type_introspection_entry_point = true
|
939
|
+
end
|
940
|
+
|
916
941
|
def disable_introspection_entry_points?
|
917
942
|
if instance_variable_defined?(:@disable_introspection_entry_points)
|
918
943
|
@disable_introspection_entry_points
|
@@ -921,6 +946,22 @@ module GraphQL
|
|
921
946
|
end
|
922
947
|
end
|
923
948
|
|
949
|
+
def disable_schema_introspection_entry_point?
|
950
|
+
if instance_variable_defined?(:@disable_schema_introspection_entry_point)
|
951
|
+
@disable_schema_introspection_entry_point
|
952
|
+
else
|
953
|
+
find_inherited_value(:disable_schema_introspection_entry_point?, false)
|
954
|
+
end
|
955
|
+
end
|
956
|
+
|
957
|
+
def disable_type_introspection_entry_point?
|
958
|
+
if instance_variable_defined?(:@disable_type_introspection_entry_point)
|
959
|
+
@disable_type_introspection_entry_point
|
960
|
+
else
|
961
|
+
find_inherited_value(:disable_type_introspection_entry_point?, false)
|
962
|
+
end
|
963
|
+
end
|
964
|
+
|
924
965
|
def orphan_types(*new_orphan_types)
|
925
966
|
if new_orphan_types.any?
|
926
967
|
own_orphan_types.concat(new_orphan_types.flatten)
|
@@ -183,12 +183,16 @@ module GraphQL
|
|
183
183
|
def build_object_type(object_type_definition, type_resolver, default_resolve:)
|
184
184
|
type_def = nil
|
185
185
|
typed_resolve_fn = ->(field, obj, args, ctx) { default_resolve.call(type_def, field, obj, args, ctx) }
|
186
|
-
|
186
|
+
defns = {
|
187
187
|
name: object_type_definition.name,
|
188
188
|
description: object_type_definition.description,
|
189
|
-
fields: Hash[build_fields(object_type_definition.fields, type_resolver, default_resolve: typed_resolve_fn)],
|
190
189
|
interfaces: object_type_definition.interfaces.map{ |interface_name| type_resolver.call(interface_name) },
|
191
|
-
|
190
|
+
}
|
191
|
+
obj_fields = Hash[build_fields(object_type_definition.fields, type_resolver, default_resolve: typed_resolve_fn)]
|
192
|
+
if obj_fields.any?
|
193
|
+
defns[:fields] = obj_fields
|
194
|
+
end
|
195
|
+
type_def = GraphQL::ObjectType.define(**defns)
|
192
196
|
type_def.ast_node = object_type_definition
|
193
197
|
type_def
|
194
198
|
end
|
@@ -246,13 +250,19 @@ module GraphQL
|
|
246
250
|
end
|
247
251
|
|
248
252
|
def build_directive(directive_definition, type_resolver)
|
249
|
-
|
253
|
+
directive_args = Hash[build_directive_arguments(directive_definition, type_resolver)]
|
254
|
+
|
255
|
+
defn = {
|
250
256
|
name: directive_definition.name,
|
251
257
|
description: directive_definition.description,
|
252
|
-
arguments: Hash[build_directive_arguments(directive_definition, type_resolver)],
|
253
258
|
locations: directive_definition.locations.map { |location| location.name.to_sym },
|
254
|
-
|
259
|
+
}
|
260
|
+
|
261
|
+
if directive_args.any?
|
262
|
+
defn[:arguments] = directive_args
|
263
|
+
end
|
255
264
|
|
265
|
+
directive = GraphQL::Directive.define(**defn)
|
256
266
|
directive.ast_node = directive_definition
|
257
267
|
|
258
268
|
directive
|
@@ -317,14 +327,21 @@ module GraphQL
|
|
317
327
|
[argument.name, arg]
|
318
328
|
end]
|
319
329
|
|
320
|
-
field =
|
330
|
+
field = nil
|
331
|
+
|
332
|
+
defns = {
|
321
333
|
name: field_definition.name,
|
322
334
|
description: field_definition.description,
|
323
335
|
type: type_resolver.call(field_definition.type),
|
324
|
-
arguments: field_arguments,
|
325
336
|
resolve: ->(obj, args, ctx) { default_resolve.call(field, obj, args, ctx) },
|
326
337
|
deprecation_reason: build_deprecation_reason(field_definition.directives),
|
327
|
-
|
338
|
+
}
|
339
|
+
|
340
|
+
if field_arguments.any?
|
341
|
+
defns[:arguments] = field_arguments
|
342
|
+
end
|
343
|
+
|
344
|
+
field = GraphQL::Field.define(**defns)
|
328
345
|
|
329
346
|
field.ast_node = field_definition
|
330
347
|
|
@@ -9,8 +9,14 @@ module GraphQL
|
|
9
9
|
class Directive < GraphQL::Schema::Member
|
10
10
|
extend GraphQL::Schema::Member::HasArguments
|
11
11
|
class << self
|
12
|
+
# Return a name based on the class name,
|
13
|
+
# but downcase the first letter.
|
12
14
|
def default_graphql_name
|
13
|
-
|
15
|
+
@default_graphql_name ||= begin
|
16
|
+
camelized_name = super
|
17
|
+
camelized_name[0] = camelized_name[0].downcase
|
18
|
+
camelized_name
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
def locations(*new_locations)
|
@@ -22,7 +22,10 @@ module GraphQL
|
|
22
22
|
if schema.disable_introspection_entry_points
|
23
23
|
{}
|
24
24
|
else
|
25
|
-
get_fields_from_class(class_sym: :EntryPoints)
|
25
|
+
entry_point_fields = get_fields_from_class(class_sym: :EntryPoints)
|
26
|
+
entry_point_fields.delete('__schema') if schema.disable_schema_introspection_entry_point
|
27
|
+
entry_point_fields.delete('__type') if schema.disable_type_introspection_entry_point
|
28
|
+
entry_point_fields
|
26
29
|
end
|
27
30
|
@dynamic_fields = get_fields_from_class(class_sym: :DynamicFields)
|
28
31
|
end
|
@@ -118,14 +118,20 @@ module GraphQL
|
|
118
118
|
}]
|
119
119
|
)
|
120
120
|
when "FIELD"
|
121
|
-
|
121
|
+
defns = {
|
122
122
|
name: type["name"],
|
123
123
|
type: type_resolver.call(type["type"]),
|
124
124
|
description: type["description"],
|
125
|
-
|
125
|
+
}
|
126
|
+
|
127
|
+
# Avoid passing an empty hash, which warns on Ruby 2.7
|
128
|
+
if type["args"].any?
|
129
|
+
defns[:arguments] = Hash[type["args"].map { |arg|
|
126
130
|
[arg["name"], define_type(arg.merge("kind" => "ARGUMENT"), type_resolver)]
|
127
131
|
}]
|
128
|
-
|
132
|
+
end
|
133
|
+
|
134
|
+
GraphQL::Field.define(**defns)
|
129
135
|
when "ARGUMENT"
|
130
136
|
kwargs = {}
|
131
137
|
if type["defaultValue"]
|
@@ -64,7 +64,7 @@ module GraphQL
|
|
64
64
|
|
65
65
|
class << self
|
66
66
|
# Override this method to handle legacy-style usages of `MyMutation.field`
|
67
|
-
def field(*args, &block)
|
67
|
+
def field(*args, **kwargs, &block)
|
68
68
|
if args.empty?
|
69
69
|
raise ArgumentError, "#{name}.field is used for adding fields to this mutation. Use `mutation: #{name}` to attach this mutation instead."
|
70
70
|
else
|
@@ -76,7 +76,7 @@ module GraphQL
|
|
76
76
|
context.schema.after_lazy(load_arguments_val) do |loaded_args|
|
77
77
|
# Then call `authorized?`, which may raise or may return a lazy object
|
78
78
|
authorized_val = if loaded_args.any?
|
79
|
-
authorized?(loaded_args)
|
79
|
+
authorized?(**loaded_args)
|
80
80
|
else
|
81
81
|
authorized?
|
82
82
|
end
|
@@ -39,12 +39,12 @@ module GraphQL
|
|
39
39
|
def resolve(**args)
|
40
40
|
# Dispatch based on `@mode`, which will raise a `NoMethodError` if we ever
|
41
41
|
# have an unexpected `@mode`
|
42
|
-
public_send("resolve_#{@mode}", args)
|
42
|
+
public_send("resolve_#{@mode}", **args)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Wrap the user-defined `#subscribe` hook
|
46
|
-
def resolve_subscribe(args)
|
47
|
-
ret_val = args.any? ? subscribe(args) : subscribe
|
46
|
+
def resolve_subscribe(**args)
|
47
|
+
ret_val = args.any? ? subscribe(**args) : subscribe
|
48
48
|
if ret_val == :no_response
|
49
49
|
context.skip
|
50
50
|
else
|
@@ -62,8 +62,8 @@ module GraphQL
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# Wrap the user-provided `#update` hook
|
65
|
-
def resolve_update(args)
|
66
|
-
ret_val = args.any? ? update(args) : update
|
65
|
+
def resolve_update(**args)
|
66
|
+
ret_val = args.any? ? update(**args) : update
|
67
67
|
if ret_val == :no_update
|
68
68
|
raise NoUpdateError
|
69
69
|
else
|
@@ -19,7 +19,7 @@ module GraphQL
|
|
19
19
|
# @param abstract_type [Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>]
|
20
20
|
# @param object_type [Class<GraphQL::Schema::Object>]
|
21
21
|
# @param options [Hash] Any options passed to `.possible_types` or `.implements`
|
22
|
-
def initialize(abstract_type, object_type, options)
|
22
|
+
def initialize(abstract_type, object_type, **options)
|
23
23
|
@abstract_type = abstract_type
|
24
24
|
@object_type = object_type
|
25
25
|
@options = options
|
data/lib/graphql/schema/union.rb
CHANGED
@@ -8,7 +8,7 @@ module GraphQL
|
|
8
8
|
def possible_types(*types, context: GraphQL::Query::NullContext, **options)
|
9
9
|
if types.any?
|
10
10
|
types.each do |t|
|
11
|
-
type_memberships << type_membership_class.new(self, t, options)
|
11
|
+
type_memberships << type_membership_class.new(self, t, **options)
|
12
12
|
end
|
13
13
|
else
|
14
14
|
visible_types = []
|
@@ -20,7 +20,7 @@ module GraphQL
|
|
20
20
|
def self.use(defn, options = {})
|
21
21
|
schema = defn.target
|
22
22
|
options[:schema] = schema
|
23
|
-
schema.subscriptions = self.new(options)
|
23
|
+
schema.subscriptions = self.new(**options)
|
24
24
|
instrumentation = Subscriptions::Instrumentation.new(schema: schema)
|
25
25
|
defn.instrument(:field, instrumentation)
|
26
26
|
defn.instrument(:query, instrumentation)
|
@@ -90,7 +90,7 @@ module GraphQL
|
|
90
90
|
operation_name = query_data.fetch(:operation_name)
|
91
91
|
# Re-evaluate the saved query
|
92
92
|
result = @schema.execute(
|
93
|
-
{
|
93
|
+
**{
|
94
94
|
query: query_string,
|
95
95
|
context: context,
|
96
96
|
subscription_topic: event.topic,
|
data/lib/graphql/union_type.rb
CHANGED
@@ -24,8 +24,15 @@ module GraphQL
|
|
24
24
|
# }
|
25
25
|
#
|
26
26
|
class UnionType < GraphQL::BaseType
|
27
|
+
# Rubocop was unhappy about the syntax when this was a proc literal
|
28
|
+
class AcceptPossibleTypesDefinition
|
29
|
+
def self.call(target, possible_types, options = {})
|
30
|
+
target.add_possible_types(possible_types, **options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
27
34
|
accepts_definitions :resolve_type, :type_membership_class,
|
28
|
-
possible_types:
|
35
|
+
possible_types: AcceptPossibleTypesDefinition
|
29
36
|
ensure_defined :possible_types, :resolve_type, :resolve_type_proc, :type_membership_class
|
30
37
|
|
31
38
|
attr_accessor :resolve_type_proc
|
@@ -72,13 +79,13 @@ module GraphQL
|
|
72
79
|
# This is a re-assignment, so clear the previous values
|
73
80
|
@type_memberships = []
|
74
81
|
@cached_possible_types = nil
|
75
|
-
add_possible_types(types, {})
|
82
|
+
add_possible_types(types, **{})
|
76
83
|
end
|
77
84
|
|
78
|
-
def add_possible_types(types, options)
|
85
|
+
def add_possible_types(types, **options)
|
79
86
|
@type_memberships ||= []
|
80
87
|
Array(types).each { |t|
|
81
|
-
@type_memberships << self.type_membership_class.new(self, t, options)
|
88
|
+
@type_memberships << self.type_membership_class.new(self, t, **options)
|
82
89
|
}
|
83
90
|
nil
|
84
91
|
end
|
data/lib/graphql/version.rb
CHANGED
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.9.
|
4
|
+
version: 1.9.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
201
|
+
version: '12'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: '
|
208
|
+
version: '12'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: rubocop
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|