Closed ruankotovich closed 3 years ago
I think you can use Joiful's custom()
method. Something like this might work?
@jf.custom((Joi) => Joi.alternatives().try(Joi.number(), Joi.string()))
myProperty: number | string;
I notice we don't have tests or documentation about the custom()
method, that's something we should add.
I think you can use Joiful's
custom()
method. Something like this might work?@jf.custom((Joi) => Joi.alternatives().try(Joi.number(), Joi.string())) myProperty: number | string;
I notice we don't have tests or documentation about the
custom()
method, that's something we should add.
It worked like a charm, thanks a lot!
Regarding the tests, I will try to do something about the custom()
following the guidelines
I'll close this issue since @jf.custom()
worked.
In the raw Joi lib it is possible to map a field to multiple types using the following approach:
In there a way to do this using joiful?