mosermw commented on code in PR #7922:
URL: https://github.com/apache/nifi/pull/7922#discussion_r1385003663
##########
nifi-nar-bundles/nifi-jslt-bundle/nifi-jslt-processors/src/main/java/org/apache/nifi/processors/jslt/JSLTTransformJSON.java:
##########
@@ -107,6 +108,16 @@ public class JSLTTransformJSON extends AbstractProcessor {
.defaultValue(EACH_OBJECT.getValue())
.build();
+ public static final PropertyDescriptor RESULT_FILTER = new
PropertyDescriptor.Builder()
+ .name("jslt-transform-result-filter")
+ .displayName("Transform Result Filter")
+ .description("An optional filter of output results using another
JSLT, allowing you to change the default filter."
+ + " The default filter is \". != null and . != {} and . !=
[]\" which excludes objects with null values, empty objects and empty arrays")
Review Comment:
No problem @exceptionfactory it took me a bit of reading and testing to
learn this. The default filter in the JSLT library is
[DefaultJsonFilter.java](https://github.com/schibsted/jslt/blob/master/core/src/main/java/com/schibsted/spt/data/jslt/filters/DefaultJsonFilter.java).
It uses the
[NodeUtils::isValue](https://github.com/schibsted/jslt/blob/afb0cc037daac1ac69d9348d42a62d09a12cc4f5/core/src/main/java/com/schibsted/spt/data/jslt/impl/NodeUtils.java#L59)
method to determine whether to output a JsonNode. This method is a bit faster
than processing a JSLT that does the same thing.
The [documentation about this
filter](https://github.com/schibsted/jslt/blob/master/docs/api.md#object-key-filter)
shows an equivalent JSLT which is what you see in the JSLT_FILTER_DEFAULT
variable. Even though implementing a Java based filter would be faster, I
think using JSLT for the filter gives users maximum flexibility.
--
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]