Skip to content

Unbalanced braces in queries not causing parse-query to fail #445

@neilprosser

Description

@neilprosser

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions