We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
false
In the Request class, the prepare! method applies default values to variables using conditional assignment:
prepare!
operation.variables.each do |v| @variables[v.name] ||= v.default_value end
Unfortunately,false is falsey (obviously), so it is always overwritten with the value in v.default_value (which could be nil or true).
v.default_value
nil
true
This is critical, I'd think, considering it can flip false boolean values to true if the default is true.
Script to reproduce (run from project root):
require_relative 'lib/graphql/stitching' require_relative 'lib/graphql/stitching/request' query = <<~GRAPHQL query($a: Boolean, $b: Boolean, $c: Boolean = true) { base(a: $a, b: $b, c: $c) { id } } GRAPHQL variables = { "a" => true, "b" => false, "c" => false } request = GraphQL::Stitching::Request.new(GraphQL.parse(query), variables: variables) request.prepare! puts request.variables # {"a"=>true, "b"=>nil, "c"=>true}
Fix is simple, I'll open a PR in a moment with the fix + a test.
The text was updated successfully, but these errors were encountered:
Good catch!
Sorry, something went wrong.
Resolved by #92
No branches or pull requests
In the Request class, the
prepare!
method applies default values to variables using conditional assignment:Unfortunately,
false
is falsey (obviously), so it is always overwritten with the value inv.default_value
(which could benil
ortrue
).This is critical, I'd think, considering it can flip
false
boolean values totrue
if the default istrue
.Script to reproduce (run from project root):
Fix is simple, I'll open a PR in a moment with the fix + a test.
The text was updated successfully, but these errors were encountered: