MIT licensed by Daviti Nalchevanidze

Module documentation for 0.14.1

This version can be pinned in stack with:morpheus-graphql-core-0.14.1@sha256:851571665e7d8452394c2b8d4a5745f439a054b63c0bacb6210406f1787dd13a,12318

Morpheus GraphQL Core

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

  • parser
  • validar
  • api

Build GraphQL api with Core

schema :: Schema VALID
schema =
  [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 = runApi schema resolver

Changes

Changelog

0.14.1 - 16.08.2020

0.14.0 - 15.08.2020

new features

  • query validation supports interfaces

  • exposed: Data.Morpheus.Types.SelectionTree

  • configurable api: Data.Morpheus.Core exports

    • Config
    • defaultConfig
    • debugConfig
  • for better debuging, internal errors messages will display resolving state:

    • current TypeName
    • current Selection
    • OperationDefinition
    • SchemaDefinition
  • rendering graphql “AST”. e.g render ( slection :: Selection VALID) will render

{
  user(arg1: 1) {
    name
  }
}
  • quasiqouter [dsl| <type definitions> |] generates Schema VALID.
  • parser supports custom directive definition. e.g
directive @MyDirective on FIELD_DEFINITION | OBJECT
  • directive Validation for Document (TypeSystem).

  • supports of block string values. e.g:

    query {
      createDeity(
        name: """
        powerqwe
        bla \n sd
        blu \\ dete
        """
      ) {
        name
      }
    }
    
  • support of schema. issue #412

    schema {
      query: MyQuery
    }
    

Breaking Changes

  • Context' renamed toResolverContext’
  • removed : EventCon from Data.Morpheus.Core
  • internal refactoring: changed AST. Schema AST Types now need parameter stage = RAW | CONST | VALID.
    • Schema VALID
    • TypeDefinition VALID
    • FieldDefinition IN VALID
  • runApi requires argument config
      runApi ::
        Schema s ->
        RootResModel event m ->
        Config ->
        GQLRequest ->
        ResponseStream event m (Value VALID)
    

0.13.0 - 22.06.2020

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