Skip to content

morpheus-graphql-0.3.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@nalchevanidze nalchevanidze released this 04 Oct 18:07
c3fc385

Added

  • user can import GraphQL Document and generate types with it.

      importGQLDocument "API.gql"

    this will generate types defined in API.gql

Fixed

  • String defined in GQLDcoument will be converted to Text by template haskell

  • importGQLDocument and gqlDocument supports Mutation, Subscription and Resolvers with custom Monad

    for example. if we have:

    type Deity {
      name: String!
      power: Power!
    }

    where Power is another object defined by gql schema.
    template haskell will represent this type as:

       data Deity m = Deity {
         name :: () -> m Text,
         power :: () -> m (Power m)
       }

    where m is resolver Monad.

  • importGQLDocumentWithNamespace generates namespaced haskell records. so that you have no more problem with name collision.
    from this gql type:

    type Deity {
      name: (id:Int)String!
      power: Power!
    }

    will be generated.

    data Deity m = Deity {
      deityName :: DeityNameArgs -> m Text,
      deityPower :: () -> m (Power m)
    }
    
    data DeityNameArgs = DeityNameArgs {
      deityNameArgsId :: Int
    }

Changed

  • GQLType is mandatory for every GQL Type (including Query, Mutation and Subscription)

  • subscription Resolver changed

    from:

      Subscription {newDeity = \args -> Event {channels = [ChannelA], content = newDeityResolver } }

    to:

      Subscription {newDeity = \args -> SubResolver {subChannels = [ChannelA], subResolver = newDeityResolver } }