markap14 commented on PR #9061:
URL: https://github.com/apache/nifi/pull/9061#issuecomment-2214130908

   Hey @mark-bathori thanks for the update! I agree with the problem and the 
general approach. The only concern that I have here is with the new 
`ValidationResult` class. Specifically, I don't think it makes sense to create 
a `ValidationResult` and then call `add_validation_result` on that object. I 
would also like to avoid having to create a `ValidationResult` just to call 
`build_validation_result_list()` just in order to return it.
   
   Rather, I think we should define `ValidationResult` to have an `init` that 
takes those 4 parameters (`subject`, `valid`, `explanation`, input`) and just 
return a `list` of them from the method. For example, we should be able to 
implement the above as:
   
   ```
     def customValidate(self, context):
         results = []
         results.append(new ValidationResult(subject="Test subject 1", 
explanation="Test validation 1", valid=False, input="Input 1")
         results.append(new ValidationResult(subject="Test subject 2", 
explanation="Test validation 2", valid=False, input="Input 1")
         return results
   ```
   
   Or, alternatively,
   ```
     def customValidate(self, context):
         return [
               new ValidationResult(subject="Test subject 1", explanation="Test 
validation 1", valid=False, input="Input 1"),
               new ValidationResult(subject="Test subject 2", explanation="Test 
validation 2", valid=False, input="Input 1")]
   ```
   
   The `PythonProcessorAdapter`, then, should be responsible for taking that 
Python `list` that is returned and converting it into the `ArrayList` needed by 
the framework.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to