From 1da76ca09c5693c718a6c212d1aca32cce77a59e Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Mon, 10 Apr 2017 13:45:22 -0400 Subject: [PATCH 1/4] Use valid_isolated_input? As per the deprecation notice noted in https://git.io/vS6hn. --- lib/graphql/relay/walker/query_builder.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/graphql/relay/walker/query_builder.rb b/lib/graphql/relay/walker/query_builder.rb index 6b11e18..988d85e 100644 --- a/lib/graphql/relay/walker/query_builder.rb +++ b/lib/graphql/relay/walker/query_builder.rb @@ -244,7 +244,12 @@ module GraphQL::Relay::Walker 12.times.map { (SecureRandom.random_number(26) + 97).chr }.join end - if GraphQL::VERSION >= "1.4.0" + if GraphQL::VERSION >= "1.5.6" + def valid_input?(type, input) + allow_all = GraphQL::Schema::Warden.new(->(_) { false }, schema: schema, context: nil) + type.valid_isolated_input?(input, allow_all) + end + elsif GraphQL::VERSION >= "1.4.0" def valid_input?(type, input) allow_all = GraphQL::Schema::Warden.new(->(_) { false }, schema: schema, context: nil) type.valid_input?(input, allow_all) From 2bfa2288684f8a85dae4926117c70dd54458355e Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Mon, 10 Apr 2017 14:03:37 -0400 Subject: [PATCH 2/4] Remove use of warden as it's no longer required --- lib/graphql/relay/walker/query_builder.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/graphql/relay/walker/query_builder.rb b/lib/graphql/relay/walker/query_builder.rb index 988d85e..ac8c71e 100644 --- a/lib/graphql/relay/walker/query_builder.rb +++ b/lib/graphql/relay/walker/query_builder.rb @@ -246,8 +246,7 @@ module GraphQL::Relay::Walker if GraphQL::VERSION >= "1.5.6" def valid_input?(type, input) - allow_all = GraphQL::Schema::Warden.new(->(_) { false }, schema: schema, context: nil) - type.valid_isolated_input?(input, allow_all) + type.valid_isolated_input?(input) end elsif GraphQL::VERSION >= "1.4.0" def valid_input?(type, input) From 7c4c85776a536be526db71e5862d23a18a7dd38b Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Mon, 10 Apr 2017 14:18:45 -0400 Subject: [PATCH 3/4] Use valid_isolated_input in field_ast --- lib/graphql/relay/walker/query_builder.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/graphql/relay/walker/query_builder.rb b/lib/graphql/relay/walker/query_builder.rb index ac8c71e..eefa644 100644 --- a/lib/graphql/relay/walker/query_builder.rb +++ b/lib/graphql/relay/walker/query_builder.rb @@ -106,7 +106,11 @@ module GraphQL::Relay::Walker # Bail unless we have the required arguments. return unless field.arguments.reject do |_, arg| - valid_input?(arg.type, nil) + if GraphQL::VERSION >= "1.5.6" + type.valid_isolated_input?(arg.type) + else + valid_input?(arg.type) + end end.all? do |name, _| arguments.key?(name) end From 26f9dc9b80574983654488adf8e33710a5957612 Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Mon, 10 Apr 2017 14:31:09 -0400 Subject: [PATCH 4/4] Revert "Use valid_isolated_input in field_ast" This reverts commit 7c4c85776a536be526db71e5862d23a18a7dd38b. --- lib/graphql/relay/walker/query_builder.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/graphql/relay/walker/query_builder.rb b/lib/graphql/relay/walker/query_builder.rb index eefa644..ac8c71e 100644 --- a/lib/graphql/relay/walker/query_builder.rb +++ b/lib/graphql/relay/walker/query_builder.rb @@ -106,11 +106,7 @@ module GraphQL::Relay::Walker # Bail unless we have the required arguments. return unless field.arguments.reject do |_, arg| - if GraphQL::VERSION >= "1.5.6" - type.valid_isolated_input?(arg.type) - else - valid_input?(arg.type) - end + valid_input?(arg.type, nil) end.all? do |name, _| arguments.key?(name) end