[ 
http://www.stripesframework.org/jira/browse/STS-868?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ben Gunter resolved STS-868.
----------------------------

       Resolution: Cannot Reproduce
    Fix Version/s:     (was: Release 1.5.7)
         Assignee: Ben Gunter

I've tested this against the 1.5.x branch, and it works as documented. Perhaps 
some clarification is needed. The documentation does not say the validations 
only apply if (in your example) the parameter books[0] is present. It says it 
applies if *any* parameter is present having the same index. Thus, if you send 
books[0].description=foo then the validation for books[0].name applies, even if 
there is no books[0] parameter. This is useful for creating new, uninitialized 
objects using lists, as opposed to updating existing objects, in which you 
would send a books[0]=123 parameter to identify the object being updated.

Thank you for the patch. If you think I've misunderstood, please submit a full 
web application to demonstrate the problem.

> Errors occured on null or not present indexed properties if required 
> parameter is used within @ValidateNestedProperties
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: STS-868
>                 URL: http://www.stripesframework.org/jira/browse/STS-868
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.5.6
>            Reporter: Haggi
>            Assignee: Ben Gunter
>            Priority: Critical
>         Attachments: DefaultActionBeanPropertyBinder.java, 
> DefaultValidationMetadataProvider.java, 
> DefaultValidationMetadataProvider.java, ValidationMetadata.java
>
>
> If you use the @ValidateNestedProperties annotation and some of your nested 
> properties are required, you will get validation errors even the index 
> property is null or not present in the request.
> The Documentation at 
> http://www.stripesframework.org/display/stripes/Indexed+Properties says:
> {quote}
> .. Required field validations are only applied if at least one value with the 
> same index was supplied. To understand this it is easier to think of indexed 
> properties as a mechanism for creating multi-row forms. And this change means 
> that rows in the form that are completely empty are ignored.
> {quote}
> The nested validation below whould raise a validation error "name is 
> required" even the indexed property books is not present in the request 
> (null).
> {code}
> @ValidateNestedProperties({
>    @Validate(field = "name", required = true, maxlength = 100),
>    @Validate(field = "description", maxlength = 255)
> })
> private List<Book> books;
> {code}
> I fixed this problem and attached the modified classes.
> @BenGunter: is the stripes project dead??

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to