server: fix fromJSON for RemoteSchemaPermsCtx

GitOrigin-RevId: a0a6d50a39ffbc7fab0a303b50c3e2c485954773
This commit is contained in:
Sameer Kolhar 2021-03-05 18:56:00 +05:30 committed by hasura-bot
parent f998fc089e
commit 78785ae513

View File

@ -200,11 +200,8 @@ data RemoteSchemaPermsCtx
deriving (Show, Eq)
instance J.FromJSON RemoteSchemaPermsCtx where
parseJSON = J.withText "RemoteSchemaPermsCtx" $ \t ->
case T.toLower t of
"true" -> pure RemoteSchemaPermsEnabled
"false" -> pure RemoteSchemaPermsDisabled
_ -> fail "enable_remote_schema_permissions should be a boolean value"
parseJSON = J.withBool "RemoteSchemaPermsCtx" $
pure . bool RemoteSchemaPermsDisabled RemoteSchemaPermsEnabled
instance J.ToJSON RemoteSchemaPermsCtx where
toJSON = \case