walmartlabs/lacinia

Unbalanced braces in queries not causing parse-query to fail

neilprosser opened this issue · 0 comments

This is tested with 1.2.1.

We use Lacinia to quickly validate GraphQL queries we define in code to try and avoid committing something invalid. I noticed a couple of examples of typos which don't cause com.walmartlabs.lacinia.parser.query/parse-query to fail:

(ns temp
  (:require [com.walmartlabs.lacinia.parser.query :as pq]))

;; Brace switched with paren end of line 1 - Throws an exception
(pq/parse-query "query (
  myQuery {
    name
  }
}")

;; Missing brace end of line 1 - Doesn't throw an exception
(pq/parse-query "query
  myQuery {
    name
  }
}")

;; Missing brace end of line 2 - Doesn't throw an exception
(pq/parse-query "query {
  myQuery
    name
  }
}")

These queries are then failing when they are sent to a service using Lacinia for its GraphQL handling.