For example:
{
phone: string
email: string
....
....
otherFields
....
....
}
Either phone or email should be required in request body. I found solution only for validation, here is:
export class MyDto {
@IsString()
@ValidateIf((obj, value) => !obj.email || value)
phone: string;
@IsString()
@ValidateIf((obj, value) => !obj.phone || value)
phone: string;
..... other fields .....
}
However, how to apply swagger documentation for this? There are oneOf and anyOf in OAS3 docs. Here is suitable solution in terms of swagger: link
How is it possible to implement both validation and swagger docs at the same time?