-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Joi.number allows Infinity #494
Comments
This seems like a non-issue. |
All mathematical operations I tried on |
I almost didn't post the issue in the first place because I agree that 0 / 0 // NaN
1 / 0 // Infinity
-1 / 0 // -Infinity When I validate numbers I use But maybe this is outside of the scope of Joi. |
I'll probably make that change, serialization poses a serious problem since it produces unexpected results. |
Looking at it again, Joi explicitly fails on string conversions for |
Like I said Infinity is not serializable, that can't be worked around without a special case, but anyway I'd rather not support an edge case that breaks people's expectations. |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Feature request for a breaking change. Joi version 4.9.0
I'm not sure if this is the desired behaviour or not. It seems to me like
Infinity
should be rejected just likeNaN
.This seems a bit awkward in order to validate that the value is a finite number:
The text was updated successfully, but these errors were encountered: