branch: externals/graphql commit 24d278dd43c25dd89104cb065e1b6724e2f05109 Author: Sean Allred <c...@seanallred.com> Commit: Sean Allred <c...@seanallred.com>
Add support for variables in object parameters --- graphql.el | 2 ++ test/graphql.el-test.el | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/graphql.el b/graphql.el index fac829d549..2319d70a7d 100644 --- a/graphql.el +++ b/graphql.el @@ -51,6 +51,8 @@ (cond ((symbolp value) (symbol-name value)) + ((eq '$ (car-safe value)) + (format "$%s" (cadr value))) ((listp value) (format "{%s}" (mapconcat #'graphql--encode-parameter-pair value ","))) ((stringp value) diff --git a/test/graphql.el-test.el b/test/graphql.el-test.el index 31158630a1..ff95124e62 100644 --- a/test/graphql.el-test.el +++ b/test/graphql.el-test.el @@ -11,7 +11,14 @@ :arguments ((one . "1") (two . "2")) hello-world)) - "query(one:\"1\",two:\"2\") { hello-world }"))) + "query(one:\"1\",two:\"2\") { hello-world }")) + + (should (string= (graphql-encode + '(query + :arguments ((one . ($ variableForOne)) + (two . "2")) + hello-world)) + "query(one:$variableForOne,two:\"2\") { hello-world }"))) (ert-deftest encode-recursive () (should (string= (graphql-encode