GitHubの Dante でいくつかの優れたヘルパーを見つけましたが、使用のライセンスは明確ではありません:
(ns dante.tools.schemas
(:require [dante.tools.namespaces :refer [export]]
[schema.core :as s]
[schema.coerce :as coerce]
[schema.utils :refer [validation-error-explain]])
(:import [schema.utils NamedError ValidationError]))
(defn explain [errors]
(cond
(map? errors)
(->> errors
(map (fn [[k v]]
[k (explain v)]))
(into {}))
(or (seq? errors)
(coll? errors))
(map explain errors)
(instance? NamedError errors)
[(.name errors)
(explain (.error errors))]
(instance? ValidationError errors)
(str (validation-error-explain errors))
:else
(str errors)))
(defn- coercercions [schema]
(or
(coerce/+string-coercions+ schema)
(coerce/set-matcher schema)))
(defn validate [schema value]
((coerce/coercer schema coercercions) value))