Cope with unit type in JSON (#262)

This commit is contained in:
Patrick Stevens
2024-09-15 15:37:50 +01:00
committed by GitHub
parent e22525c200
commit 9a3ebbf28f
7 changed files with 29 additions and 1 deletions

View File

@@ -147,6 +147,12 @@ module internal JsonSerializeGenerator =
|> SynExpr.createLambda "field"
|> fun e -> e, false
| JsonNode -> SynExpr.createIdent "id", true
| Unit ->
SynExpr.createLambda
"value"
(SynExpr.createLongIdent [ "System" ; "Text" ; "Json" ; "Nodes" ; "JsonObject" ]
|> SynExpr.applyTo (SynExpr.CreateConst ())),
false
| _ ->
// {type}.toJsonNode
let typeName =