Skip to main content

requiredIfOtherArePresent

requiredIfOtherArePresent(requiredPropertyName): (target, key) => void

Property level decorator. Specifies that the property is required if other property is present. If we create User resource with contactId and contactNumber properties, but we want to require contactNumber only if contactId is present, add @requiredIfOtherArePresent("contactId") decorator to contactNumber property.

Sets {@link PropertyMeta.requiredIfOtherArePresent}.

Parameters​

requiredPropertyName​

string

required property name

Returns​

(target, key): void

Parameters​

target​

object

key​

string

Returns​

void