Fork me on GitHub
#malli
<
2021-01-25
>
ikitommi10:01:30

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

kwrooijen14:01:57

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

ikitommi18:01:07

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

❤️ 9
ikitommi18:01:59

the hiccup example is from minimallist, thanks to @U8MJBRSR5 for the original example 🙂

Vincent Cantin18:01:55

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

ikitommi19:01:52

Oh, that is missing. It accepts all sequences

ikitommi19:01:53

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

Vincent Cantin19:01:44

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

ikitommi19:01:52

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)

ikitommi18:01:51

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

ikitommi18:01:06

if somenone has better names for those, please suggest.

Vincent Cantin18:01:47

Naming things is hard, indeed.

oliver19:01:18

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!

emccue20:01:53

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

ikitommi21:01:19

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

ikitommi21:01:55

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

3
oliver17:01:15

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!

👍 3