pathom 2023-06-10

Does Pathom happen to have a helper for creating a vector of keywords with a common namespace?

Not that I know of, but easy to write. Perhaps:

(defn make-kws [kns & kws] (mapv #(keyword kns %) kws))
; => #'user/make-kws
(make-kws "my.namespace" "foo" "gee" "bar")
; => [:my.namespace/foo :my.namespace/gee :my.namespace/bar]

@thomasmoerman Is there some way to make it work with namespace aliases declared with :alias-as?

no such helper in pathom

@alex.sheluchin helper that uses aliases:

(defn make-kws [kns & kws]
  (let [kns (if (qualified-keyword? kns) (namespace kns) kns)]
   (mapv #(keyword kns %) kws)))

(comment
  (make-kws ::pci/_ "foo"))

👍 1

@wilkerlucio Ah, nice trick with the throwaway _ kw. Thanks! I'm a little surprised this isn't in Pathom because of the number of such vectors I have when calling resolvers.