Created
October 21, 2020 17:32
-
-
Save bessgeor/6529d0ae94f9c4582eb08d62cb9144fc to your computer and use it in GitHub Desktop.
null-checking codegen example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(checkForUnexpectedNulls (fun (x: dataSetListInput) -> | |
(seq { | |
if isNullReference x then | |
"body" | |
else if isNullReference x.nullCheckingTest then | |
"body.nullCheckingTest" | |
else | |
yield! | |
x.nullCheckingTest | |
|> Seq.mapi (fun i1 -> | |
(fun (x: nullCheckingTest) -> | |
(seq { | |
if isNullReference x then | |
(sprintf "body.nullCheckingTest.[%d]" i1) | |
else | |
yield! | |
x.optionalArrayOfOptional | |
|> Option.map (fun (x: optionalArrayOfOptional option array) -> | |
(seq { | |
if isNullReference x then | |
(sprintf | |
"body.nullCheckingTest.[%d].optionalArrayOfOptional?.Value" | |
i1) | |
else | |
yield! | |
x | |
|> Seq.mapi (fun i2 -> | |
(fun (x: optionalArrayOfOptional option) -> | |
(seq { | |
yield! | |
x | |
|> Option.map (fun (x: optionalArrayOfOptional) -> | |
(seq { | |
if isNullReference | |
x then | |
(sprintf | |
"body.nullCheckingTest.[%d].optionalArrayOfOptional?.Value.[%d]?.Value" | |
i1 | |
i2) | |
else if isNullReference | |
x.requiredArray then | |
(sprintf | |
"body.nullCheckingTest.[%d].optionalArrayOfOptional?.Value.[%d]?.Value.requiredArray" | |
i1 | |
i2) | |
else | |
yield! | |
x.requiredArray | |
|> Seq.mapi (fun i3 -> | |
(fun (x: string) -> | |
(seq { | |
if isNullReference | |
x then | |
(sprintf | |
"body.nullCheckingTest.[%d].optionalArrayOfOptional?.Value.[%d]?.Value.requiredArray.[%d]" | |
i1 | |
i2 | |
i3) | |
else | |
yield! | |
Seq.empty | |
}))) | |
|> Seq.collect | |
id | |
})) | |
|> Option.defaultValue | |
Seq.empty | |
}))) | |
|> Seq.collect id | |
})) | |
|> Option.defaultValue Seq.empty | |
}))) | |
|> Seq.collect id | |
})) BodyBindingError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment