Fork me on GitHub

Does anyone have advice for graphql queries in a reframe frontend app? Just suffer through strings? graphql-builder? Definitely using parameterized queries so no need to really stringbash, just missing nice formatting and syntax highlighting. Has anyone gotten Cursive working with IntelliJ language injections?


We have been using that for some time and has worked pretty well.


it’s been a while since I’ve done this, but I had had a “read-file” macro and loaded the query into a def via it


I wrote a hacky and pretty minimal Hiccup-ish syntax. It covers this functionality and basically no more, happy to bung it up on GitHub if it might be useful:

(deftest query-test
  (are [input output] (equals-ignore-whitespace output (query input))
    [:foo [:bar :baz]]
    "{ foo { bar baz } }"
    [:bar [:baz :foo]]
    "{ bar { baz foo } }"

    [:foo [:bar :graphql/alias :baz
           :baz :graphql/alias :bar
    "{ foo { bar: baz baz: bar blah } }"
    [:foo {:id 1} [:bar :baz]]
    "{ foo(id: 1) { bar baz } }"

    [:fop :graphql/alias :foo {:id 1} [:bar :baz]]
    "{ fop: foo(id: 1) { bar baz } }"

    [:foo {:id 1 :name "foo"} [:bar :baz]]
    "{ foo(id: 1, name: \"foo\") { bar baz } }"
    [:foo {:id 2} [:bar {:id 4} :baz {:fizzle "wobble" :fuzzle [:wibble]}]]
    "{ foo(id: 2) { bar(id: 4) baz(fizzle: \"wobble\", fuzzle: [wibble]) } }"

    [:foo {:id 1} [:bar {:id 2} [:baz {:order :asc} :bling] :boggle] :bargle]
    "{ foo(id: 1) { bar(id: 2) { baz(order: asc) bling } boggle } bargle }"))

(deftest multiple-query-test
  (is (equals-ignore-whitespace "query { foo { bar baz } bar { baz foo } }"
                                (query [:foo [:bar :baz]] [:bar [:baz :foo]]))))

👍 1

That would be awesome


I posted this in a reply but probably useful for general consumption:

🙏 1

We have been using that lib for about 2 years and it has served us well.


oh nice, spectacularly failed to find this when googling for something previously.