Open xaddict opened 2 months ago
17.13.0
The documentation on extending joi is not really helpful in writing new rules, nor does it explain how to globally extend joi to support new rules
For example, I want to extend joi by adding a .file() which has .min(bytes) and .max(bytes)
.file()
.min(bytes)
.max(bytes)
I am using joi.object() as a base (since almost everything in JS is an object, like FileList and File)
joi.object()
When I add a rule min I get a console error stating: Error: Rule conflict in file min. This is (probably) because joi.object().min already exists.
min
Error: Rule conflict in file min
joi.object().min
The documentation mentions:
overrides: A hash of method names and their overridden implementation. To refer to the parent method, use $_parent()
$_parent()
But doesn't explain how to use it or how one can override the base schema rules.
Invalid rule
Module version
17.13.0
What documentation problem did you notice?
The documentation on extending joi is not really helpful in writing new rules, nor does it explain how to globally extend joi to support new rules
For example, I want to extend joi by adding a
.file()
which has.min(bytes)
and.max(bytes)
I am using
joi.object()
as a base (since almost everything in JS is an object, like FileList and File)When I add a rule
min
I get a console error stating:Error: Rule conflict in file min
. This is (probably) becausejoi.object().min
already exists.The documentation mentions:
But doesn't explain how to use it or how one can override the base schema rules.
Invalid rule