Skip to content

Commit

Permalink
Hack around the case where field.ExecuteInput is null
Browse files Browse the repository at this point in the history
  • Loading branch information
pkese committed Sep 20, 2024
1 parent 8c34550 commit bed4cc6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/FSharp.Data.GraphQL.Server/Values.fs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ let rec internal compileByType
| 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)
Expand Down

0 comments on commit bed4cc6

Please sign in to comment.