This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-28
Channels
- # announcements (1)
- # beginners (205)
- # calva (30)
- # cider (5)
- # cljdoc (25)
- # cljs-dev (2)
- # clojure (119)
- # clojure-brasil (5)
- # clojure-conj (7)
- # clojure-europe (2)
- # clojure-hamburg (7)
- # clojure-italy (14)
- # clojure-nl (2)
- # clojure-russia (13)
- # clojure-spec (79)
- # clojure-uk (58)
- # clojurescript (54)
- # core-logic (2)
- # core-matrix (2)
- # cursive (40)
- # datascript (2)
- # datomic (18)
- # duct (2)
- # emacs (14)
- # figwheel (3)
- # figwheel-main (7)
- # fulcro (30)
- # funcool (1)
- # graphql (10)
- # jobs (1)
- # juxt (13)
- # lumo (1)
- # mount (1)
- # off-topic (56)
- # other-languages (2)
- # pedestal (17)
- # powderkeg (2)
- # protorepl (2)
- # re-frame (10)
- # reagent (1)
- # reitit (7)
- # ring-swagger (10)
- # schema (2)
- # shadow-cljs (70)
- # spacemacs (13)
- # specter (4)
- # sql (9)
- # tools-deps (26)
Hey guys, I'm new to Lacinia I'm having a problem that lacinia queries and mutations is returning me clojure maps I have to define a type on lacinia's schema.edn to return me every key to a graphql like output? query:
{ sendSms(phone: "+5552999991000") }
response:
{
"data": {
"sendSms": "{:message \"SMS token was sent\", :success true, :uuid 109507373}"
}
}
schema.edn:
{:queries {:requestAccessToken
{:type String
:args {:uid {:type (non-null String)}}
:resolve :query/request-access-token}
:sendSms
{:type String
:args {:phone {:type String}}
:resolve :query/send-sms}}}
Hi again! The issue you are seeing is because your sendSms is defined to return a type String.
You should define a type that contains message, success, uuid, then use that in your sendSms type.
I have to define types
Thanks 😃
I have to wonder whether the String scalar's serializer should even allow a map, or thrown an exception - this is clearly a developer error. Perhaps String should be more constrained to just a few types, like Number, Symbol, Keyword, String and not try to coerce maps and vectors and random Java objects via .toString()
.