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 authored and xperiandri committed Apr 21, 2024
1 parent 21ddd51 commit 85f95c2
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 @@ -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
Expand Down

0 comments on commit 85f95c2

Please sign in to comment.