C# 复杂属性的FluentValidation错误分组
我无法确定如何覆盖“平面”错误格式,如下所示:C# 复杂属性的FluentValidation错误分组,c#,fluentvalidation,C#,Fluentvalidation,我无法确定如何覆盖“平面”错误格式,如下所示: { "Discount": [ "'Discount' must be greater than or equal to '0'." ], "Guest.LastName": [ "'Last Name' should not be empty." ], "Guest.CountryId": [ "'Country Id' should not be empty
{
"Discount": [
"'Discount' must be greater than or equal to '0'."
],
"Guest.LastName": [
"'Last Name' should not be empty."
],
"Guest.CountryId": [
"'Country Id' should not be empty."
],
"Guest.FirstName": [
"'First Name' should not be empty."
],
"Guest.DocumentTypeId": [
"'Document Type Id' should not be empty."
]
}
变成类似于:
{
"Discount": [
"'Discount' must be greater than or equal to '0'."
],
"Guest": [
//grouped errors
]
}
我没有做任何花哨的事,只是打电话:
RuleFor(m => m.Guest).SetValidator(new CheckInGuestModelValidator())
甚至有可能以非平面列表的形式获得结果错误吗
多谢各位
皮奥特