Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1446#discussion_r101047085
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/schema/RepositoryRecordSchema.java
 ---
    @@ -91,4 +97,42 @@
             final UnionRecordField repoUpdateField = new 
UnionRecordField(REPOSITORY_RECORD_UPDATE_V1, Repetition.EXACTLY_ONE, 
createOrUpdate, delete, swapOut, swapIn);
             REPOSITORY_RECORD_SCHEMA_V1 = new 
RecordSchema(Collections.singletonList(repoUpdateField));
         }
    +
    +    static {
    --- End diff --
    
    I believe the only difference between this static block and the other is 
which FlowFileSchema should be used (FLOWFILE_SCHEMA_V1 vs. 
FLOWFILE_SCHEMA_V2), correct? This is quite a lot of code to duplicate. Can we 
instead just have a
    `private static RecordSchema createSchema(RecordSchema flowFileSchema)`
    type of method, and have it just use the given FlowFileSchema? I believe 
this would eliminate all of the duplication.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to