Fork me on GitHub

I'm trying to run this GitHuh GraphQL query with Pathom but it's not working as I expect.

  search(query: "sheluchin", type: USER, first: 1) {
    edges {
      node {
        ... on User {
In Pathom:
[{(:github.Query/search {:query "sheluchin" :type USER :first 1})
cause "Pathom can't find a path for the following elements in the query: [:github.User/login] at path [:github.Query/search :github.SearchResultItemConnection/edges :github.SearchResultItemEdge/node]"
Might this be a bug?

👀 1

it looks similar to to me, I plan to do the debugging on this by Thursday this week, hopefully its same thing and we can get both fixes together 🤞


Ok, @U066U8JQJ. Thanks for checking it out. Hopefully it is related.

Mark Wardle11:03:31

Hi all. I now have 153 resolvers and counting, some in my main server product, and many others as separate resolvers in specific libraries. I use integrant to configure much of the environment, so that resolvers have access to different connections to databases, key value stores etc.. But I don't have an easy way of registering resolvers as part of that process. I currently add the resolvers in my integrant init method, storing them in an atom, and finally making use of the collection when the pathom environment is created. e.g. see This works well at small scale, but I'd like to move to being able to keep resolvers and the service init/halt multimethods in their own namespaces. Here is my example integrant configuration file: Has anyone got any suggestions on how to use pathom with integrant to register the appropriate resolvers if and when a specific service is configured? Thank you, Mark


hello Mark, I was playing with integrant setup, I have a half-baked Pathom 3 integrant library, but its development its currently on pause


in my setup, the config looks like this:


   #pathom3/ops "some\\.org\\..+"]





so you can reference resolvers (by var or regex namespace match) to be included


this is the current source, not much but may help you as a starting point:


(ns com.wsscode.pathom3.integrant
  (:require [integrant.core :as ig]
            [com.wsscode.pathom3.connect.operation :as pco]
            [clojure.spec.alpha :as s]
            [ :as io]
            [com.wsscode.pathom3.connect.indexes :as pci])
  (:import (java.util.regex Pattern)))

(s/def ::registry ::pci/operations)

(defn re-find-operations [re]
  (into []
          (filter #(re-find re (str %)))
          (map ns-publics)
          (mapcat vals)
          (map var-get)
          (filter pco/operation?))

(defn find-operations [x]
    (qualified-symbol? x)
    (var-get (requiring-resolve x))

    (string? x)
    (re-find-operations (re-pattern x))))

(def readers
  {'pathom3/ops find-operations})

(defmethod ig/init-key ::pathom3 [_ {::keys [registry] :as p}]
  (let [env {}]
    (pci/register env registry)))

  (var-get (requiring-resolve '

    {:readers readers}
    (slurp (io/resource "sample_app/config.edn")))

  (let [publics (ns-publics ns)])
  (->> (find-ns '
       (mapv #(var-get %)))
  (find-operations #"^some\.org\..+-resolvers$")


for the symbol version this code can load the namespace dinamically, but note that for the namespace regex version you still responsible for loading the possible namespaces yourself, then the code can match from those loaded namespaces

Mark Wardle14:03:47

Oooo that's clever. What a nice idea. I haven't used clojure's ability to find public symbols in namespaces before, but that would work really well. I shall have a good play with it! Thank you. Hope you are keeping well. Mark


glad you liked it 🙂 IMO the option using explicit vars (pointing to registry entries) is preferred over the regex, being explicity makes easier to track and understand whats going on