add string?-typed fields

This commit is contained in:
Alexander Foremny
2024-06-06 15:20:13 +02:00
parent c7d0139116
commit d39c1665f8
2 changed files with 13 additions and 5 deletions

View File

@@ -91,6 +91,7 @@ fromAutoTypes path (U.Object ps) =
]
where
toProperty k (U.Scalar "string") = "string" :: String
toProperty k (U.Option (Just (U.Scalar "string"))) = "string?" :: String
watch :: TMVar Repo -> FilePath -> G.RefName -> IO ()
watch repoT root ref = do

View File

@@ -100,7 +100,14 @@ schemaForm schema =
fmap mergeJson . sequence $
case schema.type_ of
Object properties ->
( \(AK.fromString -> k, "string") ->
( \(AK.fromString -> k, v) ->
case v of
"string" ->
A.Object . AM.singleton k
<$> ( F.mapValues (getO k) (setO k) $
jsonString (AK.toString k)
)
"string?" ->
A.Object . AM.singleton k
<$> ( F.mapValues (getO k) (setO k) $
jsonString (AK.toString k)