malli

https://github.com/metosin/malli :malli:
ikitommi 2021-01-25T10:43:30.010900Z

m/parse and m/parser now in master. Feedback and test reports most welcome.

kwrooijen 2021-01-25T14:45:57.011600Z

m/parse looks great! I think that's going to clean up a lot of my code once I get a chance to use it

ikitommi 2021-01-25T18:34:07.014300Z

updated README with parsing examples: https://github.com/metosin/malli#parsing-values

3❤️
ikitommi 2021-01-25T18:35:51.015400Z

:or, :cat and :alt all use non-named branches, :or* , :cat* and :alt* are the named variants.

ikitommi 2021-01-25T18:36:06.015800Z

if somenone has better names for those, please suggest.

ikitommi 2021-01-25T18:36:59.015900Z

the hiccup example is from minimallist, thanks to @vincent.cantin for the original example 🙂

2021-01-25T18:39:40.016200Z

I like it 🙂

2021-01-25T18:42:47.016600Z

Naming things is hard, indeed.

2021-01-25T18:56:55.017Z

@ikitommi in Malli’s version, there is no indication that the :node is a vector. Was it intentional?

oliver 2021-01-25T19:09:18.017600Z

Hi! I'm using malli for the first time on a project where I have to derive HTML-Forms from the body-structure of http-requests. So far the experience has been great – and much more natural than with spec. Now I feel the need for something I was unable to find in the Readme. Say I have the following schema definition: [:map {:closed true} [:a int? :b int?]] I would like to further constrain :b depending on :a, e.g.: - :b must be greater than :a — or — - :b should only be present iff :a is greater than 3 (nil otherwise) Is there a way to express this without recourse to [:fn ] schemas? I'll be thankful for any hints on this!

ikitommi 2021-01-25T19:23:52.017700Z

Oh, that is missing. It accepts all sequences

ikitommi 2021-01-25T19:24:53.017900Z

can't compose with :and here, need to constraint in some other way

2021-01-25T19:35:44.018100Z

without the vector indication, the generator might create a list, that's a problem.

ikitommi 2021-01-25T19:37:52.018300Z

you can add :gen/fmap vec to gen a vec, but having a :kind etc. property would make it work in all the places (validate, gen, transform)

emccue 2021-01-25T20:56:53.018800Z

how would I annotate a function for runtime checking at dev time?

ikitommi 2021-01-25T21:19:19.021300Z

@emccue no such thing yet, but should be easy to add. contributions welcome. https://github.com/metosin/malli/issues/349

ikitommi 2021-01-25T21:20:55.022400Z

@services :and & :fn is the way to do it now.

1✅
oliver 2021-01-27T17:59:15.022800Z

Hi, sorry for taking so long to respond… many thanks for the playground example… I wasn't even aware that existed. I'll be using [:fn …] then. straightforward!

1👍