You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#3370 fixed a bug with input object argument validation.
Prior to this fix, an Int variable could be passed for an ID-type argument, and it would succeed. As of the change in #3370, which was released in 1.12.6, this will now result in an error:
{"message"=>"Type mismatch on variable $id and argument id (Int! / ID!)", "locations"=>[{"line"=>2, "column"=>31}], "path"=>["mutation Xxx", "xxx", "input", "id"], "extensions"=>{"code"=>"variableMismatch", "variableName"=>"id", "typeName"=>"Int!", "argumentName"=>"id", "errorMessage"=>"Type mismatch"}}
Versions
graphql version: 1.12.6 rails (or other framework): 6.1.2.1 newrelic_rpm 6.15.0 included via use(GraphQL::Tracing::NewRelicTracing, set_transaction_name: true)
Execute the mutation with an argument of type Int!
Expected behavior
Behavior before 1.12.6 was to accept the Int variable as an ID type.
Actual behavior
As of 1.12.6, this results in an error.
This might conform better to the GraphQL spec, but it's unexpected in a patch version, since it breaks backward compatibility.
Additional context
This only affects variables passed to ID! arguments. You can still pass an integer value for an ID! argument, and this succeeds in 1.12.6.
mutation {
test(input: {id: 5) {
success
}
}
The text was updated successfully, but these errors were encountered:
RobinDaugherty
changed the title
Breaking change in 1.12.6: Int! variable no longer accepted for ID! argument
Breaking change in 1.12.6: Int variable no longer accepted for ID argument
Mar 30, 2021
Sorry for the unpleasant surprise 😖 I don't plan to revert the change, since, as you noted, it's a fix to properly implement the specification. However, I updated the changelog in dcd0e11 to alert any future readers.
Describe the bug
#3370 fixed a bug with input object argument validation.
Prior to this fix, an
Int
variable could be passed for anID
-type argument, and it would succeed. As of the change in #3370, which was released in 1.12.6, this will now result in an error:Versions
graphql
version: 1.12.6rails
(or other framework): 6.1.2.1newrelic_rpm
6.15.0 included viause(GraphQL::Tracing::NewRelicTracing, set_transaction_name: true)
GraphQL schema
Yes.
New Relic (listed above)
Here's a stripped-down example of the mutation clas:
GraphQL query
Example GraphQL query and response
With 1.12.5
With 1.12.6
Steps to reproduce
ID!
argumentInt!
Expected behavior
Behavior before 1.12.6 was to accept the
Int
variable as an ID type.Actual behavior
As of 1.12.6, this results in an error.
This might conform better to the GraphQL spec, but it's unexpected in a patch version, since it breaks backward compatibility.
Additional context
This only affects variables passed to
ID!
arguments. You can still pass an integer value for anID!
argument, and this succeeds in 1.12.6.The text was updated successfully, but these errors were encountered: