I have a model similar to below:
export class Address {
public currentAddress: string;
public permanentAddress: string;
}
The requirement here is that at-least currentAddress or permanentAddress should be provided. And @or decorator fits the bill perfectly here, however i'm unable to get it working.
Looking at some of the joi examples, it seems .or is used on the schema of the object (i.e. Address class in my example above) rather than on the keys (i.e. currentAddress, permanentAddress etc).
Can someone provide an example of how @or decorator be used? I could not find anything in the tests too.
Thanks in advance.
I have a model similar to below:
The requirement here is that at-least
currentAddressorpermanentAddressshould be provided. And @or decorator fits the bill perfectly here, however i'm unable to get it working.Looking at some of the joi examples, it seems
.oris used on the schema of the object (i.e.Addressclass in my example above) rather than on the keys (i.e.currentAddress,permanentAddressetc).Can someone provide an example of how @or decorator be used? I could not find anything in the tests too.
Thanks in advance.