lkuchars commented on PR #10291:
URL: https://github.com/apache/nifi/pull/10291#issuecomment-3300673396
> Thanks for this additional validation @lkuchars.
>
> As this requires writing out temporary files, it seems like it could be a
bit expensive as written, given that `customValidate` can be triggered many
times. One option is to implement cached checking of the schema so that it only
runs the compilation when the Schema Text property changes. Another option is
to implement this as a manual verify method, requiring user interaction. It
seems better to consider the verify method approach, to avoid complexity around
caching, and because this validation only applies to the Schema Text option,
but I'm open to considering either approach.
@exceptionfactory thank you for taking your time to look at this. It would
be nice to get the validation of the schema without manual intervention. I
think the original ProtobufReader worked that way, and it used cache. I think
your suggestion with a cache is spot on.
I'll just remove the throwaway compiler
`// Create a throwaway schema compiler for validation to avoid polluting the
main compiler cache.
final ProtobufSchemaCompiler validationCompiler = new
ProtobufSchemaCompiler(getIdentifier() + "_validation", getLogger());`
I think my concerns about not polluting the global compiler cache are
unjustified.
I can use the schema compiler initialized in onEnabled. That way, subsequent
validation calls will use the cache implementation from the
ProtobufSchemaCompiler.
WDYT?
--
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]