[ 
https://issues.apache.org/jira/browse/THRIFT-1732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kamil Salas updated THRIFT-1732:
--------------------------------

    Attachment: 
0001-THRIFT-1732-Thrift-should-provide-deep-validation-of_v2.patch

Hi! The patch's finally been done. I've added tests for validate(). This cause 
that I had to implement method validate() to TBase.py for dynamic genarator. It 
required more changes that I'd expected so it took more time. 

It would be great if someone could review the patch because it became quite 
huge. I've tried to keep everything simple & readable, but I doubt that I've 
achieved it. Any comments are welcome!
                
> Thrift should provide deep-validation of structures
> ---------------------------------------------------
>
>                 Key: THRIFT-1732
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1732
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Python - Compiler
>    Affects Versions: 0.9
>         Environment: All.
>            Reporter: Avi Flamholz
>            Priority: Minor
>         Attachments: 
> 0001-THRIFT-1732-Thrift-should-provide-deep-validation-of.patch, 
> 0001-THRIFT-1732-Thrift-should-provide-deep-validation-of_v2.patch
>
>
> The validate() method in Python does extremely shallow validation: it checks 
> only that required fields are not None. It does not check that field values 
> have the correct type or that embedded structures or collections are valid.
> This is paltry validation as compared to IsInitialized() in the Python 
> Protocol Buffers implementation, which descends into embedded structures and 
> checks that they are valid. Not to mention that ProtocolBuffers also check 
> value types on assignment. 
> It is fairly simple to generate a deep_validate() method that will 
> recursively descend into structures and collections and call validate() on 
> those which can be validated. I've written something of the sort and I'm 
> curious if it would be a welcome addition to the Python generated code.

--
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

Reply via email to