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

Required field checking is broken when the field type is a Union struct

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.2
    • None
    • None

    Description

      The validate() method on generated structs verifies that required fields are set after validation. However, if the type of the field is a Union struct, then just checking that the field isn't null is not a valid check. The value may be a non-null union, but have an unset field. (We encountered this when deserializing a type that had a union for a field, and the union's set value was an enum value that had been removed from the definition, making it a skip.)

      In order to perform the correct validation, if the value is a Union, then we must also check that the set field and value are non-null.

      Attachments

        1. unknown_enum_tests.zip
          3 kB
          Jeff DeCew
        2. thrift-735-v2.patch
          1 kB
          Nathan Marz
        3. thrift-735.patch
          1 kB
          Bryan Duxbury

        Activity

          People

            bryanduxbury Bryan Duxbury
            bryanduxbury Bryan Duxbury
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: