struct
struct copied to clipboard
integer-str passes any numeric
(def integer-str
{:message "must be a long"
:optional true
:validate #(or (number? %) (and (string? %) (str/numeric? %)))
:coerce #(if (number? %) (int %) (str/parse-int %))})
:validate only checks if it's numeric.
It seems that cuerdas https://github.com/funcool/cuerdas doesn't have int? for now. Adding int? to cuerdas and using it in struct can be a solution for this.