 ;; Multimethod to decomplect getting base-spec and parent-type-name for fields
 
 (defmulti spec-for-field
-  "Handle children of fragments, lists, and root fields differently"
   (fn [{:keys [v/path v/parent]} parent-node s]
     (cond (#{:fragment-definition :inline-fragment} (:node-type parent))         :fragment-child
           (= :LIST (:kind parent-node))                                          :list-child

    {:n base-named-spec :m {:parent-type-name parent-type-name :base-spec base-spec}}))

(defmethod spec-for-field :root-field
  "Root fields smuggle their base types via metadata from visitor bootstrap"
  [{:keys [v/path]} _ s]
  (let [base-spec (named-spec s [(last (resolve-path path))])] ;; Convert rootField => TypeName
    (register-idempotent s path base-spec {:parent-type-name (first path) :base-spec base-spec})))

(defmethod spec-for-field :default
  "By default, link this field to its parent object type path"
  [{:keys [v/path]} parent-node s]
  (let [parent-type-name (:type-name parent-node)
        base-spec  (named-spec s (conj (:v/path parent-node) (last path)))]

                                      (= (first path) (:mutation-root-name s)))) :root-field)))

(defmethod spec-for-field :fragment-child
  ;; Child fields of named and inline fragments jump out of the nesting path to the top level
  [{:keys [v/path v/parent]} _ s]
  (let [parent-type-name (name (:base-spec parent))
        spec             (named-spec s [parent-type-name (last path)])
