ChrisSamo632 commented on PR #7782: URL: https://github.com/apache/nifi/pull/7782#issuecomment-1736182855
> @ChrisSamo632 Did you mean to actually make these records? I do not think JsonTreeReader iis needed here, Jackson has `JsonMapper` which could allow for iteration of all the JSON objects thereby allowing for validating each object. Whether a RecordReader is used/needed here is a question for the implementation - what I'm getting at is the need to iterate through all Objects within the FlowFile - typically, that's done with a Reader in most Processors, but it doesn't *have* to be done that way here. One option would be to use a Reader (which means we could have a file format other than JSON as input) then convert to JSON as needed within the processor in order to validate with a JSON Schema (instead of an Avro Schema as currently done in `ValidateRecord`). But that's maybe going too far/not the use case we're needing to address here. Yes, another option is to use a `JsonMapper` (which is basically what the JsonTreeReader is doing, right?) to iterate through the Objects to validate each in turn. If `ValidateJson` is updated, then an option will indeed be needed to `Validate Whole` or `Validate Each` (whatever you want to call the options). Again, my suggesiton would be to look at `ValidateRecord` for how it separates the Record-based output to `valid` and `invalid` relationships depending upon whether they meet the defined schema. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
