-
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
BigInt support #1531
Comments
Your commit seems reasonable, why didn't you PR ? The question of whether it needs a new type or not is indeed a good one, I haven't used it enough to see the practical pitfalls we'd fall into if we regrouped those under the same type, have you ? |
I just wanted to gather a bit of feedback before revising / adding relevant doc updates. Semantically, it would make sense to add a new Actually, one idea that could bring us closer: Allow entries to have a post validation conversion step. const schema = Joi.number().integer().convert(BigInt); This would also enable a Joi schema to output const schema = Joi.array().unique().convert((arr) => new Set(arr)); …or if you like const schema = Joi.date().convert(moment); |
This is getting close to what extensions already do, plus it wouldn't solve your current problem. |
I don't see the value of the proposed change. It just loses the bigint precision by forcing it into a number. It does the least intuitive thing here. A new bigint type would make more sense but also feels like an overkill and a lot of duplicated code. I am going to close this due to lack of progress in almost a year. |
Describe the problem you are trying to fix (provide as much context as possible)
Support
BigInt
integers. See outmoded/hapi-contrib#119.Which API (or modification of the current API) do you suggest to solve that problem ?
I would like Joi to support the
BigInt
type. This involves accepting it as input fornumber()
validation (whenconvert
is enabled), and probably as a new validation type.Are you ready to work on a pull request if your suggestion is accepted ?
Yes. See kanongil@fa53259.
The text was updated successfully, but these errors were encountered: