graphql 1.10.13 → 1.10.14
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.
- checksums.yaml +4 -4
- data/lib/graphql/directive.rb +4 -0
- data/lib/graphql/execution/interpreter/runtime.rb +3 -2
- data/lib/graphql/field.rb +4 -0
- data/lib/graphql/input_object_type.rb +4 -0
- data/lib/graphql/schema/member/has_arguments.rb +3 -1
- data/lib/graphql/static_validation/literal_validator.rb +7 -7
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +2 -2
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -2
- data/lib/graphql/version.rb +1 -1
- metadata +2 -3
- data/lib/graphql/tracing/statsd_tracing.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1d76918804bdeeba0c80bbcfcdde70d04132110aee8e4520dcba8480da390fc
|
4
|
+
data.tar.gz: c0e1954ae3f6d18bf03fc33807b94d482b83b4e4a6f8a392452e2f6e8297f241
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e945033f8657c252fcd99a18d4be5c9d267535753e88a94f3b589c968ca186e90f3368768ff2f3f7c7e1eff7a210bf57694bde763255ee0a91f1e46534b0b4d
|
7
|
+
data.tar.gz: de56338439eeb22b8484033c5acfb4ac027edee60ac30218c8a7516c5bc6d4bfa07b8be54ebd42a63fca5decdfbbcf85e4b96832bb8d7fcd304dc2fb98bc7625
|
data/lib/graphql/directive.rb
CHANGED
@@ -460,8 +460,9 @@ module GraphQL
|
|
460
460
|
end
|
461
461
|
|
462
462
|
def arguments(graphql_object, arg_owner, ast_node)
|
463
|
-
# Don't cache arguments if field extras are requested since
|
464
|
-
if arg_owner.arguments_statically_coercible? &&
|
463
|
+
# Don't cache arguments if field extras or extensions are requested since they can mutate the argument data structure
|
464
|
+
if arg_owner.arguments_statically_coercible? &&
|
465
|
+
(!arg_owner.is_a?(GraphQL::Schema::Field) || (arg_owner.extras.empty? && arg_owner.extensions.empty?))
|
465
466
|
query.arguments_for(ast_node, arg_owner)
|
466
467
|
else
|
467
468
|
# The arguments must be prepared in the context of the given object
|
data/lib/graphql/field.rb
CHANGED
@@ -60,7 +60,9 @@ module GraphQL
|
|
60
60
|
|
61
61
|
# @return [GraphQL::Schema::Argument, nil] Argument defined on this thing, fetched by name.
|
62
62
|
def get_argument(argument_name)
|
63
|
-
|
63
|
+
a = own_arguments[argument_name]
|
64
|
+
|
65
|
+
if a || !self.is_a?(Class)
|
64
66
|
a
|
65
67
|
else
|
66
68
|
for ancestor in ancestors
|
@@ -95,16 +95,17 @@ module GraphQL
|
|
95
95
|
def required_input_fields_are_present(type, ast_node)
|
96
96
|
# TODO - would be nice to use these to create an error message so the caller knows
|
97
97
|
# that required fields are missing
|
98
|
-
required_field_names =
|
99
|
-
.select { |
|
98
|
+
required_field_names = type.arguments.each_value
|
99
|
+
.select { |argument| argument.type.kind.non_null? && @warden.get_argument(type, argument.name) }
|
100
100
|
.map(&:name)
|
101
|
+
|
101
102
|
present_field_names = ast_node.arguments.map(&:name)
|
102
103
|
missing_required_field_names = required_field_names - present_field_names
|
103
104
|
if @context.schema.error_bubbling
|
104
105
|
missing_required_field_names.empty? ? @valid_response : @invalid_response
|
105
106
|
else
|
106
107
|
results = missing_required_field_names.map do |name|
|
107
|
-
arg_type = @warden.
|
108
|
+
arg_type = @warden.get_argument(type, name).type
|
108
109
|
recursively_validate(GraphQL::Language::Nodes::NullValue.new(name: name), arg_type)
|
109
110
|
end
|
110
111
|
merge_results(results)
|
@@ -112,13 +113,12 @@ module GraphQL
|
|
112
113
|
end
|
113
114
|
|
114
115
|
def present_input_field_values_are_valid(type, ast_node)
|
115
|
-
field_map = @warden.arguments(type).reduce({}) { |m, f| m[f.name] = f; m}
|
116
116
|
results = ast_node.arguments.map do |value|
|
117
|
-
field =
|
117
|
+
field = @warden.get_argument(type, value.name)
|
118
118
|
# we want to call validate on an argument even if it's an invalid one
|
119
119
|
# so that our raise exception is on it instead of the entire InputObject
|
120
|
-
|
121
|
-
recursively_validate(value.value,
|
120
|
+
field_type = field && field.type
|
121
|
+
recursively_validate(value.value, field_type)
|
122
122
|
end
|
123
123
|
merge_results(results)
|
124
124
|
end
|
@@ -5,7 +5,7 @@ module GraphQL
|
|
5
5
|
def on_argument(node, parent)
|
6
6
|
parent_defn = parent_definition(parent)
|
7
7
|
|
8
|
-
if parent_defn && context.warden.
|
8
|
+
if parent_defn && context.warden.get_argument(parent_defn, node.name)
|
9
9
|
super
|
10
10
|
elsif parent_defn
|
11
11
|
kind_of_node = node_type(parent)
|
@@ -17,8 +17,8 @@ module GraphQL
|
|
17
17
|
|
18
18
|
def assert_required_args(ast_node, defn)
|
19
19
|
present_argument_names = ast_node.arguments.map(&:name)
|
20
|
-
required_argument_names =
|
21
|
-
.select { |a| a.type.kind.non_null? && !a.default_value? }
|
20
|
+
required_argument_names = defn.arguments.each_value
|
21
|
+
.select { |a| a.type.kind.non_null? && !a.default_value? && context.warden.get_argument(defn, a.name) }
|
22
22
|
.map(&:name)
|
23
23
|
|
24
24
|
missing_names = required_argument_names - present_argument_names
|
@@ -26,8 +26,7 @@ module GraphQL
|
|
26
26
|
context.field_definition
|
27
27
|
end
|
28
28
|
|
29
|
-
parent_type = context.warden.
|
30
|
-
.find{|f| f.name == parent_name(parent, defn) }
|
29
|
+
parent_type = context.warden.get_argument(defn, parent_name(parent, defn))
|
31
30
|
parent_type ? parent_type.type.unwrap : nil
|
32
31
|
end
|
33
32
|
|
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.10.
|
4
|
+
version: 1.10.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -696,7 +696,6 @@ files:
|
|
696
696
|
- lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
|
697
697
|
- lib/graphql/tracing/scout_tracing.rb
|
698
698
|
- lib/graphql/tracing/skylight_tracing.rb
|
699
|
-
- lib/graphql/tracing/statsd_tracing.rb
|
700
699
|
- lib/graphql/type_kinds.rb
|
701
700
|
- lib/graphql/types.rb
|
702
701
|
- lib/graphql/types/big_int.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GraphQL
|
4
|
-
module Tracing
|
5
|
-
class StatsdTracing < PlatformTracing
|
6
|
-
self.platform_keys = {
|
7
|
-
'lex' => "graphql.lex",
|
8
|
-
'parse' => "graphql.parse",
|
9
|
-
'validate' => "graphql.validate",
|
10
|
-
'analyze_query' => "graphql.analyze_query",
|
11
|
-
'analyze_multiplex' => "graphql.analyze_multiplex",
|
12
|
-
'execute_multiplex' => "graphql.execute_multiplex",
|
13
|
-
'execute_query' => "graphql.execute_query",
|
14
|
-
'execute_query_lazy' => "graphql.execute_query",
|
15
|
-
}
|
16
|
-
|
17
|
-
# @param statsd [Object] A statsd client
|
18
|
-
def initialize(statsd:, **rest)
|
19
|
-
@statsd = statsd
|
20
|
-
super(**rest)
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
def platform_trace(platform_key, key, data)
|
25
|
-
@statsd.time(platform_key) do
|
26
|
-
yield
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def platform_field_key(type, field)
|
31
|
-
"graphql.#{type.graphql_name}.#{field.graphql_name}"
|
32
|
-
end
|
33
|
-
|
34
|
-
def platform_authorized_key(type)
|
35
|
-
"graphql.authorized.#{type.graphql_name}"
|
36
|
-
end
|
37
|
-
|
38
|
-
def platform_resolve_type_key(type)
|
39
|
-
"graphql.resolve_type.#{type.graphql_name}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|