noob question, but how can i validate/generate non-blank strings? with spec i would use (complement clojure.string/blank?)
.
(m/validate [:map [:name [:and string? (complement clojure.string/blank?)]]] {:name ""})
Execution error (ExceptionInfo) at malli.core/-fail! (core.cljc:79).
:malli.core/invalid-schema {:schema #object[clojure.core$complement$fn__5669 0x394ebe0b "clojure.core$complement$fn__5669@394ebe0b"]}
this validates, but fails on generation
(m/validate [:map [:name [:fn (complement clojure.string/blank?)]]] {:name "test"})
@joshkh the README has [:string {:min 1}]
as example.
not sure how i missed that. thanks eval2020.
I think there should be a built-in complement.
doesn’t exist, but should.
merged into master the current status of function schemas, alpha, feedback welcome! the guide is here: https://github.com/metosin/malli#function-schemas
and the PR https://github.com/metosin/malli/pull/306
also has now the full :clj-kondo: integration !!
will make a separate PR of the optional plumatic-style helpers.
there are now var instrumentation helpers atm, only shipped use case is the clj-kondo type checker integration. Any ideas what would be a good api to instrument functions in dev to run the input & output checks?
any ideas about clojure.test
helpers for malli?
dev-time tooling has not been the goal for malli (as it’s the primary goal for spec already), but happy to add things to that direction too.
with spec, have used https://github.com/jeaye/orchestra, I guess like everyone else 🙂