Uh oh!
There was an error while loading. Please reload this page.
* First pass at custom coerce for input objects - #350
Conversation
xperiandri
left a comment
There was a problem hiding this comment.
I like what you have done. This is useful.
Also, it would be more useful to be able to return an error and pass that error to the response with error to GraphQL field mapping.
| |> Array.map (fun field -> | ||
| let valueFound = Map.tryFind field.Name map |> Option.toObj | ||
| let coercedValue = coerceVariableValue false field.TypeDef vardef valueFound (errMsg + (sprintf "in field '%s': " field.Name)) |
There was a problem hiding this comment.
| |>Array.map (fun field -> | |
| letvalueFound= Map.tryFind field.Name map|> Option.toObj | |
| letcoercedValue= coerceVariableValue false field.TypeDef vardef valueFound (errMsg +(sprintf "in field '%s': " field.Name)) | |
| |>Seq.map (fun field -> | |
| letvalueFound=map |>Map.tryFind field.Name |> Option.toObj | |
| letcoercedValue= coerceVariableValue false field.TypeDef vardef valueFound (errMsg +(sprintf "in field '%s': " field.Name)) |
Maybe it does not worth to materialize it to an array
Uh oh!
There was an error while loading. Please reload this page.
| @@ -38,31 +38,36 @@ let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInp | |||
| | Scalar scalardef -> | |||
| variableOrElse (scalardef.CoerceInput >> Option.toObj) | |||
There was a problem hiding this comment.
@jberzy can we switch this to Result<,> and pass an error to the response?
xperiandri
commented
Sep 28, 2021
There is an issue I have with current scalar implementation interface ScalarDef withmemberx.Name= x.Name
memberx.Description= x.Description
memberx.CoerceInput input = x.CoerceInput input |> Option.map box
memberx.CoerceValue value =(x.CoerceValue value)|> Option.map boxThis piece is very contraintuitive memberx.CoerceInput input = x.CoerceInput input |> Option.map box
memberx.CoerceValue value =(x.CoerceValue value)|> Option.map box@jberzy at least XML comments with clear description required. And |
njlr
commented
Oct 6, 2021
@xperiandri I have fleshed out this idea further: #351 |
No description provided.