MIT licensed by Daviti Nalchevanidze
Maintained by [email protected]
This version can be pinned in stack with:morpheus-graphql-core-0.13.0@sha256:af4c0cc0f5c84cbcb85486329574f2ced98326be4fedd8a7fa116bf783d5a8b6,6774

Morpheus GraphQL Core

core Functionalities of Morpheus GraphQL, can be used to build GraphQL server, client ..

  • parser
  • validar
  • api

Build GraphQL api with Core

getSchema :: Monad m => ResponseStream e m Schema
getSchema =
  fromList
    [dsl|
  type Query {
    deity(name: String): Deity!
  }

  type Deity {
    name: String!
    power: [String!]!
  }
|]

resolver :: Monad m => RootResModel e m
resolver =
  RootResModel
    { query =
        pure $
          mkObject
            "Query"
            [("deity", resolveDeity)],
      mutation = pure mkNull,
      subscription = pure mkNull
    }

resolveDeity :: (WithOperation o, Monad m) => Resolver o e m (ResModel o e m)
resolveDeity =
  pure $
    mkObject
      "Deity"
      [ ("name", pure $ mkString "Morpheus"),
        ("power", pure $ mkList [mkString "Shapeshifting"])
      ]

api :: GQLRequest -> ResponseStream e Identity (Value VALID)
api request = do
  schema <- getSchema
  runApi schema resolver request

Changes

Changelog

0.13.0 - Unreleased Changes

new features

  • exposed: Data.Morpheus.Types.GQLScalar
  • exposed: Data.Morpheus.Types.ID
  • finished interface validation
  • supports default values

minor changes

  • internal refactoring
  • added dependency mtl
  • validates strings as enum from JSON value

0.12.0 - 21.05.2020

New features

  • parser supports implemnets interfaces seperated with empty spaces

    type T implements A , B C & D {
    
  • introspection can render interfaces