@@ -376,7 +376,6 @@ let rec private direct (returnDef : OutputDef) (ctx : ResolveFieldContext) (path
376376 match Map.tryFind resolvedDef.Name typeMap with
377377 | Some fields -> executeObjectFields fields name resolvedDef ctx path value
378378 | None -> KeyValuePair( name, null ) |> ResolverResult.data |> AsyncVal.wrap
379- //| None -> raiseErrors <| interfaceImplError iDef.Name resolvedDef.Name path ctx
380379
381380 | Union uDef ->
382381 let possibleTypesFn = ctx.Schema.GetPossibleTypes
@@ -389,7 +388,6 @@ let rec private direct (returnDef : OutputDef) (ctx : ResolveFieldContext) (path
389388 match Map.tryFind resolvedDef.Name typeMap with
390389 | Some fields -> executeObjectFields fields name resolvedDef ctx path ( uDef.ResolveValue value)
391390 | None -> KeyValuePair( name, null ) |> ResolverResult.data |> AsyncVal.wrap
392- //| None -> raiseErrors <| unionImplError uDef.Name resolvedDef.Name path ctx
393391
394392 | _ -> failwithf " Unexpected value of returnDef: %O " returnDef
395393
@@ -451,7 +449,7 @@ and private streamed (options : BufferedStreamOptions) (innerDef : OutputDef) (c
451449 |> Array.mapi resolveItem
452450 |> Observable.ofAsyncValSeq
453451 |> buffer
454- ResolverResult.defered ( KeyValuePair ( info.Identifier, null )) stream |> AsyncVal.wrap
452+ ResolverResult.defered ( KeyValuePair ( info.Identifier, box [] )) stream |> AsyncVal.wrap
455453 | _ -> raise <| GQLMessageException ( ErrorMessages.expectedEnumerableValue ctx.ExecutionInfo.Identifier ( value.GetType()))
456454
457455and private live ( ctx : ResolveFieldContext ) ( path : FieldPath ) ( parent : obj ) ( value : obj ) =
@@ -511,18 +509,21 @@ and private executeResolvers (ctx : ResolveFieldContext) (path : FieldPath) (par
511509 | Ok None when ctx.ExecutionInfo.IsNullable -> return Ok ( KeyValuePair( name, null ), None, [])
512510 | Error errs -> return Error errs
513511 | Ok None -> return Error ( nullResolverError name path ctx)
514- | Ok ( Some v) -> return ! onSuccess ctx path parent v
512+ | Ok ( Some v) ->
513+ match ! onSuccess ctx path parent v with
514+ | Ok ( kvp, _, _) when not ctx.ExecutionInfo.IsNullable && kvp.Value = null -> return Error ( nullResolverError name path ctx)
515+ | result -> return result
515516 }
516517
517518 match info.Kind, returnDef with
518519 | ResolveDeferred innerInfo, _ when innerInfo.IsNullable -> // We can only defer nullable fields
519520 deferred
520- |> resolveWith { ctx with ExecutionInfo = { innerInfo with IsNullable = false } }
521+ |> resolveWith { ctx with ExecutionInfo = innerInfo }
521522 | ResolveDeferred innerInfo, _ ->
522523 raiseErrors <| deferredNullableError ( innerInfo.Identifier) ( innerInfo.ReturnDef.ToString()) path ctx
523524 | ResolveStreamed ( innerInfo, mode), HasList innerDef -> // We can only stream lists
524525 streamed mode innerDef
525- |> resolveWith { ctx with ExecutionInfo = innerInfo; }
526+ |> resolveWith { ctx with ExecutionInfo = innerInfo }
526527 | ResolveStreamed ( innerInfo, _), _ ->
527528 raiseErrors <| streamListError innerInfo.Identifier ( returnDef.ToString()) path ctx
528529 | ResolveLive innerInfo, _ ->
0 commit comments