This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-02
Channels
- # announcements (2)
- # babashka (21)
- # beginners (80)
- # bristol-clojurians (1)
- # calva (1)
- # cider (4)
- # clara (2)
- # clj-kondo (5)
- # cljs-dev (41)
- # clojure (8)
- # clojure-dev (2)
- # clojure-europe (28)
- # clojure-italy (11)
- # clojure-nl (4)
- # clojure-spec (13)
- # clojure-sweden (1)
- # clojure-uk (11)
- # clojuredesign-podcast (5)
- # clojurescript (5)
- # code-reviews (4)
- # cursive (25)
- # data-science (5)
- # datomic (25)
- # duct (15)
- # emacs (6)
- # fulcro (13)
- # graalvm (1)
- # graphql (5)
- # helix (2)
- # jobs (3)
- # jobs-discuss (4)
- # luminus (1)
- # malli (13)
- # meander (3)
- # off-topic (16)
- # pathom (2)
- # pedestal (1)
- # re-frame (5)
- # ring-swagger (3)
- # spacemacs (4)
- # sql (16)
- # tools-deps (1)
- # tree-sitter (8)
- # vrac (2)
- # xtdb (16)
- # yada (2)
Hello GraphQL/Lacinia developers, whats the best approach to coerce inputs for graphql endpoint. I need to coerce string to uuid. so that datomic can understand it. Currently I wrote his wrapper, which I wrap for each handler where id is used. But this feels hacky. Any tips
(defn uuid-wrapper [handler]
(fn [context {:keys [id] :as args} entity]
(if id
(if (uuid? (u/str->uuid id))
(let [args (assoc args :id (u/str->uuid id))]
(handler context args entity))
nil)
(handler context args entity))))
You could define a UUID
scalar type which could convert input strings to UUIDs and vice-versa.
Not sure how I can do that. Can you please provide an example 🙂
Nevermind, found the doc https://lacinia.readthedocs.io/en/latest/custom-scalars.html