graphql 2.5.12 → 2.5.13
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/schema/directive.rb +15 -4
- data/lib/graphql/testing/helpers.rb +12 -9
- 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: 7a8341f92c813c7cf9966f197291a352352fed53c76a321b59741ab5fb2d9088
|
4
|
+
data.tar.gz: 6143a1d8d8fca259d978ead2529336e16601eff0a620146244677c419b374679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19043a93971994bf9d8b19a9d901cb6bff5f3c4d3037dc42c7475e9bc919d4c4eef53975becfac6600b0b3e2466cac66620dcaa003b831bded920925e0ee0f9
|
7
|
+
data.tar.gz: 51910baef2d36f72f2921e990735f1ea350c3e8cb8f2db033d95fc2321ab0657b49d0b1a9402789828c9a7fc81481f9a8662d87e7568fc35be7db539f497fbdd
|
@@ -129,11 +129,22 @@ module GraphQL
|
|
129
129
|
# not runtime arguments.
|
130
130
|
context = Query::NullContext.instance
|
131
131
|
self.class.all_argument_definitions.each do |arg_defn|
|
132
|
-
|
133
|
-
|
132
|
+
keyword = arg_defn.keyword
|
133
|
+
arg_type = arg_defn.type
|
134
|
+
if arguments.key?(keyword)
|
135
|
+
value = arguments[keyword]
|
134
136
|
# This is a Ruby-land value; convert it to graphql for validation
|
135
137
|
graphql_value = begin
|
136
|
-
|
138
|
+
coerce_value = value
|
139
|
+
if arg_type.list? && (!coerce_value.nil?) && (!coerce_value.is_a?(Array))
|
140
|
+
# When validating inputs, GraphQL accepts a single item
|
141
|
+
# and implicitly converts it to a one-item list.
|
142
|
+
# However, we're using result coercion here to go from Ruby value
|
143
|
+
# to GraphQL value, so it doesn't have that feature.
|
144
|
+
# Keep the GraphQL-type behavior but implement it manually:
|
145
|
+
coerce_value = [coerce_value]
|
146
|
+
end
|
147
|
+
arg_type.coerce_isolated_result(coerce_value)
|
137
148
|
rescue GraphQL::Schema::Enum::UnresolvedValueError
|
138
149
|
# Let validation handle this
|
139
150
|
value
|
@@ -142,7 +153,7 @@ module GraphQL
|
|
142
153
|
value = graphql_value = nil
|
143
154
|
end
|
144
155
|
|
145
|
-
result =
|
156
|
+
result = arg_type.validate_input(graphql_value, context)
|
146
157
|
if !result.valid?
|
147
158
|
raise InvalidArgumentError, "@#{graphql_name}.#{arg_defn.graphql_name} on #{owner.path} is invalid (#{value.inspect}): #{result.problems.first["explanation"]}"
|
148
159
|
end
|
@@ -39,9 +39,9 @@ module GraphQL
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def run_graphql_field(schema, field_path, object, arguments: {}, context: {}, ast_node: nil, lookahead: nil)
|
42
|
+
def run_graphql_field(schema, field_path, object, arguments: {}, context: {}, ast_node: nil, lookahead: nil, visibility_profile: nil)
|
43
43
|
type_name, *field_names = field_path.split(".")
|
44
|
-
dummy_query = GraphQL::Query.new(schema, "{ __typename }", context: context)
|
44
|
+
dummy_query = GraphQL::Query.new(schema, "{ __typename }", context: context, visibility_profile: visibility_profile)
|
45
45
|
query_context = dummy_query.context
|
46
46
|
dataloader = query_context.dataloader
|
47
47
|
object_type = dummy_query.types.type(type_name) # rubocop:disable Development/ContextIsPassedCop
|
@@ -104,32 +104,35 @@ module GraphQL
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
def with_resolution_context(schema, type:, object:, context:{})
|
107
|
+
def with_resolution_context(schema, type:, object:, context:{}, visibility_profile: nil)
|
108
108
|
resolution_context = ResolutionAssertionContext.new(
|
109
109
|
self,
|
110
110
|
schema: schema,
|
111
111
|
type_name: type,
|
112
112
|
object: object,
|
113
|
-
context: context
|
113
|
+
context: context,
|
114
|
+
visibility_profile: visibility_profile,
|
114
115
|
)
|
115
116
|
yield(resolution_context)
|
116
117
|
end
|
117
118
|
|
118
119
|
class ResolutionAssertionContext
|
119
|
-
def initialize(test, type_name:, object:, schema:, context:)
|
120
|
+
def initialize(test, type_name:, object:, schema:, context:, visibility_profile:)
|
120
121
|
@test = test
|
121
122
|
@type_name = type_name
|
122
123
|
@object = object
|
123
124
|
@schema = schema
|
124
125
|
@context = context
|
126
|
+
@visibility_profile = visibility_profile
|
125
127
|
end
|
126
128
|
|
129
|
+
attr_reader :visibility_profile
|
127
130
|
|
128
131
|
def run_graphql_field(field_name, arguments: {})
|
129
132
|
if @schema
|
130
|
-
@test.run_graphql_field(@schema, "#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context)
|
133
|
+
@test.run_graphql_field(@schema, "#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context, visibility_profile: @visibility_profile)
|
131
134
|
else
|
132
|
-
@test.run_graphql_field("#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context)
|
135
|
+
@test.run_graphql_field("#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context, visibility_profile: @visibility_profile)
|
133
136
|
end
|
134
137
|
end
|
135
138
|
end
|
@@ -137,8 +140,8 @@ module GraphQL
|
|
137
140
|
module SchemaHelpers
|
138
141
|
include Helpers
|
139
142
|
|
140
|
-
def run_graphql_field(field_path, object, arguments: {}, context: {})
|
141
|
-
super(@@schema_class_for_helpers, field_path, object, arguments: arguments, context: context)
|
143
|
+
def run_graphql_field(field_path, object, arguments: {}, context: {}, visibility_profile: nil)
|
144
|
+
super(@@schema_class_for_helpers, field_path, object, arguments: arguments, context: context, visibility_profile: visibility_profile)
|
142
145
|
end
|
143
146
|
|
144
147
|
def with_resolution_context(*args, **kwargs, &block)
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: base64
|