Author: kwin
Date: Thu Mar  2 14:05:56 2017
New Revision: 1785139

URL: http://svn.apache.org/viewvc?rev=1785139&view=rev
Log:
add section of precedence of validation models

Modified:
    sling/site/trunk/content/documentation/bundles/validation.mdtext

Modified: sling/site/trunk/content/documentation/bundles/validation.mdtext
URL: 
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/validation.mdtext?rev=1785139&r1=1785138&r2=1785139&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/validation.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/validation.mdtext Thu Mar  2 
14:05:56 2017
@@ -60,7 +60,7 @@ The resources should have the following
 -------------------- | ------- | -------------- | -------------| ---------
 `sling:resourceType` | Property | `String` | Always `sling/validation/model`, 
otherwise model will never be picked up by Sling Validation. | yes | 
`sling/validation/model`
 `validatedResourceType` | Property | `String` | The resource type of the 
resource for which this validation model should be applied. Must always be 
relative (i.e. not start with a "/"). | yes | `my/own/resourcetype` 
-`applicablePaths` | Property |  `String[]` | Path prefixes which restrict the 
validation model to resources which are below one of the given prefixes. No 
wildcards are supported. If not given, there is no path restriction. | no | 
`/content/mysite`
+`applicablePaths` | Property |  `String[]` | Path prefixes which restrict the 
validation model to resources which are below one of the given prefixes. No 
wildcards are supported. If not given, there is no path restriction. If there 
are multiple validation models registered for the same resource type the one 
with the longest matching applicablePath is chosen. | no | `/content/mysite`
 `properties\<propertyName>` | Resource | - | This resource ensures that the 
property with the name `<propertyName>` is there. The resource name has no 
longer a meaning if the property `nameRegex` is set on this node. | no | `false`
 `properties\<propertyName>\optional` | Property | `Boolean` | If `true` it is 
not an error if there is no property with the given `<propertyName>` or none 
matching the  `nameRegex`. If not set or `false` the property must be there.  | 
no | `false`
 `properties\<propertyName>\propertyMultiple` | Property | `Boolean` | If 
`true` only multivalue properties are allowed with the name `<propertyName>` or 
matching the `nameRegex`. If not set or `false`, multi- and single-value 
properties are accepted.  | no | `false`
@@ -77,6 +77,9 @@ The resources should have the following
 Sling Validation optionally supports the inheritance of Sling Validation 
Models. This means not only the model for exactly the given resource type is 
considered, but also the models for all resource super types.
 To overwrite some property or child from one of the super type models, just 
define a property/child on the same level and with the same name in a model for 
a resource type which is more specific. That way the property/child on the 
super validation model is no longer effective.
 
+## Precedence of Validation Models
+In case there are multiple validation models registered for the same resource 
type the one gets chosen which has the longest matching applicablePath. In case 
even that does not resolve to a single model the one in the first resource 
resolver's search path is chosen (models below `/apps` before the ones below 
`/libs`). If even that does not resolve to a single validation model any of the 
equally ranked models might be picked.
+
 # Usage in [Sling Models]({{ refs.models.path }})
 ## Since Sling Models 1.2.0
 See [Sling Models validation]({{ refs.models.path }}#validation)


Reply via email to