This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-07
Channels
- # announcements (4)
- # babashka (59)
- # beginners (26)
- # calva (34)
- # clj-kondo (3)
- # cljs-dev (1)
- # clojure (77)
- # clojure-austin (4)
- # clojure-europe (20)
- # clojure-nl (2)
- # clojure-norway (11)
- # clojure-spec (3)
- # clojure-uk (4)
- # clojurescript (103)
- # community-development (2)
- # cursive (15)
- # datalevin (12)
- # datascript (38)
- # datomic (1)
- # deps-new (2)
- # events (3)
- # figwheel-main (6)
- # fulcro (9)
- # honeysql (12)
- # jobs (4)
- # juxt (18)
- # kaocha (19)
- # lsp (42)
- # missionary (2)
- # pathom (14)
- # polylith (6)
- # portal (6)
- # reagent (8)
- # reitit (4)
- # releases (2)
- # shadow-cljs (17)
- # testing (1)
- # tools-deps (50)
- # vim (46)
- # xtdb (12)
I already use malli/jsonista from metosin. I was wondering if there is some clever way to map the ingested json data to clojure/pathom attributes.
hello Joel, how would you like to make such an integration? can you detail one specific case you think those could be connected?
It seemed like if I was already describing the incoming map with Malli, that potentially I could be describing the parts that pathom can use to fetch further data, that’s all. I’ve barely gotten my hands dirty with pathom, so not sure if that makes sense.
so, you have for example an external endpoint call, for which you have a malli description of the input and response for that endpoint, and you would like to use that to generate a resolver, is it like this?
No, actually I’m working on the back-end and have an incoming request where the data I’ll be using to invoke other data endpoints using pathom.
not sure if I get that, can you send a code example?
so it’s sort of like i want to pipe the data from the request into the data that pathom knows about to fetch further info.
So if i have a simple malli validator
(def request-schema
(m/schema [:map
[:employee_id string?]]))
And employee_id is something useful to fetch data with. Obviously I can grab it out of the map, but was thinking maybe there’s a way I could describe the schema with info towards identifying the info for pathom, eg, as the :employee/id
field. I’ll be getting many such various requests with one or more fields that might be useful.I imagine it means adding data to the schema and then walking it to grab out the interesting fields to pass to pathom.
I think malli has some arbitrary property/attributes that can be embedded in the schema.
yeah, the name translation seems to be problem to deal with, you will need to define conventions or have some manual translation maps
this is similar to the problem of mapping something like OpenAPI schemas, where they have all endpoints declared, but it can be tricky to turn the unqualified names into qualified ones to satisfy pathom