Skip to content

Unable to use @Or decorator #35

@yagyesha

Description

@yagyesha

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions