Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global flag to turn on/off validation in Prismatic/Schema?

During development I would like to enable validation for all functions that are defined with schema.core/defn, instead of having to annotate them with :^:always-validate. Is this possible with this library?

Something like this doesn't work, probably because meta-data is only added during compile-time:

(def dev false)

;; example of schema validation
(sm/defn ^{:always-validate dev}
  add :- s/Num
  [a :- s/Num b :- s/Num]
  (+ a b))
like image 810
Michiel Borkent Avatar asked Sep 07 '14 12:09

Michiel Borkent


1 Answers

This seems to do what I want:

(s/set-fn-validation! false)
like image 141
Michiel Borkent Avatar answered Oct 26 '22 23:10

Michiel Borkent