zxcware commented on a change in pull request #2833: [GOBBLIN-987] Reject 
unrecognized Enum symbols in JsonRecordAvroSchemaToAvroConverter
URL: https://github.com/apache/incubator-gobblin/pull/2833#discussion_r351947678
 
 

 ##########
 File path: 
gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonElementConversionWithAvroSchemaFactory.java
 ##########
 @@ -165,7 +166,10 @@ public EnumConverter(String fieldName, boolean nullable, 
String sourceType, Sche
 
     @Override
     Object convertField(JsonElement value) {
-      return new GenericData.EnumSymbol(this.schema, value.getAsString());
+      String valueString = value.getAsString();
+      Validate.isTrue(this.enumSet.contains(valueString),
 
 Review comment:
   most of our check is done with guava `Preconditions`. Replace 
`Validate.isTrue` with `Preconditions` to be consistent and avoid introducing a 
new dependency?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to