malli
malli copied to clipboard
Describe Malli Schema Children using Malli
Each Schema has it's own syntax for children. We should describe them using Malli to get proper syntax validation. This is just a new protocol method in IntoSchema
. Need to be an option for the DCE to remove these at runtime. This requires #180 to be implemented.
Example by @mvarela – this broken schema is quietly accepted, but ideally it would give a syntax error:
;; Broken: :version schema is accidentally included in :project vector
(def Project [:map [:project string? :version string?]])
(m/validate Project {:project "malli", :version nil}) ; => true
;; The correct version, for comparison:
(def Project [:map [:project string?] [:version string?]])
(m/validate Project {:project "malli", :version nil}) ; => false