Open ujwal-setlur opened 3 years ago
Will try with custom()
Looks like joiful
is accidentally missing this functionality. Should be an easy fix.
https://github.com/joiful-ts/joiful/blob/master/src/decorators/array.ts#L109
Change unique
to accept the same args: either a comparator function; or a string and an optional "options" object. @types/joi
can help us work out what the arg types should be. Then update the interface ArraySchemaModifiers
, and add tests.
Any update?
No update from me, sorry. I'd welcome a Pull Request. 😁
I have the same problem as in https://stackoverflow.com/questions/53243306/validating-unique-key-pairs-in-a-nested-object-with-joi-and-nodejs
I essentially have an array of objects, and I want to validate that a certain key/value pair is not duplicated amongst the array elements of objects.
This can be solved in
joi
with providing a comparator to theunique()
function.However, in
joiful
, I cannot pass a comparator tounique()
.Is there a different way to do this?