Using FluentValidation, I need to require that at least 1 collection out of 3 is not empty. This is the best way I can think to do this at the moment:
RuleFor(x => x).Must(x => x.Required.Any() || x.Ignored.Any() || x.Preferred.Any());
The type being validated is defined as:
public record ReleaseProfileData(
string Name,
[JsonProperty("trash_id")] string TrashId,
bool IncludePreferredWhenRenaming,
IReadOnlyCollection<TermData> Required,
IReadOnlyCollection<TermData> Ignored,
IReadOnlyCollection<PreferredTermData> Preferred
);
Is there a more "fluent" (idiomatic) way of expressing this type of rule? If so, could you provide an example?