如何为以下架构defrecord的extra-validator-fn中的每个检查分配谓词:
(s/defrecord Item
[type :- (s/enum :solid :liquid)
unit :- (s/enum :kg :ml)]
(s/fn [{:as this :keys [type unit]}]
(or (and (= type :solid) (= unit :kg))
(and (= type :liquid) (= unit :ml)))))
额外验证在此示例中引发异常:
(s/validate Item (map->Item {:type :solid :unit :ml}))
这里写着:(not (passes-extra-validation? a-apriori.cli.core.Item))
但是,我希望阅读:(not ('invalid-unit-for-type a-apriori.cli.core.Item))