junrao commented on code in PR #20614:
URL: https://github.com/apache/kafka/pull/20614#discussion_r2529296703
##########
generator/src/main/java/org/apache/kafka/message/SchemaGenerator.java:
##########
@@ -86,16 +86,16 @@ void generateSchemas(MessageSpec message) {
// available when we generate the inline structures
for (Iterator<StructSpec> iter = structRegistry.commonStructs();
iter.hasNext(); ) {
StructSpec struct = iter.next();
- generateSchemas(struct.name(), struct,
message.struct().versions());
+ generateSchemas(struct.name(), struct,
message.struct().versions(), Versions.NONE);
Review Comment:
> Or, we could reject the json file if the common struct is used in both
nullable and non-nullable definition. I think this may be reasonable since it
should not be “common” if it has different definitions.
This seems arbitrary. If we allow a struct field to be null, it seems that
we should allow it regardless of how the struct is defined.
> If Y is nullable, then declare that field as new NullableSchema(X);
This feels awkward to me. The generated code explicitly generates code that
handles nulls. So, NullableSchema(X) is unnecessary and will likely confuse
people.
--
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]