Fork me on GitHub
#malli
<
2020-09-02
>
ikitommi05:09:50

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

ikitommi05:09:51

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

Elso14:09:01

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.

jeroenvandijk14:09:44

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

jeroenvandijk14:09:37

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

ikitommi14:09:36

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

jeroenvandijk14:09:22

Thanks! I’ll give it a try

jeroenvandijk14:09:30

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

jhacks14:09:24

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

ikitommi14:09:39

@d.eltzner012

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

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

Elso14:09:52

Thanks a lot!

jhacks15:09:20

> 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