-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: disable introspection (#849)
* config * disableINtrospetion * validation * config * fix * format-lint * update cabal * no-warnings * fix-test * update * disableIntrospection * update App * disableIntrospection * introspection fields * update * query * update * disable-introspection * update * update * update query * queries * fix tests * __type * format fix
- Loading branch information
1 parent
2b7509e
commit f830053
Showing
32 changed files
with
186 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
examples/scotty-fraxl/morpheus-graphql-examples-scotty-fraxl.cabal
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
examples/subscription-extpubsub/examples-subscription-extpubsub.cabal
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module DisableIntrospection | ||
( runNamedDisableIntrospectionTest, | ||
runDisableIntrospectionTest, | ||
) | ||
where | ||
|
||
import qualified Data.ByteString.Lazy.Char8 as LBS | ||
import Data.Morpheus.App (disableIntrospection, mkApp, runApp) | ||
import Data.Morpheus.App.Internal.Resolving (resultOr) | ||
import Data.Morpheus.App.NamedResolvers (object, queryResolvers) | ||
import Data.Morpheus.Core (parseSchema) | ||
import Data.Morpheus.Internal.Ext (toEither) | ||
import Data.Morpheus.Types.IO (GQLRequest (..), GQLResponse) | ||
import Relude hiding (ByteString) | ||
import Test.Morpheus | ||
( FileUrl, | ||
file, | ||
getAppsBy, | ||
testApi, | ||
) | ||
import Test.Tasty (TestTree) | ||
|
||
runNamedDisableIntrospectionTest :: FileUrl -> FileUrl -> TestTree | ||
runNamedDisableIntrospectionTest url = testApi api | ||
where | ||
api :: GQLRequest -> IO GQLResponse | ||
api req = do | ||
schema <- LBS.readFile (toString (file url "schema.gql")) >>= resultOr (fail . show) pure . parseSchema | ||
let resolvers = queryResolvers [("Query", traverse (const $ object [("name", pure "Morpheus")]))] | ||
let app = disableIntrospection (mkApp schema resolvers) | ||
runApp app req | ||
|
||
runDisableIntrospectionTest :: FileUrl -> FileUrl -> TestTree | ||
runDisableIntrospectionTest url = testApi api | ||
where | ||
api :: GQLRequest -> IO GQLResponse | ||
api req = do | ||
app <- getAppsBy (toEither . parseSchema, mkApp) url | ||
runApp (disableIntrospection app) req |
Oops, something went wrong.