malli

https://github.com/metosin/malli :malli:
ikitommi 2020-09-02T04:59:51.024400Z

@jhacks documented the dependency to README and made it fail better: https://github.com/metosin/malli/commit/5c3689fd42f2c73253a0f81a88b23e20a3b6417b

ikitommi 2020-09-02T05:02:50.025900Z

I believe regal has regex generators for both clj & cljs, could use that instead. It’s still wip according to README: > The following aspects have known issues or are otherwise untested or incomplete, and you can expect them to change significantly as we further develop them: > * Creating test.check generators from regal forms

ikitommi 2020-09-02T05:03:51.026800Z

maybe @plexus could verify the readiness there? (there is also a schema type for malli in regal, which is awesome!)

Elso 2020-09-02T14:09:01.028300Z

Is there something like nillable in malli? Because

(malli.core/validate [:map [:a {:optional true} string?]] {:a nil})
=> false
(malli.core/validate [:map [:a {:optional true} string?]] {})
=> true
this is rather odd to me.

2020-09-02T14:13:44.030300Z

I’m wondering if Malli supports lazy registries. I’m guessing it should be possible with the registry protocol. Anyone know of examples?

2020-09-02T14:14:37.030400Z

I want to build an AWS Cloudformation validator, but I don’t want to load all schema files upfront. By doing it lazy I hope to win some startup time

jhacks 2020-09-02T14:27:24.031300Z

> documented the dependency to README and made it fail better Thanks, @ikitommi! 🙌

ikitommi 2020-09-02T14:31:36.031400Z

Sounds like a great idea. Just implement something lazy behind malli.registry/Registry and plug it in.

2020-09-02T14:35:22.031900Z

Thanks! I’ll give it a try

ikitommi 2020-09-02T14:36:39.033Z

@d.eltzner012

(m/validate [:maybe :string] nil)
; => true

(m/validate [:maybe :string] "sheep")
; => true

2020-09-02T14:47:30.033100Z

So the value defines what needs to be looked up. E.g. {:Type "AWS::EC2::Instance" …} would need to be validated with the schema for "AWS::EC2::Instance" , so I need to inspect the value before I know the type. Might make it a bit trickier

Elso 2020-09-02T14:52:52.033300Z

Thanks a lot!

jhacks 2020-09-02T15:36:20.034500Z

> I believe regal has regex generators for both clj & cljs, could use that instead Wow, thanks for mentioning regal, I was not aware of it: https://github.com/lambdaisland/regal#use-with-malli