About to add eager references too:
(def Schema
[:and
{:registry {::a ::b
::b ::c
::c [:schema pos-int?]}}
[:and ::a ::b ::c]])
(m/form Schema)
;[:and {:registry #:user{:a :user/b
; :b :user/c
; :c [:schema pos-int?]}}
; [:and :user/a :user/b :user/c]]
(m/to-map-syntax Schema)
;{:type :and
; :properties {:registry #:user{:a :user/b
; :b :user/c
; :c [:schema pos-int?]}}
; :children [{:type :and
; :children [{:type :schema
; :children [:user/a]}
; {:type :schema
; :children [:user/b]}
; {:type :schema
; :children [:user/c]}]}]}
e.g. each registry hop retains the information the original linkage + :schema
element to mark Entitys in a schema data graph.
(all registry hops are internaly :schema
too)
accept can be configured to automatically walk over those, if wanted.
both :schema
and :ref
also implement the new
(defprotocol RefSchema
(-deref [this] "returns the referenced schema"))
… and for the given schema, the validation fn is just pos-int?
(m/validator Schema)
; #object[clojure.core$pos_int]
which is kinda awesome 🙂