Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1732

Thrift should provide deep-validation of structures

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.9
    • None
    • Python - Compiler
    • None
    • All.

    • Patch Available

    Description

      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.

      Attachments

        1. 0001-Test-1732-ON.patch
          3 kB
          Kamil Sałaś
        2. 0001-THRIFT-1732-Thrift-should-provide-deep-validation-of_v2.patch
          23 kB
          Kamil Sałaś
        3. 0001-THRIFT-1732-Thrift-should-provide-deep-validation-of.patch
          7 kB
          Kamil Sałaś
        4. thrift-1732_v3.patch
          23 kB
          Kamil Sałaś
        5. thrift-1732-v3-rebased.patch
          24 kB
          Kamil Sałaś

        Issue Links

          Activity

            People

              keppetto Kamil Sałaś
              flamholz Avi Flamholz
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: