[
https://issues.apache.org/jira/browse/NIFI-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16136881#comment-16136881
]
ASF GitHub Bot commented on NIFI-1923:
--------------------------------------
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2099#discussion_r134503713
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToJSON.java
---
@@ -79,6 +80,17 @@
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
+
+ public static final PropertyDescriptor ATTRIBUTES_REGEX = new
PropertyDescriptor.Builder()
+ .name("attributes-to-json-regex")
+ .displayName("Attributes Regular Expression")
+ .description("Regular expression that will be evaluated
against the flow file attributes to select "
+ + "the matching attributes. This property can be used
in combination with the attributes "
+ + "list property.")
+ .required(false)
+ .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR)
--- End diff --
What do you think about supporting Expression Language for this field? You
can keep the same validator, although that doesn't allow validation against
flow files, just Variable Registry properties and such. You could support
regexes from flow file attributes too, but you'd need a new validator and it
would recompile each time, which might not be a great idea from a performance
perspective.
> AttributesToJson should support regex of Attributes List
> --------------------------------------------------------
>
> Key: NIFI-1923
> URL: https://issues.apache.org/jira/browse/NIFI-1923
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: 0.6.1
> Reporter: Andrew Grande
> Assignee: Pierre Villard
>
> Today, the Attributes List supports _only_ a comma-separated list of
> attributes to include in the output JSON. This is not flexible enough, the
> alternative is to strip every other attribute and 'convert all', which
> requires more work and may not be possible if some need to be preserved.
> *Proposal:* Attributes List must be a regex which matches the attributes to
> be included in the resulting JSON. E.g. I have lined up my data to include
> attributes like below:
> {code}
> {
> "delimited.header.column.2" : "Assignment",
> "delimited.header.column.3" : "Organization Name",
> "delimited.header.column.1" : "Registry",
> "delimited.header.column.4" : "Organization Address"
> }
> {code}
> The challenge is I have to list *delimited.header.column.1*..N explicitly,
> every property name. I may not even know how many there will be for a more
> dynamic flow.
> As a user I should be able to say *delimited.header.column\.** or any
> arbitrarily complex regex for a more dynamic conversion.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)