morpheus-graphql v0.8.0 Release Notes

Release Date: 2019-12-15 // over 4 years ago
  • ๐Ÿ”„ Changed

    ๐Ÿ—„ deprecated: INPUT_OBJECT, OBJECT, UNION,

    • use INPUT instead of INPUT_OBJECT

    - use deriving(GQLType) insead of OBJECT or UNION

    only namespaced Unions generate regular graphql Union, other attempts will be wrapped inside an object with constructor name :

    e.g:

    data Character =CharacterDeity DeitySomeDeity Deityderiving (GQLType)
    

    where Deity is Object.
    will generate

    union CHaracter = Deity | SomeDeitytype SomeDeity { \_0: Deity }
    

    โž• Added

    • failRes for resolver failures
    • โž• added kind: INPUT , OUTPUT
    • Automatic Type Inference (only for Object, Union and Enum)
    • More general stateful resolvers which accept instances of MonadIO (Authored by Sebastian Pulido [sebashack])
    • ๐ŸŒ Utility to create web-socket applications with custom MonadIO instances (Authored by Sebastian Pulido [sebashack])

      data Realm=Sky | Sea | Underworldderiving (Generic, GQLType)data Deity= Deity{fullName:: Text, realm:: Realm} deriving (Generic, GQLType)data Character=CharacterDeity Deity -- Only <tyconName><conName> should generate direct link-- RECORDS | Creature { creatureName :: Text, creatureAge :: Int }--- Types | SomeDeity Deity | CharacterInt Int | SomeMutli Int Text--- ENUMS | Zeus | Cronus deriving (Generic, GQLType)

    will generate schema:

    enum Realm { Sky Sea Underworld}type Deity { fullName: String!realm: Realm!}union Character = Deity | Creature | SomeDeity | CharacterInt | SomeMutli | CharacterEnumObjecttype Creature { creatureName: String!creatureAge: Int!}type SomeDeity { \_0: Deity!}type CharacterInt { \_0: Int!}type SomeMutli { \_0: Int!\_1: String!}# enumtype CharacterEnumObject { enum: CharacterEnum!}enum CharacterEnum { Zeus Cronus}
    

    rules:

    haskell union type with only empty constructors (e.g Realm), will generate graphql enum

    haskell record without union (e.g Deity), will generate graphql object

    namespaced Unions: CharacterDeity where Character is TypeConstructor and Deity referenced object (not scalar) type: will be generate regular graphql Union

    union Character = Deity | ...
    

    for union recrods (Creature { creatureName :: Text, creatureAge :: Int }) will be referenced in union type, plus type Creaturewill be added in schema.

    e.g

    union Character = ... | Creature | ... type Creature { creatureName : String! creatureAge: Int! }
    

    all empty constructors in union will be summed in type <tyConName>Enum (e.g CharacterEnum), this enum will be wrapped in CharacterEnumObject and this type will be added to union Character. as in example above

    there is only types left with form TypeName Type1 2Type ..(e.g SomeDeity Deity ,CharacterInt Int, SomeMutli Int Text),

    morpheus will generate objet type from it:

    type TypeName { \_0: Type1!\_1: Type2! ... }
    

    โœ‚ Removed

    • โœ‚ removed kind: INPUT_UNION

    ๐Ÿ›  Fixed

    • ๐Ÿ‘ป on filed resolver was displayed. unexhausted case exception of graphql error
    • ๐Ÿ‘Œ support of signed numbers (e.g -4)
    • ๐Ÿ‘Œ support of round floats (e.g 1.000)
    • validation checks undefined fields on inputObject
    • ๐Ÿ‘ variables are supported inside input values