-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option in SchemaBuilder to ignore user defined json properties during codegen. #542
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #542 +/- ##
============================================
+ Coverage 46.15% 46.17% +0.02%
- Complexity 4534 4545 +11
============================================
Files 407 407
Lines 28393 28447 +54
Branches 4633 4634 +1
============================================
+ Hits 13104 13135 +31
- Misses 13721 13748 +27
+ Partials 1568 1564 -4 ☔ View full report in Codecov by Sentry. |
List<String> jsonPropsToIgnoreInCompare = new ArrayList<>(); | ||
if(options.has(jsonPropsToIgnoreInCompareOpt)) { | ||
jsonPropsToIgnoreInCompare = options.valuesOf(jsonPropsToIgnoreInCompareOpt); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change to:
List jsonPropsToIgnoreInCompare = options.has(jsonPropsToIgnoreInCompareOpt) ? options.valuesOf(jsonPropsToIgnoreInCompareOpt) : Collections.emptyList();
@@ -238,6 +244,11 @@ public static void main(String[] args) throws Exception { | |||
skipCodegenIfSchemaOnClasspath = Boolean.TRUE.equals(Boolean.parseBoolean(value)); | |||
} | |||
|
|||
List<String> jsonPropsToIgnoreInCompare = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw eventually you have this as a HashSet. why not have it as a Set at the beginning?
I don't advise doing this. If folks rely on reading these properties from runtime schema they may get nasty surprises. |
What
Adding option to ignore json properties in SchemaBuilder
Why
During avro codegen, the if the generator detects conflicting defintions of a schema, where the filesystem definition is different from the one in classpath, it throws.
Relaxing this check by allowing the user to specify json properties to be ignored during this check.
It is useful if the duplicate schema is "almost" same but has certain properties which may store metadata for another flow.
Test
Added Sanity Unit test
build