Queries and probably also mutations (but I did not check mutations) no longer support Nullable for input parameters when setting the input parameter to null. Setting an input parameter to null will always result in failing to convert it to the inner type of the Nullable.
I think it goes wrong somewhere in file Values.fscompileByType as I see that originalInputDef is not used in the branch for Scalar. I don't understand the code well enough to figure out how it is supposed to work though.
Repro steps
Please see the following test that can be added on line 220 in ExecutionTests.fs:
[<Fact>]
let ``Execution handles basic tasks: correctly handles null arguments`` () =
let query = """query Example {
b(numArg: null, stringArg: null)
}"""
let data = { Num = None; Str = None }
let Type =
Define.Object("Type",
[ Define.Field("b", Nullable StringType, "", [ Define.Input("numArg", Nullable IntType); Define.Input("stringArg", Nullable StringType) ],
fun ctx value ->
value.Num <- ctx.TryArg("numArg")
value.Str <- ctx.TryArg("stringArg")
value.Str) ])
let result = sync <| Executor(Schema(Type)).AsyncExecute(parse query, data)
ensureDirect result <| fun data errors -> empty errors
equals None data.Num
equals None data.Str
Expected behavior
Setting an input parameter to null makes it None.
Actual behavior
Setting a Nullable IntType (or any other inner type) input parameter to null causes this error: Inline value 'null' cannot be converted into integer.
Description
Queries and probably also mutations (but I did not check mutations) no longer support
Nullable
for input parameters when setting the input parameter tonull
. Setting an input parameter tonull
will always result in failing to convert it to the inner type of theNullable
.I think it goes wrong somewhere in file
Values.fs
compileByType
as I see thatoriginalInputDef
is not used in the branch forScalar
. I don't understand the code well enough to figure out how it is supposed to work though.Repro steps
Please see the following test that can be added on line 220 in
ExecutionTests.fs
:Expected behavior
Setting an input parameter to
null
makes itNone
.Actual behavior
Setting a
Nullable IntType
(or any other inner type) input parameter tonull
causes this error:Inline value 'null' cannot be converted into integer
.Known workarounds
No known workarounds.
Related information
Version 2.0.0-beta of the nuget packages.