This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-29
Channels
- # announcements (1)
- # babashka (1)
- # beginners (46)
- # calva (2)
- # cider (6)
- # circleci (10)
- # clj-kondo (2)
- # cljsrn (2)
- # clojure (30)
- # clojure-dev (6)
- # clojuredesign-podcast (8)
- # clojurescript (28)
- # conjure (1)
- # core-logic (2)
- # core-matrix (2)
- # cryogen (16)
- # figwheel-main (2)
- # graalvm (4)
- # jobs (1)
- # malli (15)
- # minimallist (1)
- # off-topic (70)
- # pathom (4)
- # reagent (3)
- # releases (2)
- # remote-jobs (8)
- # rewrite-clj (3)
- # shadow-cljs (4)
- # tools-deps (29)
- # uncomplicate (3)
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"})
@U0GC1C09L the README has [:string {:min 1}]
as example.
merged into master the current status of function schemas, alpha, feedback welcome! the guide is here: https://github.com/metosin/malli#function-schemas
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?
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 🙂