@jhacks documented the dependency to README and made it fail better: https://github.com/metosin/malli/commit/5c3689fd42f2c73253a0f81a88b23e20a3b6417b
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
maybe @plexus could verify the readiness there? (there is also a schema type for malli in regal, which is awesome!)
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.I’m wondering if Malli supports lazy registries. I’m guessing it should be possible with the registry protocol. Anyone know of examples?
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
> documented the dependency to README and made it fail better Thanks, @ikitommi! 🙌
Sounds like a great idea. Just implement something lazy behind malli.registry/Registry
and plug it in.
Thanks! I’ll give it a try
(m/validate [:maybe :string] nil)
; => true
(m/validate [:maybe :string] "sheep")
; => true
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
Thanks a lot!
> 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