[ 
https://issues.apache.org/jira/browse/SLING-5373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15192280#comment-15192280
 ] 

Konrad Windszus commented on SLING-5373:
----------------------------------------

Yes, good idea. Still to make life easier for Validator developers I am not too 
sure that it is a good idea, that they must transfer all relevant information 
from {{ValidationContext}} to {{ValidationResult}}. Currently it is location 
and severity.
With having an additional constructor lacking the severity, it is very easy to 
forget to transfer the {{severity}} into the failure.

One optimization possibility would be two different {{ValidationResult}} types. 
One is for the consumer, containing all information, the other one contains 
only the validator-specific information. So the Validator developers would only 
need to fill the latter and the {{ValidationServiceImpl}} would transform that 
into the former. But then it is no longer possible for a {{Validator}} to 
overwrite e.g. the severity.

Another possibility is to provide a constructor for {{DefaultValidationResult}} 
taking the whole {{ValidationContext}}.

Any opinions?

> Allow different severities per validator
> ----------------------------------------
>
>                 Key: SLING-5373
>                 URL: https://issues.apache.org/jira/browse/SLING-5373
>             Project: Sling
>          Issue Type: Bug
>          Components: Validation
>            Reporter: Konrad Windszus
>             Fix For: Validation 1.0.0
>
>
> It would be good to be able to define a severity either on the validator 
> itself or within the validation model. That would allow to later on 
> differentiate the handling on how to treat those violations. 
> Depending on the violation severity one could decide to either throw an 
> exception or just expose the violation failure message for informational 
> purposes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to