graphql 2.0.32 → 2.1.0
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/execution/interpreter/runtime.rb +27 -34
- data/lib/graphql/language/document_from_schema_definition.rb +6 -16
- data/lib/graphql/language/nodes.rb +1 -4
- data/lib/graphql/language/printer.rb +233 -145
- data/lib/graphql/language/sanitized_printer.rb +14 -21
- data/lib/graphql/language/visitor.rb +56 -122
- data/lib/graphql/pagination/connection.rb +23 -1
- data/lib/graphql/query.rb +2 -19
- data/lib/graphql/rake_task.rb +3 -12
- data/lib/graphql/schema/argument.rb +5 -3
- data/lib/graphql/schema/build_from_definition.rb +7 -8
- data/lib/graphql/schema/directive.rb +1 -1
- data/lib/graphql/schema/enum_value.rb +1 -1
- data/lib/graphql/schema/field/scope_extension.rb +7 -1
- data/lib/graphql/schema/field.rb +1 -1
- data/lib/graphql/schema/input_object.rb +6 -8
- data/lib/graphql/schema/interface.rb +1 -5
- data/lib/graphql/schema/member/has_directives.rb +1 -1
- data/lib/graphql/schema/member/has_fields.rb +1 -1
- data/lib/graphql/schema/member/has_interfaces.rb +1 -1
- data/lib/graphql/schema/member/scoped.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +1 -1
- data/lib/graphql/schema/object.rb +8 -0
- data/lib/graphql/schema/printer.rb +8 -7
- data/lib/graphql/schema/subscription.rb +11 -4
- data/lib/graphql/schema/warden.rb +3 -34
- data/lib/graphql/schema.rb +4 -20
- data/lib/graphql/static_validation/validation_context.rb +0 -3
- data/lib/graphql/static_validation.rb +0 -1
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +2 -1
- data/lib/graphql/subscriptions.rb +11 -6
- data/lib/graphql/tracing/appoptics_trace.rb +0 -4
- data/lib/graphql/tracing/appsignal_trace.rb +0 -4
- data/lib/graphql/tracing/data_dog_trace.rb +34 -25
- data/lib/graphql/tracing/data_dog_tracing.rb +21 -7
- data/lib/graphql/tracing/notifications_trace.rb +0 -4
- data/lib/graphql/tracing/platform_trace.rb +0 -5
- data/lib/graphql/tracing/prometheus_trace.rb +0 -4
- data/lib/graphql/tracing/scout_trace.rb +0 -3
- data/lib/graphql/tracing/statsd_trace.rb +0 -4
- data/lib/graphql/types/relay/connection_behaviors.rb +20 -3
- data/lib/graphql/types/relay/edge_behaviors.rb +8 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +0 -1
- metadata +24 -37
- data/lib/graphql/filter.rb +0 -59
- data/lib/graphql/static_validation/type_stack.rb +0 -216
@@ -2,6 +2,32 @@
|
|
2
2
|
module GraphQL
|
3
3
|
module Language
|
4
4
|
class Printer
|
5
|
+
OMISSION = "... (truncated)"
|
6
|
+
|
7
|
+
class TruncatableBuffer
|
8
|
+
class TruncateSizeReached < StandardError; end
|
9
|
+
|
10
|
+
DEFAULT_INIT_CAPACITY = 500
|
11
|
+
|
12
|
+
def initialize(truncate_size: nil)
|
13
|
+
@out = String.new(capacity: truncate_size || DEFAULT_INIT_CAPACITY)
|
14
|
+
@truncate_size = truncate_size
|
15
|
+
end
|
16
|
+
|
17
|
+
def append(other)
|
18
|
+
if @truncate_size && (@out.size + other.size) > @truncate_size
|
19
|
+
@out << other.slice(0, @truncate_size - @out.size)
|
20
|
+
raise(TruncateSizeReached, "Truncate size reached")
|
21
|
+
else
|
22
|
+
@out << other
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_string
|
27
|
+
@out
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
5
31
|
# Turn an arbitrary AST node back into a string.
|
6
32
|
#
|
7
33
|
# @example Turning a document into a query string
|
@@ -14,121 +40,158 @@ module GraphQL
|
|
14
40
|
#
|
15
41
|
# class MyPrinter < GraphQL::Language::Printer
|
16
42
|
# def print_argument(arg)
|
17
|
-
# "#{arg.name}: <HIDDEN>"
|
43
|
+
# print_string("#{arg.name}: <HIDDEN>")
|
18
44
|
# end
|
19
45
|
# end
|
20
46
|
#
|
21
47
|
# MyPrinter.new.print(document)
|
22
48
|
# # => "mutation { pay(creditCard: <HIDDEN>) { success } }"
|
23
49
|
#
|
24
|
-
#
|
50
|
+
# @param node [Nodes::AbstractNode]
|
25
51
|
# @param indent [String] Whitespace to add to the printed node
|
52
|
+
# @param truncate_size [Integer, nil] The size to truncate to.
|
26
53
|
# @return [String] Valid GraphQL for `node`
|
27
|
-
def print(node, indent: "")
|
54
|
+
def print(node, indent: "", truncate_size: nil)
|
55
|
+
truncate_size = truncate_size ? [truncate_size - OMISSION.size, 0].max : nil
|
56
|
+
@out = TruncatableBuffer.new(truncate_size: truncate_size)
|
28
57
|
print_node(node, indent: indent)
|
58
|
+
@out.to_string
|
59
|
+
rescue TruncatableBuffer::TruncateSizeReached
|
60
|
+
@out.to_string << OMISSION
|
29
61
|
end
|
30
62
|
|
31
63
|
protected
|
32
64
|
|
65
|
+
def print_string(str)
|
66
|
+
@out.append(str)
|
67
|
+
end
|
68
|
+
|
33
69
|
def print_document(document)
|
34
|
-
document.definitions.
|
70
|
+
document.definitions.each_with_index do |d, i|
|
71
|
+
print_node(d)
|
72
|
+
print_string("\n\n") if i < document.definitions.size - 1
|
73
|
+
end
|
35
74
|
end
|
36
75
|
|
37
76
|
def print_argument(argument)
|
38
|
-
"#{argument.name}:
|
77
|
+
print_string("#{argument.name}: ")
|
78
|
+
print_node(argument.value)
|
79
|
+
end
|
80
|
+
|
81
|
+
def print_input_object(input_object)
|
82
|
+
print_string("{")
|
83
|
+
input_object.arguments.each_with_index do |a, i|
|
84
|
+
print_argument(a)
|
85
|
+
print_string(", ") if i < input_object.arguments.size - 1
|
86
|
+
end
|
87
|
+
print_string("}")
|
39
88
|
end
|
40
89
|
|
41
90
|
def print_directive(directive)
|
42
|
-
|
91
|
+
print_string("@#{directive.name}")
|
43
92
|
|
44
93
|
if directive.arguments.any?
|
45
|
-
|
94
|
+
print_string("(")
|
95
|
+
directive.arguments.each_with_index do |a, i|
|
96
|
+
print_argument(a)
|
97
|
+
print_string(", ") if i < directive.arguments.size - 1
|
98
|
+
end
|
99
|
+
print_string(")")
|
46
100
|
end
|
47
|
-
|
48
|
-
out
|
49
101
|
end
|
50
102
|
|
51
103
|
def print_enum(enum)
|
52
|
-
|
104
|
+
print_string(enum.name)
|
53
105
|
end
|
54
106
|
|
55
107
|
def print_null_value
|
56
|
-
"null"
|
108
|
+
print_string("null")
|
57
109
|
end
|
58
110
|
|
59
111
|
def print_field(field, indent: "")
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
112
|
+
print_string(indent)
|
113
|
+
print_string("#{field.alias}: ") if field.alias
|
114
|
+
print_string(field.name)
|
115
|
+
if field.arguments.any?
|
116
|
+
print_string("(")
|
117
|
+
field.arguments.each_with_index do |a, i|
|
118
|
+
print_argument(a)
|
119
|
+
print_string(", ") if i < field.arguments.size - 1
|
120
|
+
end
|
121
|
+
print_string(")")
|
122
|
+
end
|
123
|
+
print_directives(field.directives)
|
124
|
+
print_selections(field.selections, indent: indent)
|
67
125
|
end
|
68
126
|
|
69
127
|
def print_fragment_definition(fragment_def, indent: "")
|
70
|
-
|
128
|
+
print_string("#{indent}fragment #{fragment_def.name}")
|
71
129
|
if fragment_def.type
|
72
|
-
|
130
|
+
print_string(" on ")
|
131
|
+
print_node(fragment_def.type)
|
73
132
|
end
|
74
|
-
|
75
|
-
|
76
|
-
out
|
133
|
+
print_directives(fragment_def.directives)
|
134
|
+
print_selections(fragment_def.selections, indent: indent)
|
77
135
|
end
|
78
136
|
|
79
137
|
def print_fragment_spread(fragment_spread, indent: "")
|
80
|
-
|
81
|
-
|
82
|
-
out
|
138
|
+
print_string("#{indent}...#{fragment_spread.name}")
|
139
|
+
print_directives(fragment_spread.directives)
|
83
140
|
end
|
84
141
|
|
85
142
|
def print_inline_fragment(inline_fragment, indent: "")
|
86
|
-
|
143
|
+
print_string("#{indent}...")
|
87
144
|
if inline_fragment.type
|
88
|
-
|
145
|
+
print_string(" on ")
|
146
|
+
print_node(inline_fragment.type)
|
89
147
|
end
|
90
|
-
|
91
|
-
|
92
|
-
out
|
93
|
-
end
|
94
|
-
|
95
|
-
def print_input_object(input_object)
|
96
|
-
"{#{input_object.arguments.map { |a| print_argument(a) }.join(", ")}}"
|
148
|
+
print_directives(inline_fragment.directives)
|
149
|
+
print_selections(inline_fragment.selections, indent: indent)
|
97
150
|
end
|
98
151
|
|
99
152
|
def print_list_type(list_type)
|
100
|
-
"[
|
153
|
+
print_string("[")
|
154
|
+
print_node(list_type.of_type)
|
155
|
+
print_string("]")
|
101
156
|
end
|
102
157
|
|
103
158
|
def print_non_null_type(non_null_type)
|
104
|
-
|
159
|
+
print_node(non_null_type.of_type)
|
160
|
+
print_string("!")
|
105
161
|
end
|
106
162
|
|
107
163
|
def print_operation_definition(operation_definition, indent: "")
|
108
|
-
|
109
|
-
|
164
|
+
print_string("#{indent}#{operation_definition.operation_type}")
|
165
|
+
print_string(" #{operation_definition.name}") if operation_definition.name
|
110
166
|
|
111
167
|
if operation_definition.variables.any?
|
112
|
-
|
168
|
+
print_string("(")
|
169
|
+
operation_definition.variables.each_with_index do |v, i|
|
170
|
+
print_variable_definition(v)
|
171
|
+
print_string(", ") if i < operation_definition.variables.size - 1
|
172
|
+
end
|
173
|
+
print_string(")")
|
113
174
|
end
|
114
175
|
|
115
|
-
|
116
|
-
|
117
|
-
out
|
176
|
+
print_directives(operation_definition.directives)
|
177
|
+
print_selections(operation_definition.selections, indent: indent)
|
118
178
|
end
|
119
179
|
|
120
180
|
def print_type_name(type_name)
|
121
|
-
|
181
|
+
print_string(type_name.name)
|
122
182
|
end
|
123
183
|
|
124
184
|
def print_variable_definition(variable_definition)
|
125
|
-
|
126
|
-
|
127
|
-
|
185
|
+
print_string("$#{variable_definition.name}: ")
|
186
|
+
print_node(variable_definition.type)
|
187
|
+
unless variable_definition.default_value.nil?
|
188
|
+
print_string(" = ")
|
189
|
+
print_node(variable_definition.default_value)
|
190
|
+
end
|
128
191
|
end
|
129
192
|
|
130
193
|
def print_variable_identifier(variable_identifier)
|
131
|
-
"$#{variable_identifier.name}"
|
194
|
+
print_string("$#{variable_identifier.name}")
|
132
195
|
end
|
133
196
|
|
134
197
|
def print_schema_definition(schema, extension: false)
|
@@ -140,175 +203,193 @@ module GraphQL
|
|
140
203
|
return
|
141
204
|
end
|
142
205
|
|
143
|
-
|
206
|
+
extension ? print_string("extend schema") : print_string("schema")
|
207
|
+
|
144
208
|
if schema.directives.any?
|
145
209
|
schema.directives.each do |dir|
|
146
|
-
|
147
|
-
|
210
|
+
print_string("\n ")
|
211
|
+
print_node(dir)
|
148
212
|
end
|
213
|
+
|
149
214
|
if !has_conventional_names
|
150
|
-
|
215
|
+
print_string("\n")
|
151
216
|
end
|
152
217
|
end
|
153
218
|
|
154
219
|
if !has_conventional_names
|
155
220
|
if schema.directives.empty?
|
156
|
-
|
221
|
+
print_string(" ")
|
157
222
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
223
|
+
print_string("{\n")
|
224
|
+
print_string(" query: #{schema.query}\n") if schema.query
|
225
|
+
print_string(" mutation: #{schema.mutation}\n") if schema.mutation
|
226
|
+
print_string(" subscription: #{schema.subscription}\n") if schema.subscription
|
227
|
+
print_string("}")
|
163
228
|
end
|
164
|
-
out
|
165
229
|
end
|
166
230
|
|
231
|
+
|
167
232
|
def print_scalar_type_definition(scalar_type, extension: false)
|
168
|
-
|
169
|
-
|
170
|
-
|
233
|
+
extension ? print_string("extend ") : print_description(scalar_type)
|
234
|
+
print_string("scalar #{scalar_type.name}")
|
235
|
+
print_directives(scalar_type.directives)
|
171
236
|
end
|
172
237
|
|
173
238
|
def print_object_type_definition(object_type, extension: false)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
239
|
+
extension ? print_string("extend ") : print_description(object_type)
|
240
|
+
print_string("type #{object_type.name}")
|
241
|
+
print_implements(object_type) unless object_type.interfaces.empty?
|
242
|
+
print_directives(object_type.directives)
|
243
|
+
print_field_definitions(object_type.fields)
|
179
244
|
end
|
180
245
|
|
181
246
|
def print_implements(type)
|
182
|
-
" implements #{type.interfaces.map(&:name).join(" & ")}"
|
247
|
+
print_string(" implements #{type.interfaces.map(&:name).join(" & ")}")
|
183
248
|
end
|
184
249
|
|
185
250
|
def print_input_value_definition(input_value)
|
186
|
-
|
187
|
-
|
188
|
-
|
251
|
+
print_string("#{input_value.name}: ")
|
252
|
+
print_node(input_value.type)
|
253
|
+
unless input_value.default_value.nil?
|
254
|
+
print_string(" = ")
|
255
|
+
print_node(input_value.default_value)
|
256
|
+
end
|
257
|
+
print_directives(input_value.directives)
|
189
258
|
end
|
190
259
|
|
191
260
|
def print_arguments(arguments, indent: "")
|
192
|
-
if arguments.all?{ |arg| !arg.description }
|
193
|
-
|
261
|
+
if arguments.all? { |arg| !arg.description }
|
262
|
+
print_string("(")
|
263
|
+
arguments.each_with_index do |arg, i|
|
264
|
+
print_input_value_definition(arg)
|
265
|
+
print_string(", ") if i < arguments.size - 1
|
266
|
+
end
|
267
|
+
print_string(")")
|
268
|
+
return
|
194
269
|
end
|
195
270
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
"#{
|
200
|
-
|
201
|
-
|
271
|
+
print_string("(\n")
|
272
|
+
arguments.each_with_index do |arg, i|
|
273
|
+
print_description(arg, indent: " " + indent, first_in_block: i == 0)
|
274
|
+
print_string(" #{indent}")
|
275
|
+
print_input_value_definition(arg)
|
276
|
+
print_string("\n") if i < arguments.size - 1
|
277
|
+
end
|
278
|
+
print_string("\n#{indent})")
|
202
279
|
end
|
203
280
|
|
204
281
|
def print_field_definition(field)
|
205
|
-
|
282
|
+
print_string(field.name)
|
206
283
|
unless field.arguments.empty?
|
207
|
-
|
284
|
+
print_arguments(field.arguments, indent: " ")
|
208
285
|
end
|
209
|
-
|
210
|
-
|
286
|
+
print_string(": ")
|
287
|
+
print_node(field.type)
|
288
|
+
print_directives(field.directives)
|
211
289
|
end
|
212
290
|
|
213
291
|
def print_interface_type_definition(interface_type, extension: false)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
292
|
+
extension ? print_string("extend ") : print_description(interface_type)
|
293
|
+
print_string("interface #{interface_type.name}")
|
294
|
+
print_implements(interface_type) if interface_type.interfaces.any?
|
295
|
+
print_directives(interface_type.directives)
|
296
|
+
print_field_definitions(interface_type.fields)
|
219
297
|
end
|
220
298
|
|
221
299
|
def print_union_type_definition(union_type, extension: false)
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
300
|
+
extension ? print_string("extend ") : print_description(union_type)
|
301
|
+
print_string("union #{union_type.name}")
|
302
|
+
print_directives(union_type.directives)
|
303
|
+
print_string(" = #{union_type.types.map(&:name).join(" | ")}")
|
226
304
|
end
|
227
305
|
|
228
306
|
def print_enum_type_definition(enum_type, extension: false)
|
229
|
-
|
230
|
-
|
307
|
+
extension ? print_string("extend ") : print_description(enum_type)
|
308
|
+
print_string("enum #{enum_type.name}")
|
309
|
+
print_directives(enum_type.directives)
|
310
|
+
print_string(" {\n")
|
231
311
|
enum_type.values.each.with_index do |value, i|
|
232
|
-
|
233
|
-
|
312
|
+
print_description(value, indent: " ", first_in_block: i == 0)
|
313
|
+
print_enum_value_definition(value)
|
234
314
|
end
|
235
|
-
|
315
|
+
print_string("}")
|
236
316
|
end
|
237
317
|
|
238
318
|
def print_enum_value_definition(enum_value)
|
239
|
-
|
240
|
-
|
241
|
-
|
319
|
+
print_string(" #{enum_value.name}")
|
320
|
+
print_directives(enum_value.directives)
|
321
|
+
print_string("\n")
|
242
322
|
end
|
243
323
|
|
244
324
|
def print_input_object_type_definition(input_object_type, extension: false)
|
245
|
-
|
246
|
-
|
247
|
-
|
325
|
+
extension ? print_string("extend ") : print_description(input_object_type)
|
326
|
+
print_string("input #{input_object_type.name}")
|
327
|
+
print_directives(input_object_type.directives)
|
248
328
|
if !input_object_type.fields.empty?
|
249
|
-
|
329
|
+
print_string(" {\n")
|
250
330
|
input_object_type.fields.each.with_index do |field, i|
|
251
|
-
|
252
|
-
|
331
|
+
print_description(field, indent: " ", first_in_block: i == 0)
|
332
|
+
print_string(" ")
|
333
|
+
print_input_value_definition(field)
|
334
|
+
print_string("\n")
|
253
335
|
end
|
254
|
-
|
336
|
+
print_string("}")
|
255
337
|
end
|
256
|
-
out
|
257
338
|
end
|
258
339
|
|
259
340
|
def print_directive_definition(directive)
|
260
|
-
|
261
|
-
|
341
|
+
print_description(directive)
|
342
|
+
print_string("directive @#{directive.name}")
|
262
343
|
|
263
344
|
if directive.arguments.any?
|
264
|
-
|
345
|
+
print_arguments(directive.arguments)
|
265
346
|
end
|
266
347
|
|
267
348
|
if directive.repeatable
|
268
|
-
|
349
|
+
print_string(" repeatable")
|
269
350
|
end
|
270
351
|
|
271
|
-
|
352
|
+
print_string(" on #{directive.locations.map(&:name).join(" | ")}")
|
272
353
|
end
|
273
354
|
|
274
355
|
def print_description(node, indent: "", first_in_block: true)
|
275
|
-
return
|
356
|
+
return unless node.description
|
276
357
|
|
277
|
-
|
278
|
-
|
358
|
+
print_string("\n") if indent != "" && !first_in_block
|
359
|
+
print_string(GraphQL::Language::BlockString.print(node.description, indent: indent))
|
279
360
|
end
|
280
361
|
|
281
362
|
def print_field_definitions(fields)
|
282
|
-
if fields.empty?
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
out << "}"
|
363
|
+
return if fields.empty?
|
364
|
+
|
365
|
+
print_string(" {\n")
|
366
|
+
fields.each.with_index do |field, i|
|
367
|
+
print_description(field, indent: " ", first_in_block: i == 0)
|
368
|
+
print_string(" ")
|
369
|
+
print_field_definition(field)
|
370
|
+
print_string("\n")
|
291
371
|
end
|
372
|
+
print_string("}")
|
292
373
|
end
|
293
374
|
|
294
375
|
def print_directives(directives)
|
295
|
-
if directives.
|
296
|
-
|
297
|
-
|
298
|
-
""
|
376
|
+
return if directives.empty?
|
377
|
+
|
378
|
+
directives.each do |d|
|
379
|
+
print_string(" ")
|
380
|
+
print_directive(d)
|
299
381
|
end
|
300
382
|
end
|
301
383
|
|
302
384
|
def print_selections(selections, indent: "")
|
303
|
-
if selections.
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
else
|
310
|
-
""
|
385
|
+
return if selections.empty?
|
386
|
+
|
387
|
+
print_string(" {\n")
|
388
|
+
selections.each do |selection|
|
389
|
+
print_node(selection, indent: indent + " ")
|
390
|
+
print_string("\n")
|
311
391
|
end
|
392
|
+
print_string("#{indent}}")
|
312
393
|
end
|
313
394
|
|
314
395
|
def print_node(node, indent: "")
|
@@ -382,19 +463,26 @@ module GraphQL
|
|
382
463
|
when Nodes::DirectiveDefinition
|
383
464
|
print_directive_definition(node)
|
384
465
|
when FalseClass, Float, Integer, NilClass, String, TrueClass, Symbol
|
385
|
-
GraphQL::Language.serialize(node)
|
466
|
+
print_string(GraphQL::Language.serialize(node))
|
386
467
|
when Array
|
387
|
-
"[
|
468
|
+
print_string("[")
|
469
|
+
node.each_with_index do |v, i|
|
470
|
+
print_node(v)
|
471
|
+
print_string(", ") if i < node.length - 1
|
472
|
+
end
|
473
|
+
print_string("]")
|
388
474
|
when Hash
|
389
|
-
"{
|
475
|
+
print_string("{")
|
476
|
+
node.each_with_index do |(k, v), i|
|
477
|
+
print_string("#{k}: ")
|
478
|
+
print_node(v)
|
479
|
+
print_string(", ") if i < node.length - 1
|
480
|
+
end
|
481
|
+
print_string("}")
|
390
482
|
else
|
391
|
-
GraphQL::Language.serialize(node.to_s)
|
483
|
+
print_string(GraphQL::Language.serialize(node.to_s))
|
392
484
|
end
|
393
485
|
end
|
394
|
-
|
395
|
-
private
|
396
|
-
|
397
|
-
attr_reader :node
|
398
486
|
end
|
399
487
|
end
|
400
488
|
end
|
@@ -40,7 +40,7 @@ module GraphQL
|
|
40
40
|
case node
|
41
41
|
when FalseClass, Float, Integer, String, TrueClass
|
42
42
|
if @current_argument && redact_argument_value?(@current_argument, node)
|
43
|
-
redacted_argument_value(@current_argument)
|
43
|
+
print_string(redacted_argument_value(@current_argument))
|
44
44
|
else
|
45
45
|
super
|
46
46
|
end
|
@@ -51,9 +51,8 @@ module GraphQL
|
|
51
51
|
@current_input_type = @current_input_type.of_type if @current_input_type.non_null?
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
super
|
55
55
|
@current_input_type = old_input_type
|
56
|
-
res
|
57
56
|
else
|
58
57
|
super
|
59
58
|
end
|
@@ -89,11 +88,12 @@ module GraphQL
|
|
89
88
|
else
|
90
89
|
argument.value
|
91
90
|
end
|
92
|
-
|
91
|
+
|
92
|
+
print_string("#{argument.name}: ")
|
93
|
+
print_node(argument_value)
|
93
94
|
|
94
95
|
@current_input_type = old_input_type
|
95
96
|
@current_argument = old_current_argument
|
96
|
-
res
|
97
97
|
end
|
98
98
|
|
99
99
|
def coerce_argument_value_to_list?(type, value)
|
@@ -116,9 +116,8 @@ module GraphQL
|
|
116
116
|
@current_field = query.get_field(@current_type, field.name)
|
117
117
|
old_type = @current_type
|
118
118
|
@current_type = @current_field.type.unwrap
|
119
|
-
|
119
|
+
super
|
120
120
|
@current_type = old_type
|
121
|
-
res
|
122
121
|
end
|
123
122
|
|
124
123
|
def print_inline_fragment(inline_fragment, indent: "")
|
@@ -128,31 +127,26 @@ module GraphQL
|
|
128
127
|
@current_type = query.get_type(inline_fragment.type.name)
|
129
128
|
end
|
130
129
|
|
131
|
-
|
130
|
+
super
|
132
131
|
|
133
132
|
@current_type = old_type
|
134
|
-
|
135
|
-
res
|
136
133
|
end
|
137
134
|
|
138
135
|
def print_fragment_definition(fragment_def, indent: "")
|
139
136
|
old_type = @current_type
|
140
137
|
@current_type = query.get_type(fragment_def.type.name)
|
141
138
|
|
142
|
-
|
139
|
+
super
|
143
140
|
|
144
141
|
@current_type = old_type
|
145
|
-
|
146
|
-
res
|
147
142
|
end
|
148
143
|
|
149
144
|
def print_directive(directive)
|
150
145
|
@current_directive = query.schema.directives[directive.name]
|
151
146
|
|
152
|
-
|
147
|
+
super
|
153
148
|
|
154
149
|
@current_directive = nil
|
155
|
-
res
|
156
150
|
end
|
157
151
|
|
158
152
|
# Print the operation definition but do not include the variable
|
@@ -162,16 +156,15 @@ module GraphQL
|
|
162
156
|
@current_type = query.schema.public_send(operation_definition.operation_type)
|
163
157
|
|
164
158
|
if @inline_variables
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
159
|
+
print_string("#{indent}#{operation_definition.operation_type}")
|
160
|
+
print_string(" #{operation_definition.name}") if operation_definition.name
|
161
|
+
print_directives(operation_definition.directives)
|
162
|
+
print_selections(operation_definition.selections, indent: indent)
|
169
163
|
else
|
170
|
-
|
164
|
+
super
|
171
165
|
end
|
172
166
|
|
173
167
|
@current_type = old_type
|
174
|
-
out
|
175
168
|
end
|
176
169
|
|
177
170
|
private
|