We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to pass a fn to spec and value and that it would return error message string.
(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$") (expound/def :example/email (s/and string? #(re-matches email-regex %)) "should be a valid email address") (expound/expound-error :example/email "sally@") ;; => "should be a valid email address"
The text was updated successfully, but these errors were encountered:
I discussed this on slack with @leontalbot but in case someone else finds this, I suggested the following:
(expound/def :user/name string? "should be a valid name") (defn msg [spec val] (if (s/valid? spec val) nil (expound/error-message spec))) (msg :user/name "John") ; => nil (msg :user/name :John) ; => "should be a valid name"
Sorry, something went wrong.
No branches or pull requests
Is there a way to pass a fn to spec and value and that it would return error message string.
The text was updated successfully, but these errors were encountered: