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
Hi! I have a feature request:
It would be great if we could assign default values to optional fields.
For example: $.optionalField("superhero", $.str, "superman"),
$.optionalField("superhero", $.str, "superman"),
And if the field "superhero" is empty, it will assign the value "superman".
If no default value is assigned, it will instead be null/undefined.
This is quite useful for some optional fields.
In our case we have a number value that, if it is not filled, it is 1 by default.
Using JOI we would use: Joi.number().empty(1) and we could forget to validate it.
JOI
Joi.number().empty(1)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! I have a feature request:
It would be great if we could assign default values to optional fields.
For example:
$.optionalField("superhero", $.str, "superman"),
And if the field "superhero" is empty, it will assign the value "superman".
If no default value is assigned, it will instead be null/undefined.
Use case
This is quite useful for some optional fields.
In our case we have a number value that, if it is not filled, it is 1 by default.
Using
JOI
we would use:Joi.number().empty(1)
and we could forget to validate it.The text was updated successfully, but these errors were encountered: