branch: externals/graphql commit b3db1ff740f16d51d75b1b8e4cde580e95e109d3 Author: Sean Allred <c...@seanallred.com> Commit: Sean Allred <c...@seanallred.com>
Response form should mirror input form when using macros This does introduce an extra level of parentheses when writing the queries, but modern Lisp editors should make this trivial compared to the gains in actually understanding the code. --- graphql.el | 6 +++--- test/graphql-test.el | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/graphql.el b/graphql.el index 3500f06770..78a0ffa726 100644 --- a/graphql.el +++ b/graphql.el @@ -162,15 +162,15 @@ parameter." (defun graphql--genform-operation (args kind) (pcase args (`(,graph) - `(graphql-encode '(,kind ,graph))) + `(graphql-encode '(,kind ,@graph))) (`((,name) ,graph) `(graphql-encode '(,kind :op-name ,name - ,graph))) + ,@graph))) (`((,name ,parameters) ,graph) `(graphql-encode '(,kind :op-name ,name :op-params ,parameters - ,graph))) + ,@graph))) (_ (error "bad form")))) diff --git a/test/graphql-test.el b/test/graphql-test.el index f80bba968a..2703f9cd3a 100644 --- a/test/graphql-test.el +++ b/test/graphql-test.el @@ -65,14 +65,14 @@ (should (string= (graphql-query (repository)) "query{repository}")) (should (string= (graphql-query (test) - (repository)) + ((repository))) "query test{repository}")) (should (string= (graphql-query (test ((ep Episode !) (review ReviewInput ! . 50))) - (repository :arguments ((hello . ($ ep))))) + ((repository :arguments ((hello . ($ ep)))))) "query test($ep:Episode!,$review:ReviewInput!=50){repository(hello:$ep)}")) (should (string= (graphql-mutation (testMutation ((ep Episode . ((complex . params))))) - (change thing)) + ((change thing))) "mutation testMutation($ep:Episode!){change{thing}}"))) (ert-deftest encode-complicated () @@ -80,6 +80,6 @@ (with . "values") (like . 50))) (review ReviewInput ! . 50))) - (repository :arguments ((hello . ($ ep))))) + ((repository :arguments ((hello . ($ ep)))))) "query test($ep:Episode={complex:params,with:\"values\",like:50},$review:ReviewInput!=50){repository(hello:$ep)}"))) ;;; graphql-test.el ends here