Enforce non-nullability in more cases during JSON parse (#367)

This commit is contained in:
Patrick Stevens
2025-04-20 18:20:22 +01:00
committed by GitHub
parent 7930039ad1
commit f944953384
9 changed files with 1088 additions and 203 deletions

View File

@@ -48,7 +48,14 @@ module PureGymApi =
System.Text.Json.Nodes.JsonNode.ParseAsync (responseStream, cancellationToken = ct)
|> Async.AwaitTask
return jsonNode.AsArray () |> Seq.map (fun elt -> Gym.jsonParse elt) |> List.ofSeq
return
jsonNode.AsArray ()
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> Gym.jsonParse elt)
)
|> List.ofSeq
}
|> (fun a -> Async.StartAsTask (a, ?cancellationToken = ct))