Add JSON parse source gen (#9)

This commit is contained in:
Patrick Stevens
2023-12-27 11:46:12 +00:00
committed by GitHub
parent 055aad8c5e
commit 39d603c317
22 changed files with 882 additions and 145 deletions

View File

@@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
// This code was generated by myriad.
// Changes to this file will be lost when the code is regenerated.
//------------------------------------------------------------------------------
namespace ConsumePlugin
/// Module containing JSON parsing methods for the InnerType type
[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module InnerType =
/// Parse from a JSON node.
let jsonParse (node : System.Text.Json.Nodes.JsonNode) : InnerType =
let Thing = node.[(Literals.something)].AsValue().GetValue<string> ()
{
Thing = Thing
}
namespace ConsumePlugin
/// Module containing JSON parsing methods for the JsonRecordType type
[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module JsonRecordType =
/// Parse from a JSON node.
let jsonParse (node : System.Text.Json.Nodes.JsonNode) : JsonRecordType =
let D = InnerType.jsonParse node.["d"]
let C =
node.["hi"].AsArray ()
|> Seq.map (fun elt -> elt.GetValue<int> ())
|> List.ofSeq
let B2 = node.["another-thing"].AsValue ()
let B = B2.GetValue<string> ()
let A = node.["a"].AsValue().GetValue<int> ()
{
A = A
B = B
C = C
D = D
}