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
I'm not sure if this is intended behaviour but
(bouncer/validate {} :id [v/string [v/matches #"a*"]])
evaluates to
[{:id ("id must be a string")} {:bouncer.core/errors {:id ("id must be a string")}}]
I would have expected the validation to pass since :id is not v/required.
:id
v/required
If this is expected how do I create a validator where an optional string value must match a regex only if the key exists?
Edit After some digging it's actually v/string that makes the key-value non-optional. This was a surprise for me
v/string
The text was updated successfully, but these errors were encountered:
This has been changed on #41 so bouncer will behave like this:
user=> (b/validate {} :id [v/string [v/matches #"a*"]]) [nil {}] user=> (b/validate {} :id [v/required v/string [v/matches #"a*"]]) [{:id ("id must be present")} {:bouncer.core/errors {:id ("id must be present")}}]
I've just released a new version containing this change. Give that a go and let me know if you run into issues.
Sorry, something went wrong.
No branches or pull requests
I'm not sure if this is intended behaviour but
evaluates to
I would have expected the validation to pass since
:id
is notv/required
.If this is expected how do I create a validator where an optional string value must match a regex only if the key exists?
Edit After some digging it's actually
v/string
that makes the key-value non-optional. This was a surprise for meThe text was updated successfully, but these errors were encountered: