pass allow-all warden to valid_input? on graphql >= 1.1.0
This commit is contained in:
Родитель
f436cf736b
Коммит
4f0159ea09
|
@ -106,7 +106,7 @@ module GraphQL::Relay::Walker
|
|||
|
||||
# Bail unless we have the required arguments.
|
||||
return unless field.arguments.reject do |_, arg|
|
||||
arg.type.valid_input?(nil)
|
||||
valid_input?(arg.type, nil)
|
||||
end.all? do |name, _|
|
||||
arguments.key?(name)
|
||||
end
|
||||
|
@ -243,5 +243,16 @@ module GraphQL::Relay::Walker
|
|||
def random_alias
|
||||
6.times.map { (SecureRandom.random_number(26) + 97).chr }.join
|
||||
end
|
||||
|
||||
if GraphQL::VERSION >= "1.1.0"
|
||||
def valid_input?(type, input)
|
||||
allow_all = GraphQL::Schema::Warden.new(schema, ->(_) { false })
|
||||
type.valid_input?(input, allow_all)
|
||||
end
|
||||
else
|
||||
def valid_input?(type, input)
|
||||
type.valid_input?(input)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче