Commit 1faa47fd authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Revert From/ToHttpApiData NodeType instances

In my previous commit I had changed their implementation to use the
FromJSON/ToJSON istances, making sure those were backward compatible,
but apparently that wasn't the case.
parent 99bee7dc
Pipeline #5917 passed with stages
in 185 minutes and 53 seconds
......@@ -27,14 +27,11 @@ import Codec.Serialise (Serialise())
import Data.Aeson as JSON
import Data.Aeson.Types
import Data.Aeson.TH (deriveJSON)
import Data.Bifunctor
import Data.ByteString.Lazy qualified as BL
import Data.Csv qualified as Csv
import Data.Morpheus.Kind (SCALAR)
import Data.Morpheus.Types
import Data.Swagger
import Data.Text (pack)
import Data.Text.Encoding qualified as TE
import Data.Text (pack, unpack)
import Data.Time (UTCTime)
import Database.PostgreSQL.Simple.FromField (FromField, fromField, fromJSONField)
import Database.PostgreSQL.Simple.ToField (ToField, toField, toJSONField)
......@@ -537,10 +534,13 @@ instance FromJSON NodeType where
unhandled
-> typeMismatch "NodeType" (JSON.String unhandled)
-- | FIXME(adn) these instances could reuse the fromJSON/toJSON instances,
-- but for some reason this broke the frontend:
-- https://gitlab.iscpif.fr/gargantext/haskell-gargantext/merge_requests/277#note_10388
instance FromHttpApiData NodeType where
parseUrlPiece = first pack . eitherDecode . BL.fromStrict . TE.encodeUtf8
parseUrlPiece = Right . read . unpack
instance ToHttpApiData NodeType where
toUrlPiece = TE.decodeUtf8 . BL.toStrict . JSON.encode
toUrlPiece = pack . show
instance ToParamSchema NodeType
instance ToSchema NodeType
instance Arbitrary NodeType where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment