graphql-0.9.0.0: Haskell GraphQL implementation

Safe HaskellNone
LanguageHaskell2010

Language.GraphQL.Validate

Description

GraphQL validator.

Synopsis

Documentation

data Error Source #

Validation error.

Constructors

Error 

Fields

Instances
Eq Error Source # 
Instance details

Defined in Language.GraphQL.Validate

Methods

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

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

Show Error Source # 
Instance details

Defined in Language.GraphQL.Validate

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

data Path Source #

If an error can be associated to a particular field in the GraphQL result, it must contain an entry with the key path that details the path of the response field which experienced the error. This allows clients to identify whether a null result is intentional or caused by a runtime error.

Constructors

Segment Text

Field name.

Index Int

List index if a field returned a list.

Instances
Eq Path Source # 
Instance details

Defined in Language.GraphQL.Validate

Methods

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

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

Show Path Source # 
Instance details

Defined in Language.GraphQL.Validate

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

document :: forall m. Schema m -> [Rule] -> Document -> Seq Error Source #

Validates a document and returns a list of found errors. If the returned list is empty, the document is valid.

newtype Rule Source #

Rule assigns a function to each AST node that can be validated. If the validation fails, the function should return an error message, or Nothing otherwise.

executableDefinitionsRule :: Rule Source #

Definition must be OperationDefinition or FragmentDefinition.

specifiedRules :: [Rule] Source #

Default reules given in the specification.