This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-28
Channels
- # aleph (4)
- # announcements (5)
- # babashka (28)
- # babashka-sci-dev (13)
- # beginners (63)
- # calva (76)
- # cider (113)
- # clara (7)
- # clj-kondo (42)
- # cljdoc (1)
- # clojure (170)
- # clojure-europe (20)
- # clojure-nl (17)
- # clojure-norway (3)
- # clojure-spec (12)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (55)
- # clojureverse-ops (1)
- # consulting (1)
- # core-async (9)
- # cursive (16)
- # data-science (1)
- # datascript (8)
- # datomic (27)
- # emacs (14)
- # events (1)
- # fulcro (10)
- # graphql (9)
- # gratitude (1)
- # jobs (6)
- # jobs-discuss (5)
- # leiningen (10)
- # lsp (35)
- # missionary (4)
- # nextjournal (9)
- # off-topic (46)
- # pathom (15)
- # pedestal (5)
- # polylith (37)
- # portal (15)
- # re-frame (22)
- # reagent (4)
- # reitit (5)
- # reveal (18)
- # shadow-cljs (20)
- # tools-deps (7)
- # xtdb (10)
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
:blah]]
"{ 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]]))))
I posted this in a reply but probably useful for general consumption: https://github.com/Vincit/venia
We have been using that lib for about 2 years and it has served us well.