Fork me on GitHub
#schema
<
2016-08-02
>
velrok14:08:37

Hi. I’m trying to figure out how to substitute both with conditional as suggested by the docs of both.

velrok14:08:59

Say I have a schema like

(s/both {:a s/Int 
               s/Any s/Any} 
              {:b s/Int 
               s/Any s/Any})

velrok14:08:43

I tried to use instead

(s/conditional 
                (constantly true) {:a s/Int s/Any s/Any}
                (constantly true) {:b s/Int s/Any s/Any})

velrok14:08:15

However that will not check the 2nd condition. I.e.

(s/validate (s/conditional 
                (constantly true) {:a s/Int s/Any s/Any}
                (constantly true) {:b s/Int s/Any s/Any})
              {:a 2})

velrok14:08:31

returns valid