Fork me on GitHub
#malli
<
2022-11-01
>
dumrat02:11:13

Is there a schema for malli schemas? 😄

ikitommi05:11:34

there is support for building that 🙂 e.g. in IntoSchema protocol, there are:

(-properties-schema [this options] "maybe returns :map schema describing schema properties")
  (-children-schema [this options] "maybe returns sequence schema describing schema children")
… just have had no time to add the implementations to those. Validation of a form can be done with m/schema, throws if not a valid thing.

👍 1
dumrat16:11:07

Any reason why malli validation would not honor {:optional true} ? i.e.

[:map
 [:details
  [:map
   [:email {:optional true} :string]]]]
Proceeds to ignore the optional status when validating and fails validation.

timothypratley16:11:53

(ma/validate [:map
              [:details
               [:map
                [:email {:optional true} :string]]]]
             {:details {}})
=> true

dumrat08:11:42

My bad. I needed to use ‘maybe’ here.

👍 1