ijuma commented on code in PR #18497:
URL: https://github.com/apache/kafka/pull/18497#discussion_r1922579707
##########
generator/src/main/java/org/apache/kafka/message/ApiMessageTypeGenerator.java:
##########
@@ -355,28 +362,9 @@ private void generateHeaderVersion(String type) {
buffer.decrementIndent();
continue;
}
- if (type.equals("request") && apiKey == 7) {
- buffer.printf("// Version 0 of ControlledShutdownRequest has a
non-standard request header%n");
- buffer.printf("// which does not include clientId. Version 1
of ControlledShutdownRequest%n");
- buffer.printf("// and later use the standard request
header.%n");
- buffer.printf("if (_version == 0) {%n");
- buffer.incrementIndent();
- buffer.printf("return (short) 0;%n");
- buffer.decrementIndent();
- buffer.printf("}%n");
- }
- ApiData data = entry.getValue();
- MessageSpec spec;
- if (type.equals("request")) {
- spec = data.requestSpec;
- } else if (type.equals("response")) {
- spec = data.responseSpec;
- } else {
- throw new RuntimeException("Invalid type " + type + " for
generateHeaderVersion");
- }
- if (spec == null) {
- throw new RuntimeException("failed to find " + type + " for
API key " + apiKey);
- }
+ MessageSpec spec = messageSpec(type, apiKey, entry.getValue());
+ if (!spec.hasValidVersion())
+ continue;
Review Comment:
Yeah, the intent was to skip them - this is a bug. I'll fix it and add a
test.
--
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]