diff options
Diffstat (limited to 'frontend/app/Schema.hs')
-rw-r--r-- | frontend/app/Schema.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/frontend/app/Schema.hs b/frontend/app/Schema.hs index 0530061..1a52f52 100644 --- a/frontend/app/Schema.hs +++ b/frontend/app/Schema.hs @@ -115,12 +115,15 @@ schemaForm schema = "string" -> A.Object . AM.singleton k <$> ( F.mapValues (getO k) (setO k) $ - jsonString (AK.toString k) + fmap A.String . F.mapValues fromJson toJson $ + F.input (AK.toString k) ) "string?" -> A.Object . AM.singleton k - <$> ( F.mapValues (getO k) (setO k) $ - jsonString (AK.toString k) + <$> ( F.mapValues (getO k) (setO k) + $ fmap (maybe A.Null A.String) + . F.mapValues fromJson toJson + $ F.optional (F.input (AK.toString k)) ) ) <$> (M.toList properties) @@ -143,6 +146,3 @@ getO k (A.Object kvs) = fromMaybe A.Null (AM.lookup k kvs) setO :: AK.Key -> A.Value -> A.Value -> A.Value setO k v (A.Object kvs) = A.Object (AM.insert k v kvs) - -jsonString :: String -> F.Form A.Value A.Value -jsonString = fmap A.String . F.mapValues fromJson toJson . F.string |