Skip to content

Commit bed4cc6

Browse files
committed
Hack around the case where field.ExecuteInput is null
1 parent 8c34550 commit bed4cc6

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
@@ -205,6 +205,19 @@ let rec internal compileByType
205205
| None ->
206206
Ok
207207
<| wrapOptionalNone param.ParameterType field.TypeDef.Type
208+
| Some input when isNull (box field.ExecuteInput) ->
209+
// hack around the case where field.ExecuteInput is null
210+
let rec extract = function
211+
| NullValue -> null
212+
| IntValue i -> box i
213+
| FloatValue f -> box f
214+
| BooleanValue b -> box b
215+
| StringValue s -> box s
216+
| EnumValue e -> box e
217+
| ListValue l -> box (l |> List.map extract)
218+
| ObjectValue o -> o |> Map.map (fun k v -> extract v) |> box
219+
| VariableName v -> failwithf "Todo: extract variable"
220+
extract input |> Ok
208221
| Some prop ->
209222
field.ExecuteInput prop variables
210223
|> Result.map (normalizeOptional param.ParameterType)

0 commit comments

Comments
 (0)