junrao commented on code in PR #20614:
URL: https://github.com/apache/kafka/pull/20614#discussion_r2482868156
##########
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);
}
// Generate schemas for inline structures
generateSchemas(message.dataClassName(), message.struct(),
- message.struct().versions());
+ message.struct().versions(), Versions.NONE);
Review Comment:
Could we add a comment that the top-level struct can never be null?
##########
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:
This is a bit problematic. A shared schema could be used by multiple fields.
Some of them can be nullable and some others can be non-nullable. Not sure
what's the best approach to address this issue. One potential way is to only
support Schema for now. The generated code already handles null just with
Schema. So far, for non-generated code usage, it seems that there hasn't been a
need for a nullable schema. So, we could punt on that until there is a need.
--
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]