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

Konrad Windszus commented on SLING-6531:
----------------------------------------

The question is, how can the information about the validation be propagated 
without leveraging an exception and without having a request/thread at hand 
(compare with 
http://apache-sling.73963.n3.nabble.com/RTC-ThreadLocal-for-getting-current-request-in-sling-td4042387.html).
 My proposal is:
Attach the {{ValidationResult}} to the {{Resource}} by leveraging the 
{{Resource.getResourceMetadata().put("sling.validation", validationResult)}}. 
Then make the {{ValidationResult}} accessible by registering an 
{{AdapterFactory}} for adaptations from {{Resource}} to {{ValidationResult}} 
which will expose that object again (by looking it up in the Resources 
metadata).
  

> Do not always throw exceptions to propagate information about failed 
> validations
> --------------------------------------------------------------------------------
>
>                 Key: SLING-6531
>                 URL: https://issues.apache.org/jira/browse/SLING-6531
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: Sling Models Validation Impl 1.0.0
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>             Fix For: Sling Models Validation Impl 1.0.0
>
>
> Right now the {{o.a.s.models.validation.impl.ModelValidationImpl}} will 
> always throw an {{InvalidResourceException}} in case the underlying resource 
> is not valid (according to Sling Validation). With the advent of different 
> severities per issue (SLING-5373) this seems a bit too strict because some 
> validators could be used just for informational purposes. Those validations 
> should not prevent the Sling Model from being instantiated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to