-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
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
Validator Base Module #14
base: master
Are you sure you want to change the base?
Conversation
This enables the specific country validators to only use this module specifying the required documents without having to create a `validate/2` function for every document. use Bali.Validator, country: :pt, documents: %{ nif: ~r/^\d{9}$/ }
|
||
regex -> | ||
if Regex.match?(regex, value) do | ||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Devolver true
puede generar confusión porque se puede asumir que en caso contrario se va a devolver false
, se podría quedar como :ok
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ates regresaba un tipo {:ok, String.t()}
. No sería bueno mantenerlo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Con lo que se habló en el canal se dejó que se mantenga :valid | {:error, String.t()}
como spec de respuesta
como fiscales, segun lo revisado con operaciones | ||
|
||
## Ejemplos: | ||
Validator for Portuguese personal and tax identifications.any() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.any()
?
|
||
regex -> | ||
if Regex.match?(regex, value) do | ||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ates regresaba un tipo {:ok, String.t()}
. No sería bueno mantenerlo?
Context
Instead of having to create a function for each different document we need for every country, we added a base module that creates this function for each specified document in the
use
command.Example