diff options
author | 2025-02-23 18:47:01 +0100 | |
---|---|---|
committer | 2025-02-23 21:40:01 +0100 | |
commit | b2d4c0aa5a25dffa25269a80b30b50896de5a4bb (patch) | |
tree | deaddf4b1591e8efc9c2e529be435c4e8d66e0c6 /frontend/app/Schema.hs | |
parent | 25ba6b6bf253fe0a2683bd2919c8320a82385390 (diff) |
fix schema decoding in frontend
Diffstat (limited to 'frontend/app/Schema.hs')
-rw-r--r-- | frontend/app/Schema.hs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/frontend/app/Schema.hs b/frontend/app/Schema.hs index 5f4ddae..5265d57 100644 --- a/frontend/app/Schema.hs +++ b/frontend/app/Schema.hs @@ -11,9 +11,9 @@ where import ACMS.API.REST.Collection.Paginated (Paginated (..)) import Control.Applicative ((<|>)) import Data.Aeson qualified as A +import Data.Aeson.Encoding.Internal qualified as AE import Data.Aeson.Key qualified as AK import Data.Aeson.KeyMap qualified as AM -import Data.List import Data.Map qualified as M import Data.Maybe import Data.Scientific (fromFloatDigits) @@ -51,7 +51,13 @@ instance A.FromJSON Schema where #ifdef ghcjs_HOST_OS instance A.FromJSONKey MisoString where - fromJSONKey = fromMisoString <$> A.fromJSONKey + fromJSONKey = A.FromJSONKeyText toMisoString + +instance A.ToJSONKey MisoString where + toJSONKey = + A.ToJSONKeyText + (AK.fromText . fromMisoString) + (AE.key . AK.fromText . fromMisoString) #endif data Property @@ -99,7 +105,7 @@ schemaTable collection schema paginated = thead_ [] $ [ tr_ [] $ [ th_ [] [text (toMisoString k)] - | k <- M.keys schema.properties + | k <- M.keys schema.properties ] ] tbody = @@ -128,9 +134,9 @@ schemaTable collection schema paginated = A.String s -> toMisoString s _ -> toMisoString (A.encode v) ] - | (k, p) <- M.assocs schema.properties + | (k, p) <- M.assocs schema.properties ] - | value <- paginated.data_ + | value <- paginated.data_ ] tfoot = let page, lastPage, perPage :: Int |