This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-30
Channels
- # aleph (2)
- # announcements (8)
- # babashka (12)
- # beginners (34)
- # calva (36)
- # cherry (3)
- # cider (1)
- # clj-kondo (11)
- # clj-otel (6)
- # cljdoc (31)
- # clojure (121)
- # clojure-conj (1)
- # clojure-czech (2)
- # clojure-europe (109)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (3)
- # cursive (3)
- # datahike (1)
- # datomic (9)
- # deps-new (6)
- # docker (5)
- # emacs (21)
- # fulcro (4)
- # hoplon (16)
- # introduce-yourself (2)
- # london-clojurians (5)
- # lsp (87)
- # malli (17)
- # missionary (1)
- # nbb (27)
- # off-topic (257)
- # pathom (4)
- # portal (42)
- # practicalli (1)
- # rdf (3)
- # releases (2)
- # shadow-cljs (49)
- # slack-help (3)
- # timbre (2)
I am using a foreign registry and im running into, what I believe to be, an issue with a union query. The union query looks something like this:
[:event/id
{:event/properties {:event.x/id [:event.y/id :event.x/name]
:event.y/id [:event.y/id :event.y/name]}}]
However, when the foreign registry tries to resolve the query, it is turned into this:
[:event/id
{:event/properties [:event.x/id :event.x/name :event.y/id :.event.y/name]}]
(pci/register [(pcf/foreign-register
(fn [query]
(println :query query)
(if (= query [:com.wsscode.pathom3.connect.indexes/indexes])
(get-parser-indexes)
(query-from-foreign-api! query))))])
Is this expected behaviour?to be honest I can't remember what happens in this case, since this is very untested group my initial feeling is its a bug, but need some case to verify, can you make a repro please?
(ns parser-bug-reproduction
(:require
[com.wsscode.pathom3.connect.foreign :as pcf]
[com.wsscode.pathom3.connect.planner :as pcp]
[com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.async.eql :as p.a.eql]))
(pco/defresolver event-log [env _]
{::pco/output [{:events [:event/id
{:event/properties {:event.x/id [:event.x/id :event.x/name]
:event.y/id [:event.y/id :event.y/name]}}]}]}
{:events [{:event/id "x"
:event/properties {:event.x/id "x" :event.x/name "event x"}}
{:event/id "y"
:event/properties {:event.y/id "x" :event.y/name "event x"}}]})
(def foreign-indexes
(->
{::p.a.eql/parallel? true}
(pci/register [event-log])
(pcp/with-plan-cache)))
(def foreign-parse* (p.a.eql/boundary-interface foreign-indexes))
(defn foreign-parse! [env ast] (foreign-parse* env ast))
(defn get-foreign-indexes [env]
@(foreign-parse! env [:com.wsscode.pathom3.connect.indexes/indexes]))
(def indexes
(-> {::p.a.eql/parallel? true}
(pci/register [(pcf/foreign-register
(fn [query]
(println :query query)
(if (= query [:com.wsscode.pathom3.connect.indexes/indexes])
(get-foreign-indexes {})
(foreign-parse! {} query))))])
(pcp/with-plan-cache)))
(def parse! (p.a.eql/boundary-interface indexes))
(comment
@(parse! {} [{:events [:event/id
{:event/properties {:event.x/id [:event.x/id :event.x/name]
:event.y/id [:event.y/id :event.y/name]}}]}])
)