pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
markaddleman 2021-06-17T14:36:28.097100Z

Hi. I'm finally picking this back up and it turns out the repro case is very simple:

(pco/defresolver data-source-event-attributes []
  {::pco/input  []
   ::pco/output [:out]})

(def env (-> (pci/register [data-source-event-attributes])
             (p.plugin/register (pbip/attribute-errors-plugin))))

(comment
  (p.eql/process env [{'(:>/GroupBys {}) [(pco/? :out)]}]))
The query produces an attribute error. I don't think it should

wilkerlucio 2021-06-17T15:49:23.097700Z

querying optional items in eql/process isnt a thing

wilkerlucio 2021-06-17T15:49:37.098300Z

they only work in resolvers, not in eql process

markaddleman 2021-06-17T16:36:58.098500Z

Oh šŸ˜• I have a resolver that does this query on its input. I figured I was simplifying by moving it to the client query

markaddleman 2021-06-17T16:37:05.098700Z

I'll keep trying to find a small repro case

wilkerlucio 2021-06-17T19:16:27.098900Z

and just to clear it up, they are not a thing there because there is no dependency on top of that, so if its not there, it just an edge thing, but maybe it could have some value in the sense of validation, not a thing at this moment, but if you believe this is a useful case please open a discussion on pathom 3 repo and we can keep that in mind

markaddleman 2021-06-17T19:19:11.099100Z

I just got a minimal case. I'll open a discussion on github

markaddleman 2021-06-17T19:21:03.099300Z

actually, my repro case may have found something different. I have a case where pathom cannot generate a plan where I think it should

markaddleman 2021-06-17T19:21:07.099500Z

Putting into github

markaddleman 2021-06-17T19:23:22.099700Z

https://github.com/wilkerlucio/pathom3/discussions/61

lsenjov 2021-06-17T21:56:07.100800Z

Pathom 2.3.1. Is there a way to return nil in a field in a resolver instead of ::p/not-found? My google-fu is failing me

wilkerlucio 2021-06-18T11:30:15.103400Z

oh, I just see there is p/elide-not-found that does it already

wilkerlucio 2021-06-17T21:59:33.101Z

there is a plugin that can help you there:

(def parser
  (p/parser {::p/plugins [;; add this one at the end of your plugins
                          p/elide-special-outputs-plugin]}))

1šŸ‘
wilkerlucio 2021-06-17T22:00:47.101300Z

and nothing wrong with your google-fu, just not well documented

1šŸ‘
lsenjov 2021-06-17T22:01:58.101500Z

Iā€™m not looking to replace every instance of not found, just the ones I know are nil. Would writing a plugin that replaces something like ::p/nil with nil on output be a reasonable solution?

wilkerlucio 2021-06-17T22:02:55.101800Z

if you look into the p/elide-special-outputs-plugin, you can copy and modify it

wilkerlucio 2021-06-17T22:03:14.102Z

(def elide-special-outputs-plugin
  (post-process-parser-plugin elide-special-outputs))

wilkerlucio 2021-06-17T22:03:20.102200Z

(defn elide-special-outputs
  "Convert all ::p/not-found values of maps to nil"
  [input]
  (elide-items special-outputs input))

wilkerlucio 2021-06-17T22:03:27.102400Z

(def special-outputs #{::reader-error ::not-found})

wilkerlucio 2021-06-17T22:04:07.102600Z

so, something like: (p/post-process-parser-plugin #(elide-items #{::p/not-found} %))

lsenjov 2021-06-17T22:07:06.102900Z

Oh I see! Thank you for the help šŸ™‚