weavejester / integrant

Micro-framework for data-driven architecture
MIT License
1.22k stars 63 forks source link

Refs/Refsets not preserved after expansion #107

Closed james-doolan closed 8 months ago

james-doolan commented 8 months ago

expand replaces Refs/Refsets with maps, resulting in an un-initialisable config.

(ns test
  (:require [integrant.core :as ig]))

(defmethod ig/init-key ::A [_ c] c)
(defmethod ig/init-key ::B [_ c] c)

(def config  {::A {:b1 (ig/ref ::B)
                   :b2 (ig/refset ::B)}
              ::B {}})

;; Expect the following to produce equivalent results:

(-> config ig/expand ig/init)
=> #:test{:A {:b1 {:key :test/B}, :b2 {:key :test/B}}, :B {}}

(-> config ig/init)
=> #:test{:B {}, :A {:b1 {}, :b2 #{{}}}}
weavejester commented 8 months ago

Thanks for the report, and thanks for testing out the alpha to find this. I'll push a fix hopefully later today.