graphql-api-0.4.0: GraphQL API

Safe HaskellNone
LanguageHaskell2010

GraphQL.Internal.Output

Description

 
Synopsis

Documentation

data Response Source #

GraphQL response.

A GraphQL response must:

  • be a map
  • have a "data" key iff the operation executed
  • have an "errors" key iff the operation encountered errors
  • not include "data" if operation failed before execution (e.g. syntax errors, validation errors, missing info)
  • not have keys other than "data", "errors", and "extensions"

Other interesting things:

  • Doesn't have to be JSON, but does have to have maps, strings, lists, and null
  • Can also support bool, int, enum, and float
  • Value of "extensions" must be a map

"data" must be null if an error was encountered during execution that prevented a valid response.

"errors"

  • must be a non-empty list
  • each error is a map with "message", optionally "locations" key with list of locations
  • locations are maps with 1-indexed "line" and "column" keys.

data Error Source #

Constructors

Error Text [Location] 
Instances
Eq Error Source # 
Instance details

Defined in GraphQL.Internal.Output

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Ord Error Source # 
Instance details

Defined in GraphQL.Internal.Output

Methods

compare :: Error -> Error -> Ordering #

(<) :: Error -> Error -> Bool #

(<=) :: Error -> Error -> Bool #

(>) :: Error -> Error -> Bool #

(>=) :: Error -> Error -> Bool #

max :: Error -> Error -> Error #

min :: Error -> Error -> Error #

Show Error Source # 
Instance details

Defined in GraphQL.Internal.Output

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

ToValue Error Source # 
Instance details

Defined in GraphQL.Internal.Output

class GraphQLError e where Source #

An error that arises while processing a GraphQL query.

Minimal complete definition

formatError

Methods

formatError :: e -> Text Source #

Represent an error as human-readable text, primarily intended for developers of GraphQL clients, and secondarily for developers of GraphQL servers.

toError :: e -> Error Source #

Represent an error as human-readable text, together with reference to a series of locations within a GraphQL query document. Default implementation calls formatError and provides no locations.

singleError :: GraphQLError e => e -> Errors Source #

Make a list of errors containing a single error.