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

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,11 @@ module JsonRecordType =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.Int32> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.Int32> ())
)
|> Array.ofSeq
let arg_4 =
@@ -84,7 +88,11 @@ module JsonRecordType =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> Array.ofSeq
let arg_3 =
@@ -109,7 +117,11 @@ module JsonRecordType =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.Int32> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.Int32> ())
)
|> List.ofSeq
let arg_1 =

View File

@@ -60,7 +60,11 @@ module GymOpeningHours =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> List.ofSeq
let arg_0 =
@@ -1038,7 +1042,11 @@ module Sessions =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> Visit.jsonParse elt)
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> Visit.jsonParse elt)
)
|> List.ofSeq
let arg_0 =

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))

View File

@@ -408,7 +408,11 @@ module InnerTypeWithBothJsonParseExtension =
let value =
(kvp.Value).AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.Char> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.Char> ())
)
|> List.ofSeq
key, value
@@ -676,7 +680,11 @@ module JsonRecordTypeWithBothJsonParseExtension =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.Int32> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.Int32> ())
)
|> Array.ofSeq
let arg_4 =
@@ -689,7 +697,11 @@ module JsonRecordTypeWithBothJsonParseExtension =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> Array.ofSeq
let arg_3 =
@@ -714,7 +726,11 @@ module JsonRecordTypeWithBothJsonParseExtension =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.Int32> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.Int32> ())
)
|> List.ofSeq
let arg_1 =

View File

@@ -94,7 +94,11 @@ module JwtVaultAuthResponse =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> List.ofSeq
let arg_3 =
@@ -107,7 +111,11 @@ module JwtVaultAuthResponse =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> List.ofSeq
let arg_2 =
@@ -120,7 +128,11 @@ module JwtVaultAuthResponse =
)
| v -> v)
.AsArray ()
|> Seq.map (fun elt -> elt.AsValue().GetValue<System.String> ())
|> Seq.map (fun elt ->
(match elt with
| null -> raise (System.ArgumentNullException ())
| elt -> elt.AsValue().GetValue<System.String> ())
)
|> List.ofSeq
let arg_1 =