morpheus-graphql-client 0.14.0 → 0.14.1
raw patch · 6 files changed
+126/−12 lines, 6 filesdep +directorydep ~morpheus-graphql-corePVP ok
version bump matches the API change (PVP)
Dependencies added: directory
Dependency ranges changed: morpheus-graphql-core
API changes (from Hackage documentation)
Files
- changelog.md +6/−0
- morpheus-graphql-client.cabal +8/−4
- test/Case/Interface/Test.hs +4/−6
- test/Case/Interface/response.json +52/−0
- test/Case/Interface/schema.gql +21/−0
- test/Lib.hs +35/−2
changelog.md view
@@ -1,5 +1,11 @@ # Changelog +## 0.14.1 - 16.08.2020++### minor++- fixed Build error during testing [#5602](https://github.com/commercialhaskell/stackage/issues/5602)+ ## 0.14.0 - 15.08.2020 ### new features
morpheus-graphql-client.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 08102585d72817b64c052bd556824b4025caafa18870e2c76659ab49fc252d6b+-- hash: dd43bccf11b8a9f16ca9ffdb55d03ce247b69e2afde875f73dfd3d7e65b4f3f5 name: morpheus-graphql-client-version: 0.14.0+version: 0.14.1 synopsis: Morpheus GraphQL Client description: Build GraphQL APIs with your favourite functional language! category: web, graphql, client@@ -22,6 +22,9 @@ extra-source-files: changelog.md README.md+data-files:+ test/Case/Interface/schema.gql+ test/Case/Interface/response.json source-repository head type: git@@ -51,7 +54,7 @@ aeson >=1.4.4.0 && <=1.6 , base >=4.7 && <5 , bytestring >=0.10.4 && <0.11- , morpheus-graphql-core >=0.14.0+ , morpheus-graphql-core >=0.14.0 && <0.15.0 , mtl >=2.0 && <=3.0 , template-haskell >=2.0 && <=3.0 , text >=1.2.3.0 && <1.3@@ -73,8 +76,9 @@ aeson , base >=4.7 && <5 , bytestring >=0.10.4 && <0.11+ , directory >=1.0 , morpheus-graphql-client- , morpheus-graphql-core >=0.14.0+ , morpheus-graphql-core >=0.14.0 && <0.15.0 , mtl >=2.0 && <=3.0 , tasty , tasty-hunit
test/Case/Interface/Test.hs view
@@ -15,17 +15,15 @@ import Data.ByteString.Lazy.Char8 ( ByteString,- readFile, ) import Data.Morpheus.Client ( Fetch (..),- defineByDocumentFile, gql, ) import Data.Text (Text) import Lib- ( mockApi,- schemaUrl,+ ( defineClientWith,+ mockApi, ) import Test.Tasty ( TestTree,@@ -41,8 +39,8 @@ String, ) -defineByDocumentFile- (schemaUrl "Interface")+defineClientWith+ "Interface" [gql| query MyQuery { character {
+ test/Case/Interface/response.json view
@@ -0,0 +1,52 @@+{+ "data": {+ "character": [+ {+ "__typename": "Deity",+ "name": "Deity Name",+ "power": "Deity Power"+ },+ {+ "__typename": "Character",+ "name": "Charatcer Name"+ },+ {+ "__typename": "Hero",+ "name": "Hero Name",+ "hoby": "Deity Power"+ }+ ],+ "character2": [+ {+ "name1": "test name",+ "name": "test name"+ }+ ],+ "character3": [+ {+ "__typename": "Hero",+ "hoby": "Hero Hoby",+ "name2": "Hero name2"+ },+ {+ "__typename": "Deity",+ "name2": "Hero name2"+ },+ {+ "__typename": "Character",+ "name2": "Character name2"+ }+ ],+ "character4": [+ {+ "__typename": "Character",+ "name2": "Character name2"+ },+ {+ "__typename": "Hero",+ "hoby": "Hero Hoby",+ "name2": "Hero name2"+ }+ ]+ }+}
+ test/Case/Interface/schema.gql view
@@ -0,0 +1,21 @@+interface Character {+ name: String!+}++interface Supernatural {+ power: [String!]!+}++type Hero implements Character {+ name: String!+ hoby: String!+}++type Deity implements Character & Supernatural {+ name: String!+ power: String!+}++type Query {+ character: [Character!]!+}
test/Lib.hs view
@@ -5,17 +5,33 @@ module Lib ( mockApi, schemaUrl,+ defineClientWith, ) where import qualified Data.ByteString.Lazy as L (readFile) import Data.ByteString.Lazy.Char8 (ByteString)-import Data.Morpheus.Types.Internal.AST (FieldName (..))+import Data.Functor ((<$>))+import Data.Morpheus.Client+ ( defineByDocumentFile,+ )+import Data.Morpheus.Types.Internal.AST+ ( FieldName (..),+ GQLQuery,+ ) import Data.Semigroup ((<>)) import Data.Text (unpack)+import Language.Haskell.TH+ ( Dec,+ Q,+ runIO,+ )+import System.Directory (doesFileExist) import Prelude- ( FilePath,+ ( Bool (..),+ FilePath, IO,+ String, ) path :: FieldName -> FilePath@@ -24,5 +40,22 @@ schemaUrl :: FieldName -> FilePath schemaUrl p = path p <> "/schema.gql" +withProject :: FilePath -> FilePath+withProject = ("morpheus-graphql-client/" <>)+ mockApi :: FieldName -> ByteString -> IO ByteString mockApi p _ = L.readFile (path p <> "/response.json")++fixFilePath :: FilePath -> Q FilePath+fixFilePath x = prefix <$> runIO (doesFileExist x)+ where+ prefix True = x+ prefix False = withProject x++defineClientWith ::+ FieldName ->+ (GQLQuery, String) ->+ Q [Dec]+defineClientWith url exp = do+ p <- fixFilePath (schemaUrl url)+ defineByDocumentFile p exp