Closed deiwo closed 2 years ago
As pointed out in #1073, behaviour of v15
is wrong and was fixed on master
in #1080. Detailed spec explanation can be found in Coercing Field Arguments section, but I find wording here more helpful:
In other words, there is a semantic difference between the explicitly provided value null versus having not provided a value.
So providing null
for shouldSwitch
field is different from not providing value at all. In current scenario first option should raise an error, while second one will use default value.
I guess, the issue with the client, that it considers undefined
as null
, so that's why doesn't type check.
Describe the bug The problem is when mutation argument is specified with scalar type and a default value in the macro. In the schema that is generated this argument is marked as required with
!
even though it doesn't have to be required, since the default value is specified.To Reproduce Define a simple mutation:
The generated schema:
Send a request to this mutation with
should_switch
set toundefined
. This request gets a error response that the required type isBoolean!
butBoolean
was provided.Expected behavior The default value is used for the argument and no error is raised.
Additional information This behavior occurs in
master
branch, but in thev15
it works as expected.