Closed lal12 closed 4 years ago
Ok, my vscode intelli sense was a bit laggy. I have found @joiful.any().custom()
by now.
@lal12 , sorry to resurrect this partial thread, but I'm struggling with exactly the two examples you have in the message above. i.e. how to validate the config below. I have tried various things with @jf.any().custom()
but cant quite make it work. Did you manage to find a solution ?
class MyEntitiy{
options: {[key: string]: OptionType};
}
and
class MyEntity{
property: string|SomeObjectType;
}
I have an object where I need one property to be a generic key/value object. So in TS:
Usually with joi I would do
joi.object().unknown(true)
orjoi.object().pattern(/.*/, joi.object())
. Is there a way for this in joiful?I also could imagine other cases where more generic joi functions are useful e.g.
So something generic like
@joiful.schema(mySchema)
would be useful. For this specific example it would be something like@joiful.schema(joiful.joi.alternatives(joi.string(),joi.object()))
.