pathom

mauricio.szabo 2023-07-05T23:06:26.995059Z

Hi there! So, I just upgraded from a very old Pathom version to a new one, and this resolver declaration started to fail:

clojure
(pco/defresolver repl-eval [env {:repl/keys [evaluator namespace aux? kind]
                                 :text/keys [contents range]
                                 :editor/keys [filename]}]
  {::pco/input [:repl/evaluator :text/contents]
   ::pco/output [:repl/result :repl/error]}
Basically - it is "forcing" the input to be what I destructured in the defresolver, not on what I explicitly said on ::pco/input Just to be clear - I know the declaration don't make sense, but what I wanted was to destructure these fields and then use pco/? to mark some of these as "optional" and I can't do that...

wilkerlucio 2023-07-06T13:39:44.811019Z

hello, there was a change that started merging the inferred input with the explicit input, what you want is to make :editor/filename optional, is that right? if so, you can write this resolver as:

(pco/defresolver repl-eval
                 [env {:repl/keys   [evaluator namespace aux? kind]
                       :text/keys   [contents range]
                       :editor/keys [filename]
                       :or {filename nil}}]
                 {::pco/output [:repl/result :repl/error]}

wilkerlucio 2023-07-06T13:40:39.984709Z

using the :or part of destructuring, you can map the optionals

wilkerlucio 2023-07-06T13:40:48.698819Z

but let me know if there is more to it

wilkerlucio 2023-07-06T13:41:08.820029Z

also curious: what error are you getting?

wilkerlucio 2023-07-06T13:41:54.221479Z

this is the version change that affects this: https://github.com/wilkerlucio/pathom3/blob/main/CHANGELOG.md#20221018-alpha entry: Instead of overriding ::pco/input or ::pco/params when explicitly set, now Pathom will merge that with the inferred input/params

wilkerlucio 2023-07-06T13:43:20.552109Z

using pco/? in the explicit input still remains a valid option too