From 85f95c25f8d0330e96974c42ee90aab73108a2f4 Mon Sep 17 00:00:00 2001 From: Peter Kese Date: Tue, 9 Apr 2024 19:51:23 +0200 Subject: [PATCH] Hack around the case where field.ExecuteInput is null --- src/FSharp.Data.GraphQL.Server/Values.fs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/FSharp.Data.GraphQL.Server/Values.fs b/src/FSharp.Data.GraphQL.Server/Values.fs index 641ae9a24..c79a30ef3 100644 --- a/src/FSharp.Data.GraphQL.Server/Values.fs +++ b/src/FSharp.Data.GraphQL.Server/Values.fs @@ -188,6 +188,19 @@ let rec internal compileByType (inputObjectPath: FieldPath) (inputSource : Input | ValueSome field -> match Map.tryFind field.Name props with | None -> Ok <| wrapOptionalNone param.ParameterType field.TypeDef.Type + | Some input when isNull (box field.ExecuteInput) -> + // hack around the case where field.ExecuteInput is null + let rec extract = function + | NullValue -> null + | IntValue i -> box i + | FloatValue f -> box f + | BooleanValue b -> box b + | StringValue s -> box s + | EnumValue e -> box e + | ListValue l -> box (l |> List.map extract) + | ObjectValue o -> o |> Map.map (fun k v -> extract v) |> box + | VariableName v -> failwithf "Todo: extract variable" + extract input |> Ok | Some prop -> field.ExecuteInput prop variables |> Result.map (normalizeOptional param.ParameterType) |> attachErrorExtensionsIfScalar inputSource inputObjectPath originalInputDef field