Commit 21a3b34a authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch '300-dev-purescript-simple-json' into 301-dev-visio-integration

parents d954aec0 bf96709f
Pipeline #1595 failed with stage
......@@ -33,16 +33,6 @@ derive instance Generic DocumentsView _
instance Eq DocumentsView where
eq = genericEq
{-
derive instance Generic DocumentsView _
instance Show DocumentsView where
show = genericShow
instance Argonaut.DecodeJson SearchType where
decodeJson = genericSumDecodeJson
instance Argonaut.EncodeJson SearchType where
encodeJson = genericSumEncodeJson
-}
instance JSON.ReadForeign DocumentsView where
readImpl f = do
{ id, category, date, ngramCount, score, source, title, url } :: { id :: Int | DocumentsViewT } <- JSON.readImpl f
......
......@@ -6,7 +6,6 @@ import Data.Show.Generic (genericShow)
import Simple.JSON as JSON
import Gargantext.Prelude (class Eq, class Show)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
newtype AddContactParams =
AddContactParams { firstname :: String, lastname :: String }
......
......@@ -18,7 +18,6 @@ import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
......@@ -21,7 +21,6 @@ import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
......@@ -8,8 +8,6 @@ import Simple.JSON.Generics as JSONG
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
data UpdateNodeParams = UpdateNodeParamsList { methodList :: Method }
| UpdateNodeParamsGraph { methodGraph :: GraphMetric }
......
......@@ -24,7 +24,6 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
......
......@@ -16,7 +16,6 @@ import Gargantext.Config.REST (get)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
'use strict';
exports.isNull = function(v) {
return v === null;
};
module Gargantext.Utils.DecodeMaybe where
import Prelude
import Data.Argonaut (class DecodeJson, Json, getFieldOptional)
import Data.Argonaut.Decode.Error (JsonDecodeError(..))
import Data.Either (Either)
import Data.Maybe (Maybe(..), fromMaybe)
import Foreign.Object (Object)
foreign import isNull :: forall a. a -> Boolean
getFieldOptional' :: forall a. DecodeJson a =>
Object Json -> String -> Either JsonDecodeError (Maybe a)
getFieldOptional' o s = (case _ of
Just v -> if isNull v then Nothing else v
Nothing -> Nothing
) <$> (getFieldOptional o s)
infix 7 getFieldOptional' as .?|
getFieldOptionalAsMempty :: forall a. DecodeJson a =>
Monoid a => Object Json -> String -> Either JsonDecodeError a
getFieldOptionalAsMempty o s =
fromMaybe mempty <$> (getFieldOptional' o s)
infix 7 getFieldOptionalAsMempty as .|
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