URI support (#59)

This commit is contained in:
Patrick Stevens
2024-01-03 19:47:59 +00:00
committed by GitHub
parent 7b3bd32323
commit ad2eeaaa4f
7 changed files with 100 additions and 0 deletions

View File

@@ -423,6 +423,15 @@ module internal SynTypePatterns =
| _ -> None
| _ -> None
let (|Uri|_|) (fieldType : SynType) =
match fieldType with
| SynType.LongIdent (SynLongIdent.SynLongIdent (ident, _, _)) ->
match ident |> List.map (fun i -> i.idText) with
| [ "System" ; "Uri" ]
| [ "Uri" ] -> Some ()
| _ -> None
| _ -> None
let (|Task|_|) (fieldType : SynType) : SynType option =
match fieldType with
| SynType.App (SynType.LongIdent (SynLongIdent.SynLongIdent (ident, _, _)), _, args, _, _, _, _) ->

View File

@@ -136,6 +136,10 @@ module internal JsonParseGenerator =
|> SynExpr.pipeThroughFunction (
SynExpr.CreateLongIdent (SynLongIdent.Create [ "System" ; "DateOnly" ; "Parse" ])
)
| Uri ->
node
|> asValueGetValue propertyName "string"
|> SynExpr.pipeThroughFunction (SynExpr.CreateLongIdent (SynLongIdent.Create [ "System" ; "Uri" ]))
| DateTime ->
node
|> asValueGetValue propertyName "string"