aboutsummaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST/DirectiveLocation.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/GraphQL/AST/DirectiveLocation.hs')
-rw-r--r--src/Language/GraphQL/AST/DirectiveLocation.hs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Language/GraphQL/AST/DirectiveLocation.hs b/src/Language/GraphQL/AST/DirectiveLocation.hs
new file mode 100644
index 0000000..5b7a36f
--- /dev/null
+++ b/src/Language/GraphQL/AST/DirectiveLocation.hs
@@ -0,0 +1,41 @@
+-- | Various parts of a GraphQL document can be annotated with directives.
+-- This module describes locations in a document where directives can appear.
+module Language.GraphQL.AST.DirectiveLocation
+ ( DirectiveLocation(..)
+ , ExecutableDirectiveLocation(..)
+ , TypeSystemDirectiveLocation(..)
+ ) where
+
+-- | All directives can be splitted in two groups: directives used to annotate
+-- various parts of executable definitions and the ones used in the schema
+-- definition.
+data DirectiveLocation
+ = ExecutableDirectiveLocation ExecutableDirectiveLocation
+ | TypeSystemDirectiveLocation TypeSystemDirectiveLocation
+ deriving (Eq, Show)
+
+-- | Where directives can appear in an executable definition, like a query.
+data ExecutableDirectiveLocation
+ = Query
+ | Mutation
+ | Subscription
+ | Field
+ | FragmentDefinition
+ | FragmentSpread
+ | InlineFragment
+ deriving (Eq, Show)
+
+-- | Where directives can appear in a type system definition.
+data TypeSystemDirectiveLocation
+ = Schema
+ | Scalar
+ | Object
+ | FieldDefinition
+ | ArgumentDefinition
+ | Interface
+ | Union
+ | Enum
+ | EnumValue
+ | InputObject
+ | InputFieldDefinition
+ deriving (Eq, Show)