Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-7985

ValidateRecord does not validate the type enum

    XMLWordPrintableJSON

    Details

      Description

      ValidateRecord processor does not validate correctly the enum data type against a flow file with JSON content. If an AVRO schema is placed with an enum it does not check the content of the field, just the type. 

      Example: 

      We have  json like this: 

      {"test":"test"}

       

      Then whe have the next AVRO schema: 

      {
      "name": "MyClass",
      "type": "record",
      "namespace": "com.test",
      "fields": [
      {
      "name": "test",
      "type":

      { "type": "enum", "name": "status", "symbols": [ "OK", "Failure" ] }

      }
      ]
      }

       

      Eventhough the word "test" is not included in one of the options for this field (that should be an enum type)The flowfile passes as valid. It only checks if it is the same type than the options inside the enum (In this case String) 

      I made a simple template in case you want to test it. 

       

      I've tested it in versions 1.9.2 and 1.12.1 and the same behavior is observed. 

       

       

       

        Attachments

        1. testIssueEnums.xml
          40 kB
          Raquel Benito Barbero

          Issue Links

            Activity

              People

              • Assignee:
                pvillard Pierre Villard
                Reporter:
                raquel_bb Raquel Benito Barbero
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: