[
https://issues.apache.org/jira/browse/SLING-2803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13619649#comment-13619649
]
Radu Cotescu commented on SLING-2803:
-------------------------------------
[~cziegeler], could you please elaborate a bit more on the descriptive approach
you had in mind? I was also thinking that we'd need a descriptive approach for
the ValidationModel in order to avoid providing validation info in forms. Alex
is right: allowing ValidationModel overriding in the request parameters is not
such a good idea; the same applies for validator restrictions (e.g. value
ranges). However, I also don't like the complications of request attributes.
That's why I think it would be better to find a way to define the models using
JCR nodes and then have a service that just reads a model and then performs the
validation. The JCR validation model should provide a structure like:
validationModel (node)
|_validation:resourceType (property) - the resource type for which this
model can be applied
|_properties (node)
|_property1 (node)
| |_validator (property)
| |_validatorProperty1 (property)
| |
| |_validatorPropertyN (property)
|_propertyN (node)
The properties node would hold all the required properties for a resource type.
In case there's a need for several other constraints, we can then define the
Validator to be used for the property together with some Validator properties
(a value range, a regex, etc.).
The default validation models can be provided in /libs, allowing people to
overlay them in /apps. Another flexibility option would be to have the
ValidationModels also applied to a path, in case you want more than one model
for the same resource type.
The only question that remains is how can we validate tree-like structures, in
case a child node depends on its parent?
> Create a Validation module capable of validating POST requests or Resources
> ---------------------------------------------------------------------------
>
> Key: SLING-2803
> URL: https://issues.apache.org/jira/browse/SLING-2803
> Project: Sling
> Issue Type: New Feature
> Reporter: Radu Cotescu
>
> Several Sling users have asked in the past [1] about a Validation mechanism
> in Sling that's able to validate data coming from the user. However, such a
> module is still missing.
> This issue is meant to track the work progress on such a module.
> Ideally the module should be able to validate both request parameters and
> Resources, by obtaining their properties via a ValueMap and provide feedback
> in case of a validation error.
> [1] - http://sling.markmail.org/search/?q=validation
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira