Fork me on GitHub
#schema
<
2017-04-27
>
rovanion08:04:18

You could always write a predicate like:

(schema/defschema string-vector                                                                              
  [schema/Str])                                                                                              
               
(defn str-vec? [arg]                                                                                         
  (try (schema/validate string-vector arg)                                                                   
       true                                                                                                  
       (catch clojure.lang.ExceptionInfo e                                                                   
         false)))                                                                                            
                                                                                                             
(str-vec? ["hi"])   ; => true                                                                                
(str-vec? ["hi" 5]) ; => false

rovanion08:04:01

Perhaps someone else knows a better answer?

rovanion08:04:50

What is it defschema does? I can't figure out the difference between it and simply using a def.

plins14:04:16

right now im trying to create a validator for non-iso string dates to use in compojure-api (the custom date format is "dd/mm/yyyy")

plins14:04:51

and i couldnt find something like (schema/Date "dd/mm/yyyy")