summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/AST/Document.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-02-11 12:02:08 +0100
committerEugen Wissner <belka@caraus.de>2021-02-11 12:02:08 +0100
commit1e8405a6d6de8d7a5a1323ba11e48fb4fb852b80 (patch)
tree274bce54196b05605022132768437eceda32e649 /src/Language/GraphQL/AST/Document.hs
parent2839b2859072189a9e97342fc106e49127112af2 (diff)
downloadgraphql-1e8405a6d6de8d7a5a1323ba11e48fb4fb852b80.tar.gz
Document AST.Document.escape
Diffstat (limited to 'src/Language/GraphQL/AST/Document.hs')
-rw-r--r--src/Language/GraphQL/AST/Document.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Language/GraphQL/AST/Document.hs b/src/Language/GraphQL/AST/Document.hs
index a78b007..41b417c 100644
--- a/src/Language/GraphQL/AST/Document.hs
+++ b/src/Language/GraphQL/AST/Document.hs
@@ -226,6 +226,12 @@ type TypeCondition = Name
-- ** Input Values
+-- | Escapes a single character according to the GraphQL escaping rules for
+-- double-quoted string values.
+--
+-- Characters, that should be escaped, are written as escaped characters with a
+-- backslash or Unicode with an \"\\u\". Other characters are returned as
+-- strings.
escape :: Char -> String
escape char'
| char' == '\\' = "\\\\"
@@ -318,13 +324,13 @@ instance Functor ObjectField where
-- Each operation can include a list of variables:
--
-- @
--- query (protagonist: String = "Zarathustra") {
+-- query (protagonist: String = \"Zarathustra\") {
-- getAuthor(protagonist: $protagonist)
-- }
-- @
--
-- This query defines an optional variable @protagonist@ of type @String@,
--- its default value is "Zarathustra". If no default value is defined and no
+-- its default value is \"Zarathustra\". If no default value is defined and no
-- value is provided, a variable can still be @null@ if its type is nullable.
--
-- Variables are usually passed along with the query, but not in the query