graphql 2.3.8 → 2.3.10
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.
- checksums.yaml +4 -4
- data/lib/graphql/dataloader/source.rb +5 -2
- data/lib/graphql/introspection/schema_type.rb +3 -18
- data/lib/graphql/language/parser.rb +9 -1
- data/lib/graphql/schema/enum.rb +5 -1
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +5 -1
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +18 -27
- data/lib/graphql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df4f4d50869f6ef14685ae04e9020a6b1c151d9fd287af7d86d139aadfc2f105
|
4
|
+
data.tar.gz: 0415f6e0012b4a9517e84d5de66ebccbff41ce01b384b49c480cda7b5353d16d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7921e2420473405956845345b75ba8c4768e9d90cf6d96b0249844524e7c53ff00ec11ed940635a3f12c264cb52095310be4e6a642c4806362ce2e9f5fe7d15f
|
7
|
+
data.tar.gz: 3e33cd66559ec943b8b5e74124343918037176d1727d4ed425ccee384c3505708c848b5dac0dc04d2c68858ae9bc8717b204fe66dfee48adc981bf4a41fa284c
|
@@ -186,8 +186,11 @@ This key should have been loaded already. This is a bug in GraphQL::Dataloader,
|
|
186
186
|
ERR
|
187
187
|
end
|
188
188
|
result = @results[key]
|
189
|
-
|
190
|
-
|
189
|
+
if result.is_a?(StandardError)
|
190
|
+
# Dup it because the rescuer may modify it.
|
191
|
+
# (This happens for GraphQL::ExecutionErrors, at least)
|
192
|
+
raise result.dup
|
193
|
+
end
|
191
194
|
|
192
195
|
result
|
193
196
|
end
|
@@ -27,35 +27,20 @@ module GraphQL
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def query_type
|
30
|
-
|
30
|
+
@context.types.query_root
|
31
31
|
end
|
32
32
|
|
33
33
|
def mutation_type
|
34
|
-
|
34
|
+
@context.types.mutation_root
|
35
35
|
end
|
36
36
|
|
37
37
|
def subscription_type
|
38
|
-
|
38
|
+
@context.types.subscription_root
|
39
39
|
end
|
40
40
|
|
41
41
|
def directives
|
42
42
|
@context.types.directives
|
43
43
|
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def permitted_root_type(op_type)
|
48
|
-
case op_type
|
49
|
-
when "query"
|
50
|
-
@context.types.query_root
|
51
|
-
when "mutation"
|
52
|
-
@context.types.mutation_root
|
53
|
-
when "subcription"
|
54
|
-
@context.types.subscription_root
|
55
|
-
else
|
56
|
-
nil
|
57
|
-
end
|
58
|
-
end
|
59
44
|
end
|
60
45
|
end
|
61
46
|
end
|
@@ -141,7 +141,12 @@ module GraphQL
|
|
141
141
|
parse_operation_type
|
142
142
|
end
|
143
143
|
|
144
|
-
op_name =
|
144
|
+
op_name = case token_name
|
145
|
+
when :LPAREN, :LCURLY, :DIR_SIGN
|
146
|
+
nil
|
147
|
+
else
|
148
|
+
parse_name
|
149
|
+
end
|
145
150
|
|
146
151
|
variable_definitions = if at?(:LPAREN)
|
147
152
|
expect_token(:LPAREN)
|
@@ -398,6 +403,9 @@ module GraphQL
|
|
398
403
|
def parse_union_members
|
399
404
|
if at?(:EQUALS)
|
400
405
|
expect_token :EQUALS
|
406
|
+
if at?(:PIPE)
|
407
|
+
advance_token
|
408
|
+
end
|
401
409
|
list = [parse_type_name]
|
402
410
|
while at?(:PIPE)
|
403
411
|
advance_token
|
data/lib/graphql/schema/enum.rb
CHANGED
@@ -166,7 +166,11 @@ module GraphQL
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def inherited(child_class)
|
169
|
-
child_class.
|
169
|
+
if child_class.name
|
170
|
+
# Don't assign a custom error class to anonymous classes
|
171
|
+
# because they would end up with names like `#<Class0x1234>::UnresolvedValueError` which messes up bug trackers
|
172
|
+
child_class.const_set(:UnresolvedValueError, Class.new(Schema::Enum::UnresolvedValueError))
|
173
|
+
end
|
170
174
|
super
|
171
175
|
end
|
172
176
|
|
@@ -7,7 +7,11 @@ module GraphQL
|
|
7
7
|
module HasUnresolvedTypeError
|
8
8
|
private
|
9
9
|
def add_unresolved_type_error(child_class)
|
10
|
-
child_class.
|
10
|
+
if child_class.name # Don't set this for anonymous classes
|
11
|
+
child_class.const_set(:UnresolvedTypeError, Class.new(GraphQL::UnresolvedTypeError))
|
12
|
+
else
|
13
|
+
child_class.const_set(:UnresolvedTypeError, UnresolvedTypeError)
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
@@ -5,36 +5,27 @@ module GraphQL
|
|
5
5
|
def on_variable_definition(node, parent)
|
6
6
|
if !node.default_value.nil?
|
7
7
|
value = node.default_value
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
nodes: node,
|
12
|
-
name: node.name,
|
13
|
-
error_type: VariableDefaultValuesAreCorrectlyTypedError::VIOLATIONS[:INVALID_ON_NON_NULL]
|
14
|
-
))
|
8
|
+
type = context.schema.type_from_ast(node.type, context: context)
|
9
|
+
if type.nil?
|
10
|
+
# This is handled by another validator
|
15
11
|
else
|
16
|
-
|
17
|
-
if type.nil?
|
18
|
-
# This is handled by another validator
|
19
|
-
else
|
20
|
-
validation_result = context.validate_literal(value, type)
|
12
|
+
validation_result = context.validate_literal(value, type)
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
error_message ||= "Default value for $#{node.name} doesn't match type #{type.to_type_signature}"
|
30
|
-
add_error(GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError.new(
|
31
|
-
error_message,
|
32
|
-
nodes: node,
|
33
|
-
name: node.name,
|
34
|
-
type: type.to_type_signature,
|
35
|
-
error_type: VariableDefaultValuesAreCorrectlyTypedError::VIOLATIONS[:INVALID_TYPE],
|
36
|
-
))
|
14
|
+
if !validation_result.valid?
|
15
|
+
problems = validation_result.problems
|
16
|
+
first_problem = problems && problems.first
|
17
|
+
if first_problem
|
18
|
+
error_message = first_problem["explanation"]
|
37
19
|
end
|
20
|
+
|
21
|
+
error_message ||= "Default value for $#{node.name} doesn't match type #{type.to_type_signature}"
|
22
|
+
add_error(GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError.new(
|
23
|
+
error_message,
|
24
|
+
nodes: node,
|
25
|
+
name: node.name,
|
26
|
+
type: type.to_type_signature,
|
27
|
+
error_type: VariableDefaultValuesAreCorrectlyTypedError::VIOLATIONS[:INVALID_TYPE],
|
28
|
+
))
|
38
29
|
end
|
39
30
|
end
|
40
31
|
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: 2.3.
|
4
|
+
version: 2.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|