-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransportConfigValidator.cs
More file actions
27 lines (22 loc) · 882 Bytes
/
TransportConfigValidator.cs
File metadata and controls
27 lines (22 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using FluentValidation;
namespace BuslyCLI.Config.Validators;
public class TransportConfigValidator : AbstractValidator<TransportConfig>
{
public TransportConfigValidator()
{
RuleFor(x => x.Name).NotEmpty();
RuleFor(x => x.Config)
.NotEmpty()
.WithMessage("Transport must define exactly one transport configuration.")
.SetInheritanceValidator(v =>
{
v.Add(new LearningTransportConfigValidator());
v.Add(new RabbitMQTransportConfigValidator());
v.Add(new AzureServiceBusTransportConfigValidator());
v.Add(new AmazonsqsTransportConfigValidator());
});
// RuleFor(x => x.LearningTransportConfig)
// .SetValidator(new LearningTransportConfigValidator())
// .When(x => x.Config is not null);
}
}