This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-17
Channels
- # announcements (3)
- # beginners (107)
- # calva (13)
- # clj-kondo (5)
- # cljsrn (21)
- # clojure (99)
- # clojure-australia (8)
- # clojure-dev (51)
- # clojure-europe (108)
- # clojure-nl (1)
- # clojure-portugal (3)
- # clojure-spec (9)
- # clojure-uk (10)
- # clojurescript (147)
- # component (7)
- # conjure (5)
- # core-async (2)
- # cursive (11)
- # datomic (11)
- # emacs (14)
- # graalvm (163)
- # graalvm-mobile (317)
- # honeysql (15)
- # introduce-yourself (4)
- # jobs (3)
- # lambdaisland (1)
- # lsp (19)
- # luminus (3)
- # malli (17)
- # off-topic (10)
- # pathom (11)
- # reagent (10)
- # remote-jobs (2)
- # ring (1)
- # shadow-cljs (22)
- # test-check (2)
- # testing (5)
- # tools-deps (39)
Hello, I want to build a general data-building ui, that takes a description of the datastructure as input (a malli schema, this time around). I couldn’t find much prior work in this regard. I have a half-baked prototype here: https://escherize.com/w/data-desk/
So far, that mostly works for int?
string?
boolean?
:vector
and :map
and combinations of them.
So do you know of anything similar?
As for the implementation, I’m using a local atom and this multimethod: https://github.com/escherize/data-desk/blob/main/src/data_desk/views.cljs#L37
I'd like to validate inside a function that the function is called with valid arguments.
Should I use :=>
? How exactly?
The readme doens't cover it
Here is what I am doing
(def =>plus [:=> [:cat int? int?] int?])
(defn plus [x y]
(when-not
(m/validate (second =>plus) [x y])
(throw (ex-info "invalid input" {})))
(+ x y))
Is there a more idiomatic way?
there will be malli.instrument
, while waiting, there is malli-indtrument
- https://github.com/setzer22/malli-instrument
Very cool! Any reason why it's not yet part of malli?
just time to merge & cleanup, the original issue is here: https://github.com/metosin/malli/issues/349
the function checker code shuould be reused between malli.generate and malli.instrument.
Is someone already working on this consolidation?
please ask on the issue. on my summer backlog if no-one has time. need this too after the vacations.
ok. will do