dan-s1 commented on code in PR #11290:
URL: https://github.com/apache/nifi/pull/11290#discussion_r3344556990


##########
nifi-extension-bundles/nifi-registry-bundle/nifi-registry-service/src/main/java/org/apache/nifi/schemaregistry/services/AvroSchemaRegistry.java:
##########
@@ -138,7 +137,22 @@ public RecordSchema retrieveSchema(final SchemaIdentifier 
schemaIdentifier) thro
 
     @Override
     public void migrateProperties(PropertyConfiguration config) {
-        config.renameProperty("avro-reg-validated-field-names", 
VALIDATE_FIELD_NAMES.getName());
+        // NOTE: Although there are multiple names for 
OBSOLETE_VALIDATE_FIELD_NAMES, the code in the if statement
+        // will execute at most once as the assumption is a configuration has 
one of the obsolete property names but not all.
+        for (String obsoletePropertyName : OBSOLETE_VALIDATE_FIELD_NAMES) {
+            if (config.hasProperty(obsoletePropertyName) && 
config.isPropertySet(obsoletePropertyName)) {
+                final String validateFieldNamesRawValue = 
config.getRawPropertyValue(obsoletePropertyName).orElse(Boolean.FALSE.toString());
+                final boolean validateFieldNames = 
Boolean.parseBoolean(validateFieldNamesRawValue);
+
+                if (validateFieldNames) {
+                    config.setProperty(VALIDATION_STRATEGY, 
ValidationStrategy.VALIDATE.getValue());
+                } else {
+                    config.setProperty(VALIDATION_STRATEGY, 
ValidationStrategy.NONE.getValue());
+                }
+            }
+
+            config.removeProperty(obsoletePropertyName);

Review Comment:
   @pvillard31 Are you okay if this is left as is?



-- 
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]

Reply via email to