This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-06
Channels
- # beginners (32)
- # boot (17)
- # cider (4)
- # clara (112)
- # cljs-dev (3)
- # cljsjs (2)
- # clojure (222)
- # clojure-germany (3)
- # clojure-greece (1)
- # clojure-italy (4)
- # clojure-losangeles (4)
- # clojure-russia (46)
- # clojure-spec (24)
- # clojure-uk (71)
- # clojurescript (78)
- # community-development (5)
- # component (88)
- # cursive (6)
- # datomic (7)
- # duct (5)
- # figwheel (2)
- # fulcro (21)
- # graphql (22)
- # leiningen (3)
- # luminus (9)
- # off-topic (1)
- # om (16)
- # onyx (46)
- # portkey (30)
- # re-frame (47)
- # reagent (5)
- # remote-jobs (1)
- # ring (12)
- # ring-swagger (13)
- # rum (1)
- # shadow-cljs (81)
- # spacemacs (1)
- # specter (33)
- # sql (2)
- # test-check (2)
- # vim (16)
- # yada (11)
via attach-scalar-transformers
per the docs. I’m trying somethign like the following:
:scalars
{:Date
{:parse :date-parse
:serialize :date-serialize}
but it’s blowing up on the spec validation
:clojure.spec.alpha/problems ({:path [:args :schema :scalars 1 :parse], :pred clojure.spec.alpha/spec?, :val :date-parse, .....
Which seems to indicate that the map value should itself be a spec?Are you following along with the example here: http://lacinia.readthedocs.io/en/latest/custom-scalars.html?
yes with the exception that my schema is in an EDN file, so trying to follow the guidance under Attaching Scalar Transformers
> In the initial schema, use a keyword for the :parse and :serialize keys, then provide a corresponding value in transform-m.
here are a couple tests which use attach-scalar-transformers
https://github.com/walmartlabs/lacinia/blob/master/test/com/walmartlabs/lacinia/util_test.clj#L37
I tried the same pattern
(-> (io/resource "edn/grant-infra-schema.edn")
slurp
edn/read-string
(attach-resolvers {:resolve-persons res/resolve-persons
:resolve-person-field res/resolve-person-field
:resolve-create-person! res/resolve-create-person!})
(attach-scalar-transformers {:date-parse types/parse-date
:date-serialize types/serialize-date
:uuid-parse types/parse-uuid
:uuid-serialize types/serialize-uuid})
schema/compile))
I have another quick question. I’m creating a mutation, i’d like to create a ‘person’ Since I already have person defined as an object, I’d like to pass one an argument but something like this:
:mutations
{:createPerson {:type :person
:args {:arg {:type :person}}
:resolve :resolve-create-person!}}
fails
where a quick change to a native scalar type is fine
:mutations
{:createPerson {:type :person
:args {:arg {:type String}}
:resolve :resolve-create-person!}}