In this thread/commit you add a call to RaiseServiceException in case of Validation error / rule violation.
After that change, now a rule violation triggers custom(s) serviceExceptionHandler, but if one of those handlers return a custom error response, it will be ignored by the new version of the ValidationFilters line 23
HostContext.RaiseServiceException(req, requestDto, validationResult.ToException());
var errorResponse = DtoUtils.CreateErrorResponse(
requestDto, validationResult.ToErrorResult());
var validationFeature = HostContext.GetPlugin<ValidationFeature>();
if (validationFeature != null && validationFeature.ErrorResponseFilter != null)
{
errorResponse = validationFeature.ErrorResponseFilter(validationResult, errorResponse);
}
res.WriteToResponse(req, errorResponse);
why are you discarding a possible custom response from the handler and always creating a brand new one instead without checking?
What about to change it as following:
var errorResponse = HostContext.RaiseServiceException(req, requestDto, validationResult.ToException());
errorResponse = errorResponse ?? DtoUtils.CreateErrorResponse(
requestDto, validationResult.ToErrorResult());