summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/Validate
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-07-24 21:34:31 +0200
committerEugen Wissner <belka@caraus.de>2020-07-24 21:58:49 +0200
commitc60dd98fc5b5b8d3fb3d8f071db078ddb547c5cf (patch)
tree0404597129675f53f13ad5afc5eccbb1072c24c5 /src/Language/GraphQL/Validate
parent44d506d4b57e450480cf9c476bd927a43ad9c25d (diff)
downloadgraphql-c60dd98fc5b5b8d3fb3d8f071db078ddb547c5cf.tar.gz
Release 0.9.0.0
Diffstat (limited to 'src/Language/GraphQL/Validate')
-rw-r--r--src/Language/GraphQL/Validate/Rules.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Language/GraphQL/Validate/Rules.hs b/src/Language/GraphQL/Validate/Rules.hs
index bc754c2..a3314e7 100644
--- a/src/Language/GraphQL/Validate/Rules.hs
+++ b/src/Language/GraphQL/Validate/Rules.hs
@@ -2,6 +2,7 @@
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at https://mozilla.org/MPL/2.0/. -}
+-- | This module contains default rules defined in the GraphQL specification.
module Language.GraphQL.Validate.Rules
( Rule(..)
, executableDefinitionsRule
@@ -10,14 +11,19 @@ module Language.GraphQL.Validate.Rules
import Language.GraphQL.AST.Document
+-- | '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.
newtype Rule
= DefinitionRule (Definition -> Maybe String)
+-- | Default reules given in the specification.
specifiedRules :: [Rule]
specifiedRules =
[ executableDefinitionsRule
]
+-- | Definition must be OperationDefinition or FragmentDefinition.
executableDefinitionsRule :: Rule
executableDefinitionsRule = DefinitionRule go
where