[
https://issues.apache.org/jira/browse/SLING-4262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14256779#comment-14256779
]
Konrad Windszus edited comment on SLING-4262 at 12/23/14 9:31 AM:
------------------------------------------------------------------
This is not that easy to fix from a performance perspective. Since the
validation model is found via a JCR query an exact match is definitely
preferable. Therefore I would propose the following:
# Only allow absolute resource types in the {{validatedResourceType}} property
(though not that easy to check in the code, so I would just state that in the
documentation)
# If relative resource types are given in the
{{ValidationService.getValidationModel}} method, they are converted to absolute
resource types (through the {{ResourceResolver.getResource()}} method being
called on the relative resource type
(https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#getResource-org.apache.sling.api.resource.Resource-java.lang.String-).
This is then compared with the {{validatedResourceType}} property. In case
getResource returned null, no validation model is gonna be returned.
WDYT?
was (Author: kwin):
This is not that easy to fix from a performance perspective. Since the
validation model is found via a JCR query an exact match is definitely
preferable. Therefore I would propose the following:
# Only allow absolute resource types in the {{validatedResourceType}} property
are allowed (though not that easy to check in the code, so I would just state
that in the documentation)
# If relative resource types are given in the
{{ValidationService.getValidationModel}} method, they are converted to absolute
resource types (through the {{ResourceResolver.getResource()}} method being
called on the relative resource type
(https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#getResource-org.apache.sling.api.resource.Resource-java.lang.String-).
This is then compared with the {{validatedResourceType}} property. In case
getResource returned null, no validation model is gonna be returned.
WDYT?
> Make ValidationService.getValidationModel accept also relative resource types
> -----------------------------------------------------------------------------
>
> Key: SLING-4262
> URL: https://issues.apache.org/jira/browse/SLING-4262
> Project: Sling
> Issue Type: Improvement
> Components: Validation
> Reporter: Konrad Windszus
> Assignee: Konrad Windszus
> Fix For: Validation 1.0.0
>
>
> Currently there must be a direct match between the validation models resource
> type given in validatedResourceType and the resourceType given as a parameter
> to {{ValidationService.getValidationModel}}.
> It would be good if in both directions also the search path of the resource
> resolver would be considered (if one of the given values does not start with
> a "/")
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)