[
https://issues.apache.org/jira/browse/MINIFI-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15608733#comment-15608733
]
ASF GitHub Bot commented on MINIFI-117:
---------------------------------------
Github user JPercivall commented on a diff in the pull request:
https://github.com/apache/nifi-minifi/pull/45#discussion_r85137468
--- Diff:
minifi-toolkit/minifi-toolkit-configuration/src/main/java/org/apache/nifi/minifi/toolkit/configuration/ConfigMain.java
---
@@ -96,31 +102,39 @@ public int validate(String[] args) {
}
try (InputStream inputStream =
pathInputStreamFactory.create(args[1])) {
try {
- ConfigSchema configSchema =
SchemaLoader.loadConfigSchemaFromYaml(inputStream);
+ ConvertableSchema<ConfigSchema> configSchema =
SchemaLoader.loadConvertableSchemaFromYaml(inputStream);
+ boolean valid = true;
if (!configSchema.isValid()) {
+
System.out.println(FOUND_THE_FOLLOWING_ERRORS_WHEN_PARSING_THE_TEMPLATE_ACCORDING_TO_ITS_VERSION);
configSchema.getValidationIssues().forEach(s ->
System.out.println(s));
System.out.println();
- return ERR_INVALID_CONFIG;
- } else {
+ valid = false;
+ configSchema.clearValidationIssues();
+ }
+
+ ConfigSchema currentSchema = configSchema.convert();
--- End diff --
Something that's a bit confusing to the user, I had a valid v2 config file
and commented out the version line. When I did this I properly saw that there
were validation errors when validating it for it's current version (v1) but
didn't expect to see errors when "converting" it to the current version. I
completely understand why (the connection ids were not ingested) but maybe
either the second check needs to change or a third where it explicitly tries to
load it with the latest schema.
Or I could be completely off base, lol, let me know what you think.
> Maintainable Configuration Versioning
> -------------------------------------
>
> Key: MINIFI-117
> URL: https://issues.apache.org/jira/browse/MINIFI-117
> Project: Apache NiFi MiNiFi
> Issue Type: Bug
> Reporter: Bryan Rosander
> Assignee: Bryan Rosander
>
> In order to avoid a tangled web of if/else statements around every possible
> permutation of config.yml and an equally complicated validation routine, we
> need to utilize a versioning strategy that allows for specific parsing and
> validation code for each version of the ConfigSchema.
> This will allow us to determine if a schema will be compatible with an older
> MiNiFi instance more easily by validating the structure of the file at a
> given version while still supporting an upconvert on read to the latest
> ConfigSchema while parsing at runtime.
> It should also facilitate a deprecation strategy of removing older versions'
> classes without needing to touch current implementation
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)