This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-26
Channels
- # announcements (1)
- # asami (7)
- # aws (3)
- # babashka (30)
- # beginners (21)
- # calva (48)
- # cider (11)
- # clj-commons (5)
- # clj-kondo (12)
- # cljdoc (5)
- # cljfx (1)
- # cljs-dev (32)
- # cljsrn (4)
- # clojure (218)
- # clojure-europe (88)
- # clojure-nl (11)
- # clojure-uk (31)
- # clojurescript (8)
- # cursive (98)
- # data-science (6)
- # datomic (49)
- # emacs (12)
- # events (4)
- # fulcro (47)
- # graalvm (3)
- # graphql (4)
- # introduce-yourself (5)
- # java (13)
- # juxt (9)
- # lsp (74)
- # meander (3)
- # membrane (4)
- # missionary (31)
- # off-topic (24)
- # pathom (41)
- # portal (4)
- # reagent (3)
- # releases (1)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # slack-help (2)
- # testing (20)
- # tools-deps (43)
@wilkerlucio Hey thank you so much for building this great framework. I have a couple questions 1. Say I have records with
[ {:value "A" :record.created-by-id "123" :record.last-modified-by-id "456" }
{:value "B" :record.created-by-id "789" :record.last-modified-by-id "456" }]
and then I have a service that does a batch lookup for users. What is the recommended way of setting this lookup up if I would like to return something that assigns a name to both created-by
and last-modified-by
I am sure this is a common problem š. We have a lot of leeway with the shape of the returned data, though we do need a batch lookup. One will be ideal, we can def live with two (one for created one for last-modified). We do need to be able to tell which one is which.
2. We are starting development now. How alpha is Pathom3? I saw someone asking about parallel parser and such. We are not shy about using alpha (got a lot of mitosin floating on the project), but would thought I would ask. Once again thanks for all your hard work.hello š
1. not what you want to do, what you mean by assign a name to created-by
and last-modified-by
? how these data is related to the records you presented?
2. Pathom 3 has a mostly stable API already, not expecting that to have big changes, that said, the basic features (local processing and serial process) seem to be stable, I've been using in a couple of projects and there are other users here too. I would say that features like distributed graphs is the one to not have a lot of confidence at this point, not very used and likely to be bugged at this stage
ok to be specific: I am modelling a resolver that gives me
[{:record/id "42" :record/created-by-id "user-id-1" :record/last-modified-by-id "user-id-2" ]
and so on
I also have an api that can look up usernames in bulk so I can pass in
["user-id-1" "user-id-2"}]
and get back
[{:user/id "user-id-1 :user/display-name "Billy Bob"}
{:user/id "user-id-2 :user/display-name "Jane Smith"}]
So what I am trying to do here is return something like
{:records [ {:record/id "42"
:record/created-by-name "Billy Bob"
:record/last-modified-by "Jane Smith"}]
once again it does not need to be this shape, just as long as I can navigate to the name
these values appear on 90% of our data, which needs to be displayed with the name on the UI
cool, the trick is to change your bulk input, and label the data you already have, so instead of ["user-id-1" "user-id-2"]
, it would be more like: [{:user/id "user-id-1"} {:user/id "user-id-2"}]
that sounds correct to me, whats the part I can help you with?
there are two issues here. I don't know which one the user/display-name is (created by or last modified by)
(pc/defresolver note-test-resolver [_ _]
{::pc/output [{:notes [:user/id]}]}
{:notes [{:note/id "123"
:note/created-by-id "0495e640-b11c-4b58-a29d-8ce0ba485144"
:note/last-modified-by "04bfa00e-d161-46b4-b2cf-d829905c86db"}
{:note/id "789"
:note/created-by-id "047ab33e-fef2-4c3d-9d36-f8d3b0170525"
:note/last-modified-by "047893f7-e697-436f-8259-2b6e0ae45c1d"}
{:note/id "456"
:note/created-by-id "170aa5c2-bcab-4cc3-990e-2e67f996fc58"
:note/last-modified-by "d85c0a12-22ff-40a2-a050-811606ee375e"}]})
(pc/defresolver user-resolver [_ -inputs]
{::pc/input #{:user/id}
::pc/output [:user/display-name]
::pc/transform pc/transform-batch-resolver}
(let [inputs (if (sequential? -inputs) -inputs [-inputs])
users (get users from db)
items (map (fn [user] {:user/id (:id user)
:user/display-name (:display-name user)
:user/email (:email user)}) users)]
(pc/batch-restore-sort {::pc/inputs inputs
::pc/key :user/id
::batch-default (fn [] {:user/display-name "NO-NAME"})} items)))
(def registry
[ note-test-resolver user-resolver
(pc/alias-resolver :note/created-by-id :user/id)
(pc/alias-resolver :note/last-modified-by-id :user/id)
pc/index-explorer-resolver])
no worries, taking a look at your text now
if you have multiple options for one attribute, there will be ambiguity (which is nice to avoid when you can), having a nested key for each (one for created, one for last modified) can be a way to solve the ambiguity
so in this case, you can have two extra resolvers, as:
(pco/defresolver nav-user-created [{:keys [note/created-by-id]}]
{::pco/output
[{:note/created-by [:note/user-id]}]}
{:note/created-by {:user/id created-by-id}})
(pco/defresolver nav-user-last-update [{:keys [note/last-modified-by-id]}]
{::pco/output
[{:note/last-modified-by [:note/user-id]}]}
{:note/last-modified-by {:user/id last-modified-by-id}})
then you can query:
[{:notes [:note/id {:note/created-by [:user/name]}]
`please let me know how it goes
If I have an attribute marked as optional in my request, is it expected that Iād get the Insufficient data calling resolver
error message when trying to reach that attribute?
Do you have two resolvers that output the same attribute?
I think this is a planning bug. I've been meaning to create a repro case for it
I think I got around it by avoiding optional entirely. I have one resolver that requires the attribute and one that does not. Then, I use priority to get the behavior that I want
the only way you may get that still is if some other required attribute depends on that, in this case it still invalid, otherwise please open an issue with a repro š