Open tbatchlear opened 1 year ago
Hi @tbatchlear, thank you so much for opening this issue!
You are correct that the failure reasons when adding additional rules are not very great at the moment. We also have issue #140 open to address this.
I've actually already started the work for these improvements, including:
requireOnlyTopLevelDomain
FailureReason
when adding a custom ruleI'll keep this open as it is a great motivator when multiple people are requesting a feature 🙂. I hope to have this ready for you soon!
Is this bug report about an incorrectly validated email address?
If no, please describe the bug
When validating an email address in the following manner, the validation failure message is incorrect:
This returns a
FailureReason.FAILED_CUSTOM_VALIDATION
. There should be a failure reason to match the validation here done on this domain. Perhaps aFailureReason.INVALID_TOP_LEVEL_DONAIN
would be appropriate.Additionally, if passing
my.email@example
to the above validation, it still returns theFAILED_CUSTOM_VALIDATION
reason. However, there is already an existing "MISSING_TOP_LEVEL_DOMAIN" that should be used here instead when used in conjunction with therequireOnlyTopLevelDomain()
, as this implies that a TLD is required.Finally, as a side thought on this, it would be nice to be able to add a custom failure reason, perhaps along with the custom validator?
Then, instead of these predicates being stored as a
Set
, they could be stored as a Map along with their failure reason.