malli icon indicating copy to clipboard operation
malli copied to clipboard

Describe Malli Schema Children using Malli

Open ikitommi opened this issue 4 years ago • 1 comments

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.

ikitommi avatar Oct 05 '20 05:10 ikitommi

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

miikka avatar Dec 08 '20 06:12 miikka