opwvhk commented on code in PR #1922:
URL: https://github.com/apache/avro/pull/1922#discussion_r1017075506
##########
lang/java/avro/src/main/java/org/apache/avro/Schema.java:
##########
@@ -1637,30 +1665,26 @@ private static boolean isValidDefault(Schema schema,
JsonNode defaultValue) {
return defaultValue.isNumber();
case BOOLEAN:
return defaultValue.isBoolean();
- case NULL:
- return defaultValue.isNull();
case ARRAY:
if (!defaultValue.isArray())
return false;
for (JsonNode element : defaultValue)
- if (!isValidDefault(schema.getElementType(), element))
+ if (!schema.getElementType().isValidValue(element))
return false;
return true;
case MAP:
if (!defaultValue.isObject())
return false;
for (JsonNode value : defaultValue)
- if (!isValidDefault(schema.getValueType(), value))
+ if (!schema.getValueType().isValidValue(value))
return false;
return true;
- case UNION: // union default: first branch
- return isValidDefault(schema.getTypes().get(0), defaultValue);
Review Comment:
It looks to me that these changes make any value for the null schema or a
union an invalid value. What am I overlooking?
--
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]