pathom 2023-07-05

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...

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]}

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

but let me know if there is more to it

also curious: what error are you getting?

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

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