mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 18:42:30 +03:00
cc8e2ccc78
server: add scheduled triggers Co-authored-by: Alexis King <lexi.lambda@gmail.com> Co-authored-by: Marion Schleifer <marion@hasura.io> Co-authored-by: Karthikeyan Chinnakonda <karthikeyan@hasura.io> Co-authored-by: Aleksandra Sikora <ola.zxcvbnm@gmail.com>
30 lines
753 B
Haskell
30 lines
753 B
Haskell
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
|
|
module Network.URI.Extended
|
|
(module Network.URI
|
|
)
|
|
where
|
|
|
|
import Data.Aeson
|
|
import Data.Aeson.Types
|
|
import Data.Hashable
|
|
import Hasura.Prelude
|
|
import Network.URI
|
|
|
|
import qualified Data.Text as T
|
|
|
|
instance {-# INCOHERENT #-} FromJSON URI where
|
|
parseJSON (String uri) = do
|
|
let mUrl = parseURI $ T.unpack uri
|
|
maybe (fail "not a valid URI") return mUrl
|
|
parseJSON _ = fail "not a valid URI"
|
|
|
|
instance {-# INCOHERENT #-} ToJSON URI where
|
|
toJSON = String . T.pack . show
|
|
|
|
instance {-# INCOHERENT #-} ToJSONKey URI where
|
|
toJSONKey = toJSONKeyText (T.pack . show)
|
|
|
|
instance Hashable URI where
|
|
hashWithSalt i = hashWithSalt i . (T.pack . show)
|