You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2017/02/16 17:12:41 UTC

[jira] [Commented] (SLING-6516) ValidationModelProvider evaluating additional annotations on a Sling Model bound to a specific resource type

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

Konrad Windszus commented on SLING-6516:
----------------------------------------

_This comment is WIP, i.e. not final and not everything has been detailled yet._
The according properties/resources from the regular resource validation model (as described in https://sling.apache.org/documentation/bundles/validation.html#validation-model-resources) would be translated/extracted like this in an annotation-based validation model provider.
|| Property/Resource in Resource-based validation  model || Equivalent in Annotation-based validation model ||
| validatedResourceType | {{resourceType}} element in {{@Model}} annotation, https://sling.apache.org/documentation/bundles/models.html#associating-a-model-class-with-a-resource-type-since-130 |
| applicablePaths | dedicated annotation on Sling Model class, TBD |
| properties\<propertyName> | {{@ValueMapValue(injectionStrategy=REQUIRED)}}, the name of the resource would be derived from either the field's name or the dedicated name attribute. | 
| properties\<propertyName>\optional | {{@ValueMapValue injectionStrategy=OPTIONAL}}, the name of the resource would be derived from either the field's name or the dedicated name attribute. |
| properties\<propertyName>\propertyMultiple | TBD |
| properties\<propertyName>\nameRegex | TBD |
| properties\<propertyName>\validators\<validatorName> | TBD |
| properties\<propertyName>\validators\<validatorName>\validatorArguments  | TBD | 
| properties\<propertyName>\validators\<validatorName>\severity | TBD |
| children\<resourceName>  | TBD |
| children\<resourceName>\nameRegex | TBD |
| children\<resourceName>\optional | TBD |
| children\<resourceName>\properties | TBD |

> ValidationModelProvider evaluating additional annotations on a Sling Model bound to a specific resource type
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-6516
>                 URL: https://issues.apache.org/jira/browse/SLING-6516
>             Project: Sling
>          Issue Type: Improvement
>          Components: Validation
>            Reporter: Konrad Windszus
>
> Instead of providing a validation model through a dedicated sling resource with specific properties, it is often more handy to rely on annotations. A new ValidationModelProvider should support additional annotations on SlingModels defining a validation model for the underlying resource type of that SlingModel.



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