module Hasura.RemoteSchema.Metadata.Customization
( RemoteTypeCustomization (..),
RemoteFieldCustomization (..),
RemoteSchemaCustomization (..),
)
where
import Autodocodec (HasCodec, codec, hashMapCodec, object, optionalField', optionalFieldWith', requiredFieldWith', (.=))
import Autodocodec.Extended (graphQLFieldNameCodec)
import Data.Aeson qualified as J
import Hasura.Prelude
import Language.GraphQL.Draft.Syntax qualified as G
data RemoteTypeCustomization = RemoteTypeCustomization
{ RemoteTypeCustomization -> Maybe Name
_rtcPrefix :: Maybe G.Name,
RemoteTypeCustomization -> Maybe Name
_rtcSuffix :: Maybe G.Name,
RemoteTypeCustomization -> HashMap Name Name
_rtcMapping :: HashMap G.Name G.Name
}
deriving (Int -> RemoteTypeCustomization -> ShowS
[RemoteTypeCustomization] -> ShowS
RemoteTypeCustomization -> String
(Int -> RemoteTypeCustomization -> ShowS)
-> (RemoteTypeCustomization -> String)
-> ([RemoteTypeCustomization] -> ShowS)
-> Show RemoteTypeCustomization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoteTypeCustomization -> ShowS
showsPrec :: Int -> RemoteTypeCustomization -> ShowS
$cshow :: RemoteTypeCustomization -> String
show :: RemoteTypeCustomization -> String
$cshowList :: [RemoteTypeCustomization] -> ShowS
showList :: [RemoteTypeCustomization] -> ShowS
Show, RemoteTypeCustomization -> RemoteTypeCustomization -> Bool
(RemoteTypeCustomization -> RemoteTypeCustomization -> Bool)
-> (RemoteTypeCustomization -> RemoteTypeCustomization -> Bool)
-> Eq RemoteTypeCustomization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoteTypeCustomization -> RemoteTypeCustomization -> Bool
== :: RemoteTypeCustomization -> RemoteTypeCustomization -> Bool
$c/= :: RemoteTypeCustomization -> RemoteTypeCustomization -> Bool
/= :: RemoteTypeCustomization -> RemoteTypeCustomization -> Bool
Eq, (forall x.
RemoteTypeCustomization -> Rep RemoteTypeCustomization x)
-> (forall x.
Rep RemoteTypeCustomization x -> RemoteTypeCustomization)
-> Generic RemoteTypeCustomization
forall x. Rep RemoteTypeCustomization x -> RemoteTypeCustomization
forall x. RemoteTypeCustomization -> Rep RemoteTypeCustomization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RemoteTypeCustomization -> Rep RemoteTypeCustomization x
from :: forall x. RemoteTypeCustomization -> Rep RemoteTypeCustomization x
$cto :: forall x. Rep RemoteTypeCustomization x -> RemoteTypeCustomization
to :: forall x. Rep RemoteTypeCustomization x -> RemoteTypeCustomization
Generic)
instance NFData RemoteTypeCustomization
instance Hashable RemoteTypeCustomization
instance HasCodec RemoteTypeCustomization where
codec :: JSONCodec RemoteTypeCustomization
codec =
Text
-> ObjectCodec RemoteTypeCustomization RemoteTypeCustomization
-> JSONCodec RemoteTypeCustomization
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"RemoteTypeCustomization"
(ObjectCodec RemoteTypeCustomization RemoteTypeCustomization
-> JSONCodec RemoteTypeCustomization)
-> ObjectCodec RemoteTypeCustomization RemoteTypeCustomization
-> JSONCodec RemoteTypeCustomization
forall a b. (a -> b) -> a -> b
$ Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteTypeCustomization
RemoteTypeCustomization
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
-> Codec Object RemoteTypeCustomization (Maybe Name)
-> Codec
Object
RemoteTypeCustomization
(Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> ValueCodec Name Name -> ObjectCodec (Maybe Name) (Maybe Name)
forall input output.
Text
-> ValueCodec input output
-> ObjectCodec (Maybe input) (Maybe output)
optionalFieldWith' Text
"prefix" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec (Maybe Name) (Maybe Name)
-> (RemoteTypeCustomization -> Maybe Name)
-> Codec Object RemoteTypeCustomization (Maybe Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteTypeCustomization -> Maybe Name
_rtcPrefix
Codec
Object
RemoteTypeCustomization
(Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
-> Codec Object RemoteTypeCustomization (Maybe Name)
-> Codec
Object
RemoteTypeCustomization
(HashMap Name Name -> RemoteTypeCustomization)
forall a b.
Codec Object RemoteTypeCustomization (a -> b)
-> Codec Object RemoteTypeCustomization a
-> Codec Object RemoteTypeCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec Name Name -> ObjectCodec (Maybe Name) (Maybe Name)
forall input output.
Text
-> ValueCodec input output
-> ObjectCodec (Maybe input) (Maybe output)
optionalFieldWith' Text
"suffix" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec (Maybe Name) (Maybe Name)
-> (RemoteTypeCustomization -> Maybe Name)
-> Codec Object RemoteTypeCustomization (Maybe Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteTypeCustomization -> Maybe Name
_rtcSuffix
Codec
Object
RemoteTypeCustomization
(HashMap Name Name -> RemoteTypeCustomization)
-> Codec Object RemoteTypeCustomization (HashMap Name Name)
-> ObjectCodec RemoteTypeCustomization RemoteTypeCustomization
forall a b.
Codec Object RemoteTypeCustomization (a -> b)
-> Codec Object RemoteTypeCustomization a
-> Codec Object RemoteTypeCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec (HashMap Name Name) (HashMap Name Name)
-> ObjectCodec (HashMap Name Name) (HashMap Name Name)
forall input output.
Text -> ValueCodec input output -> ObjectCodec input output
requiredFieldWith' Text
"mapping" (ValueCodec Name Name
-> ValueCodec (HashMap Name Name) (HashMap Name Name)
forall k v.
(Eq k, Hashable k, FromJSONKey k, ToJSONKey k) =>
JSONCodec v -> JSONCodec (HashMap k v)
hashMapCodec ValueCodec Name Name
graphQLFieldNameCodec)
ObjectCodec (HashMap Name Name) (HashMap Name Name)
-> (RemoteTypeCustomization -> HashMap Name Name)
-> Codec Object RemoteTypeCustomization (HashMap Name Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteTypeCustomization -> HashMap Name Name
_rtcMapping
instance J.ToJSON RemoteTypeCustomization where
toJSON :: RemoteTypeCustomization -> Value
toJSON = Options -> RemoteTypeCustomization -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
toEncoding :: RemoteTypeCustomization -> Encoding
toEncoding = Options -> RemoteTypeCustomization -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
instance J.FromJSON RemoteTypeCustomization where
parseJSON :: Value -> Parser RemoteTypeCustomization
parseJSON = String
-> (Object -> Parser RemoteTypeCustomization)
-> Value
-> Parser RemoteTypeCustomization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
J.withObject String
"RemoteTypeCustomization" ((Object -> Parser RemoteTypeCustomization)
-> Value -> Parser RemoteTypeCustomization)
-> (Object -> Parser RemoteTypeCustomization)
-> Value
-> Parser RemoteTypeCustomization
forall a b. (a -> b) -> a -> b
$ \Object
o ->
Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteTypeCustomization
RemoteTypeCustomization
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
-> Parser (Maybe Name)
-> Parser
(Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o
Object -> Key -> Parser (Maybe Name)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"prefix"
Parser (Maybe Name -> HashMap Name Name -> RemoteTypeCustomization)
-> Parser (Maybe Name)
-> Parser (HashMap Name Name -> RemoteTypeCustomization)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o
Object -> Key -> Parser (Maybe Name)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"suffix"
Parser (HashMap Name Name -> RemoteTypeCustomization)
-> Parser (HashMap Name Name) -> Parser RemoteTypeCustomization
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o
Object -> Key -> Parser (Maybe (HashMap Name Name))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"mapping"
Parser (Maybe (HashMap Name Name))
-> HashMap Name Name -> Parser (HashMap Name Name)
forall a. Parser (Maybe a) -> a -> Parser a
J..!= HashMap Name Name
forall a. Monoid a => a
mempty
data RemoteFieldCustomization = RemoteFieldCustomization
{ RemoteFieldCustomization -> Name
_rfcParentType :: G.Name,
RemoteFieldCustomization -> Maybe Name
_rfcPrefix :: Maybe G.Name,
RemoteFieldCustomization -> Maybe Name
_rfcSuffix :: Maybe G.Name,
RemoteFieldCustomization -> HashMap Name Name
_rfcMapping :: HashMap G.Name G.Name
}
deriving (Int -> RemoteFieldCustomization -> ShowS
[RemoteFieldCustomization] -> ShowS
RemoteFieldCustomization -> String
(Int -> RemoteFieldCustomization -> ShowS)
-> (RemoteFieldCustomization -> String)
-> ([RemoteFieldCustomization] -> ShowS)
-> Show RemoteFieldCustomization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoteFieldCustomization -> ShowS
showsPrec :: Int -> RemoteFieldCustomization -> ShowS
$cshow :: RemoteFieldCustomization -> String
show :: RemoteFieldCustomization -> String
$cshowList :: [RemoteFieldCustomization] -> ShowS
showList :: [RemoteFieldCustomization] -> ShowS
Show, RemoteFieldCustomization -> RemoteFieldCustomization -> Bool
(RemoteFieldCustomization -> RemoteFieldCustomization -> Bool)
-> (RemoteFieldCustomization -> RemoteFieldCustomization -> Bool)
-> Eq RemoteFieldCustomization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoteFieldCustomization -> RemoteFieldCustomization -> Bool
== :: RemoteFieldCustomization -> RemoteFieldCustomization -> Bool
$c/= :: RemoteFieldCustomization -> RemoteFieldCustomization -> Bool
/= :: RemoteFieldCustomization -> RemoteFieldCustomization -> Bool
Eq, (forall x.
RemoteFieldCustomization -> Rep RemoteFieldCustomization x)
-> (forall x.
Rep RemoteFieldCustomization x -> RemoteFieldCustomization)
-> Generic RemoteFieldCustomization
forall x.
Rep RemoteFieldCustomization x -> RemoteFieldCustomization
forall x.
RemoteFieldCustomization -> Rep RemoteFieldCustomization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
RemoteFieldCustomization -> Rep RemoteFieldCustomization x
from :: forall x.
RemoteFieldCustomization -> Rep RemoteFieldCustomization x
$cto :: forall x.
Rep RemoteFieldCustomization x -> RemoteFieldCustomization
to :: forall x.
Rep RemoteFieldCustomization x -> RemoteFieldCustomization
Generic)
instance NFData RemoteFieldCustomization
instance Hashable RemoteFieldCustomization
instance HasCodec RemoteFieldCustomization where
codec :: JSONCodec RemoteFieldCustomization
codec =
Text
-> ObjectCodec RemoteFieldCustomization RemoteFieldCustomization
-> JSONCodec RemoteFieldCustomization
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"RemoteFieldCustomization"
(ObjectCodec RemoteFieldCustomization RemoteFieldCustomization
-> JSONCodec RemoteFieldCustomization)
-> ObjectCodec RemoteFieldCustomization RemoteFieldCustomization
-> JSONCodec RemoteFieldCustomization
forall a b. (a -> b) -> a -> b
$ Name
-> Maybe Name
-> Maybe Name
-> HashMap Name Name
-> RemoteFieldCustomization
RemoteFieldCustomization
(Name
-> Maybe Name
-> Maybe Name
-> HashMap Name Name
-> RemoteFieldCustomization)
-> Codec Object RemoteFieldCustomization Name
-> Codec
Object
RemoteFieldCustomization
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> ValueCodec Name Name -> ObjectCodec Name Name
forall input output.
Text -> ValueCodec input output -> ObjectCodec input output
requiredFieldWith' Text
"parent_type" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec Name Name
-> (RemoteFieldCustomization -> Name)
-> Codec Object RemoteFieldCustomization Name
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteFieldCustomization -> Name
_rfcParentType
Codec
Object
RemoteFieldCustomization
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
-> Codec Object RemoteFieldCustomization (Maybe Name)
-> Codec
Object
RemoteFieldCustomization
(Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
forall a b.
Codec Object RemoteFieldCustomization (a -> b)
-> Codec Object RemoteFieldCustomization a
-> Codec Object RemoteFieldCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec Name Name -> ObjectCodec (Maybe Name) (Maybe Name)
forall input output.
Text
-> ValueCodec input output
-> ObjectCodec (Maybe input) (Maybe output)
optionalFieldWith' Text
"prefix" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec (Maybe Name) (Maybe Name)
-> (RemoteFieldCustomization -> Maybe Name)
-> Codec Object RemoteFieldCustomization (Maybe Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteFieldCustomization -> Maybe Name
_rfcPrefix
Codec
Object
RemoteFieldCustomization
(Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
-> Codec Object RemoteFieldCustomization (Maybe Name)
-> Codec
Object
RemoteFieldCustomization
(HashMap Name Name -> RemoteFieldCustomization)
forall a b.
Codec Object RemoteFieldCustomization (a -> b)
-> Codec Object RemoteFieldCustomization a
-> Codec Object RemoteFieldCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec Name Name -> ObjectCodec (Maybe Name) (Maybe Name)
forall input output.
Text
-> ValueCodec input output
-> ObjectCodec (Maybe input) (Maybe output)
optionalFieldWith' Text
"suffix" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec (Maybe Name) (Maybe Name)
-> (RemoteFieldCustomization -> Maybe Name)
-> Codec Object RemoteFieldCustomization (Maybe Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteFieldCustomization -> Maybe Name
_rfcSuffix
Codec
Object
RemoteFieldCustomization
(HashMap Name Name -> RemoteFieldCustomization)
-> Codec Object RemoteFieldCustomization (HashMap Name Name)
-> ObjectCodec RemoteFieldCustomization RemoteFieldCustomization
forall a b.
Codec Object RemoteFieldCustomization (a -> b)
-> Codec Object RemoteFieldCustomization a
-> Codec Object RemoteFieldCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec (HashMap Name Name) (HashMap Name Name)
-> ObjectCodec (HashMap Name Name) (HashMap Name Name)
forall input output.
Text -> ValueCodec input output -> ObjectCodec input output
requiredFieldWith' Text
"mapping" (ValueCodec Name Name
-> ValueCodec (HashMap Name Name) (HashMap Name Name)
forall k v.
(Eq k, Hashable k, FromJSONKey k, ToJSONKey k) =>
JSONCodec v -> JSONCodec (HashMap k v)
hashMapCodec ValueCodec Name Name
graphQLFieldNameCodec)
ObjectCodec (HashMap Name Name) (HashMap Name Name)
-> (RemoteFieldCustomization -> HashMap Name Name)
-> Codec Object RemoteFieldCustomization (HashMap Name Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteFieldCustomization -> HashMap Name Name
_rfcMapping
instance J.ToJSON RemoteFieldCustomization where
toJSON :: RemoteFieldCustomization -> Value
toJSON = Options -> RemoteFieldCustomization -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
toEncoding :: RemoteFieldCustomization -> Encoding
toEncoding = Options -> RemoteFieldCustomization -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
instance J.FromJSON RemoteFieldCustomization where
parseJSON :: Value -> Parser RemoteFieldCustomization
parseJSON = String
-> (Object -> Parser RemoteFieldCustomization)
-> Value
-> Parser RemoteFieldCustomization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
J.withObject String
"RemoteFieldCustomization" ((Object -> Parser RemoteFieldCustomization)
-> Value -> Parser RemoteFieldCustomization)
-> (Object -> Parser RemoteFieldCustomization)
-> Value
-> Parser RemoteFieldCustomization
forall a b. (a -> b) -> a -> b
$ \Object
o ->
Name
-> Maybe Name
-> Maybe Name
-> HashMap Name Name
-> RemoteFieldCustomization
RemoteFieldCustomization
(Name
-> Maybe Name
-> Maybe Name
-> HashMap Name Name
-> RemoteFieldCustomization)
-> Parser Name
-> Parser
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o
Object -> Key -> Parser Name
forall a. FromJSON a => Object -> Key -> Parser a
J..: Key
"parent_type"
Parser
(Maybe Name
-> Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
-> Parser (Maybe Name)
-> Parser
(Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o
Object -> Key -> Parser (Maybe Name)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"prefix"
Parser
(Maybe Name -> HashMap Name Name -> RemoteFieldCustomization)
-> Parser (Maybe Name)
-> Parser (HashMap Name Name -> RemoteFieldCustomization)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o
Object -> Key -> Parser (Maybe Name)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"suffix"
Parser (HashMap Name Name -> RemoteFieldCustomization)
-> Parser (HashMap Name Name) -> Parser RemoteFieldCustomization
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o
Object -> Key -> Parser (Maybe (HashMap Name Name))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"mapping"
Parser (Maybe (HashMap Name Name))
-> HashMap Name Name -> Parser (HashMap Name Name)
forall a. Parser (Maybe a) -> a -> Parser a
J..!= HashMap Name Name
forall a. Monoid a => a
mempty
data RemoteSchemaCustomization = RemoteSchemaCustomization
{ RemoteSchemaCustomization -> Maybe Name
_rscRootFieldsNamespace :: Maybe G.Name,
RemoteSchemaCustomization -> Maybe RemoteTypeCustomization
_rscTypeNames :: Maybe RemoteTypeCustomization,
RemoteSchemaCustomization -> Maybe [RemoteFieldCustomization]
_rscFieldNames :: Maybe [RemoteFieldCustomization]
}
deriving (Int -> RemoteSchemaCustomization -> ShowS
[RemoteSchemaCustomization] -> ShowS
RemoteSchemaCustomization -> String
(Int -> RemoteSchemaCustomization -> ShowS)
-> (RemoteSchemaCustomization -> String)
-> ([RemoteSchemaCustomization] -> ShowS)
-> Show RemoteSchemaCustomization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoteSchemaCustomization -> ShowS
showsPrec :: Int -> RemoteSchemaCustomization -> ShowS
$cshow :: RemoteSchemaCustomization -> String
show :: RemoteSchemaCustomization -> String
$cshowList :: [RemoteSchemaCustomization] -> ShowS
showList :: [RemoteSchemaCustomization] -> ShowS
Show, RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool
(RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool)
-> (RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool)
-> Eq RemoteSchemaCustomization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool
== :: RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool
$c/= :: RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool
/= :: RemoteSchemaCustomization -> RemoteSchemaCustomization -> Bool
Eq, (forall x.
RemoteSchemaCustomization -> Rep RemoteSchemaCustomization x)
-> (forall x.
Rep RemoteSchemaCustomization x -> RemoteSchemaCustomization)
-> Generic RemoteSchemaCustomization
forall x.
Rep RemoteSchemaCustomization x -> RemoteSchemaCustomization
forall x.
RemoteSchemaCustomization -> Rep RemoteSchemaCustomization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
RemoteSchemaCustomization -> Rep RemoteSchemaCustomization x
from :: forall x.
RemoteSchemaCustomization -> Rep RemoteSchemaCustomization x
$cto :: forall x.
Rep RemoteSchemaCustomization x -> RemoteSchemaCustomization
to :: forall x.
Rep RemoteSchemaCustomization x -> RemoteSchemaCustomization
Generic)
instance NFData RemoteSchemaCustomization
instance Hashable RemoteSchemaCustomization
instance HasCodec RemoteSchemaCustomization where
codec :: JSONCodec RemoteSchemaCustomization
codec =
Text
-> ObjectCodec RemoteSchemaCustomization RemoteSchemaCustomization
-> JSONCodec RemoteSchemaCustomization
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"RemoteSchemaCustomization"
(ObjectCodec RemoteSchemaCustomization RemoteSchemaCustomization
-> JSONCodec RemoteSchemaCustomization)
-> ObjectCodec RemoteSchemaCustomization RemoteSchemaCustomization
-> JSONCodec RemoteSchemaCustomization
forall a b. (a -> b) -> a -> b
$ Maybe Name
-> Maybe RemoteTypeCustomization
-> Maybe [RemoteFieldCustomization]
-> RemoteSchemaCustomization
RemoteSchemaCustomization
(Maybe Name
-> Maybe RemoteTypeCustomization
-> Maybe [RemoteFieldCustomization]
-> RemoteSchemaCustomization)
-> Codec Object RemoteSchemaCustomization (Maybe Name)
-> Codec
Object
RemoteSchemaCustomization
(Maybe RemoteTypeCustomization
-> Maybe [RemoteFieldCustomization] -> RemoteSchemaCustomization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> ValueCodec Name Name -> ObjectCodec (Maybe Name) (Maybe Name)
forall input output.
Text
-> ValueCodec input output
-> ObjectCodec (Maybe input) (Maybe output)
optionalFieldWith' Text
"root_fields_namespace" ValueCodec Name Name
graphQLFieldNameCodec
ObjectCodec (Maybe Name) (Maybe Name)
-> (RemoteSchemaCustomization -> Maybe Name)
-> Codec Object RemoteSchemaCustomization (Maybe Name)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteSchemaCustomization -> Maybe Name
_rscRootFieldsNamespace
Codec
Object
RemoteSchemaCustomization
(Maybe RemoteTypeCustomization
-> Maybe [RemoteFieldCustomization] -> RemoteSchemaCustomization)
-> Codec
Object RemoteSchemaCustomization (Maybe RemoteTypeCustomization)
-> Codec
Object
RemoteSchemaCustomization
(Maybe [RemoteFieldCustomization] -> RemoteSchemaCustomization)
forall a b.
Codec Object RemoteSchemaCustomization (a -> b)
-> Codec Object RemoteSchemaCustomization a
-> Codec Object RemoteSchemaCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ObjectCodec
(Maybe RemoteTypeCustomization) (Maybe RemoteTypeCustomization)
forall output.
HasCodec output =>
Text -> ObjectCodec (Maybe output) (Maybe output)
optionalField' Text
"type_names"
ObjectCodec
(Maybe RemoteTypeCustomization) (Maybe RemoteTypeCustomization)
-> (RemoteSchemaCustomization -> Maybe RemoteTypeCustomization)
-> Codec
Object RemoteSchemaCustomization (Maybe RemoteTypeCustomization)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteSchemaCustomization -> Maybe RemoteTypeCustomization
_rscTypeNames
Codec
Object
RemoteSchemaCustomization
(Maybe [RemoteFieldCustomization] -> RemoteSchemaCustomization)
-> Codec
Object RemoteSchemaCustomization (Maybe [RemoteFieldCustomization])
-> ObjectCodec RemoteSchemaCustomization RemoteSchemaCustomization
forall a b.
Codec Object RemoteSchemaCustomization (a -> b)
-> Codec Object RemoteSchemaCustomization a
-> Codec Object RemoteSchemaCustomization b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ObjectCodec
(Maybe [RemoteFieldCustomization])
(Maybe [RemoteFieldCustomization])
forall output.
HasCodec output =>
Text -> ObjectCodec (Maybe output) (Maybe output)
optionalField' Text
"field_names"
ObjectCodec
(Maybe [RemoteFieldCustomization])
(Maybe [RemoteFieldCustomization])
-> (RemoteSchemaCustomization -> Maybe [RemoteFieldCustomization])
-> Codec
Object RemoteSchemaCustomization (Maybe [RemoteFieldCustomization])
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= RemoteSchemaCustomization -> Maybe [RemoteFieldCustomization]
_rscFieldNames
instance J.FromJSON RemoteSchemaCustomization where
parseJSON :: Value -> Parser RemoteSchemaCustomization
parseJSON = Options -> Value -> Parser RemoteSchemaCustomization
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
J.genericParseJSON Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
instance J.ToJSON RemoteSchemaCustomization where
toJSON :: RemoteSchemaCustomization -> Value
toJSON = Options -> RemoteSchemaCustomization -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
toEncoding :: RemoteSchemaCustomization -> Encoding
toEncoding = Options -> RemoteSchemaCustomization -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}