opwvhk commented on a change in pull request #1411:
URL: https://github.com/apache/avro/pull/1411#discussion_r767190931
##########
File path:
lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
##########
@@ -182,6 +183,32 @@ public class Idl implements Closeable {
return result;
}
+ /**
+ * For "optional schemas" (recognized by the marker property the NullableType
+ * production adds), ensure the null schema is in the right place.
+ *
+ * @param schema a schema
+ * @param defaultValue the intended default value
+ * @return the schema, or an optional schema with null in the right place
+ */
+ private static Schema fixOptionalSchema(Schema schema, JsonNode
defaultValue) {
Review comment:
The main problem is a) union instances must still have the default value
match the first schema (I don't know enough to relax that constraint), and b)
the union will not be what was written.
As a result, my preference is to restrict this feature to the `?` syntax.
--
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]