Skip to content

Commit 85f95c2

Browse files
pkesexperiandri
authored andcommitted
Hack around the case where field.ExecuteInput is null
1 parent 21ddd51 commit 85f95c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/FSharp.Data.GraphQL.Server/Values.fs

+13
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ let rec internal compileByType (inputObjectPath: FieldPath) (inputSource : Input
188188
| ValueSome field ->
189189
match Map.tryFind field.Name props with
190190
| None -> Ok <| wrapOptionalNone param.ParameterType field.TypeDef.Type
191+
| Some input when isNull (box field.ExecuteInput) ->
192+
// hack around the case where field.ExecuteInput is null
193+
let rec extract = function
194+
| NullValue -> null
195+
| IntValue i -> box i
196+
| FloatValue f -> box f
197+
| BooleanValue b -> box b
198+
| StringValue s -> box s
199+
| EnumValue e -> box e
200+
| ListValue l -> box (l |> List.map extract)
201+
| ObjectValue o -> o |> Map.map (fun k v -> extract v) |> box
202+
| VariableName v -> failwithf "Todo: extract variable"
203+
extract input |> Ok
191204
| Some prop ->
192205
field.ExecuteInput prop variables |> Result.map (normalizeOptional param.ParameterType)
193206
|> attachErrorExtensionsIfScalar inputSource inputObjectPath originalInputDef field

0 commit comments

Comments
 (0)