mirror of https://github.com/apache/kafka.git
KAFKA-17051 ApiKeys#toHtml should exclude the APIs having unstable latest version (#16480)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
6897b06b03
commit
2bc5e01121
|
@ -278,23 +278,25 @@ public enum ApiKeys {
|
||||||
return messageType.listeners().contains(listener);
|
return messageType.listeners().contains(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toHtml() {
|
static String toHtml() {
|
||||||
final StringBuilder b = new StringBuilder();
|
final StringBuilder b = new StringBuilder();
|
||||||
b.append("<table class=\"data-table\"><tbody>\n");
|
b.append("<table class=\"data-table\"><tbody>\n");
|
||||||
b.append("<tr>");
|
b.append("<tr>");
|
||||||
b.append("<th>Name</th>\n");
|
b.append("<th>Name</th>\n");
|
||||||
b.append("<th>Key</th>\n");
|
b.append("<th>Key</th>\n");
|
||||||
b.append("</tr>");
|
b.append("</tr>");
|
||||||
for (ApiKeys key : clientApis()) {
|
clientApis().stream()
|
||||||
b.append("<tr>\n");
|
.filter(apiKey -> !apiKey.messageType.latestVersionUnstable())
|
||||||
b.append("<td>");
|
.forEach(apiKey -> {
|
||||||
b.append("<a href=\"#The_Messages_" + key.name + "\">" + key.name + "</a>");
|
b.append("<tr>\n");
|
||||||
b.append("</td>");
|
b.append("<td>");
|
||||||
b.append("<td>");
|
b.append("<a href=\"#The_Messages_" + apiKey.name + "\">" + apiKey.name + "</a>");
|
||||||
b.append(key.id);
|
b.append("</td>");
|
||||||
b.append("</td>");
|
b.append("<td>");
|
||||||
b.append("</tr>\n");
|
b.append(apiKey.id);
|
||||||
}
|
b.append("</td>");
|
||||||
|
b.append("</tr>\n");
|
||||||
|
});
|
||||||
b.append("</tbody></table>\n");
|
b.append("</tbody></table>\n");
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
@ -87,4 +88,15 @@ public class ApiKeysTest {
|
||||||
"Found some APIs missing scope definition");
|
"Found some APIs missing scope definition");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHtmlOnlyHaveStableApi() {
|
||||||
|
String html = ApiKeys.toHtml();
|
||||||
|
for (ApiKeys apiKeys : ApiKeys.clientApis()) {
|
||||||
|
if (apiKeys.messageType.latestVersionUnstable()) {
|
||||||
|
assertFalse(html.contains("The_Messages_" + apiKeys.name), "Html should not contain unstable api: " + apiKeys.name);
|
||||||
|
} else {
|
||||||
|
assertTrue(html.contains("The_Messages_" + apiKeys.name), "Html should contain stable api: " + apiKeys.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ Kafka request. SASL/GSSAPI authentication is performed starting with this packet
|
||||||
<!--#include virtual="generated/protocol_errors.html" -->
|
<!--#include virtual="generated/protocol_errors.html" -->
|
||||||
|
|
||||||
<h5 class="anchor-heading"><a id="protocol_api_keys" class="anchor-link"></a><a href="#protocol_api_keys">Api Keys</a></h5>
|
<h5 class="anchor-heading"><a id="protocol_api_keys" class="anchor-link"></a><a href="#protocol_api_keys">Api Keys</a></h5>
|
||||||
<p>The following are the numeric codes that the ApiKey in the request can take for each of the below request types.</p>
|
<p>The following are the numeric codes that the stable ApiKey in the request can take for each of the below request types.</p>
|
||||||
<!--#include virtual="generated/protocol_api_keys.html" -->
|
<!--#include virtual="generated/protocol_api_keys.html" -->
|
||||||
|
|
||||||
<h4 class="anchor-heading"><a id="protocol_messages" class="anchor-link"></a><a href="#protocol_messages">The Messages</a></h4>
|
<h4 class="anchor-heading"><a id="protocol_messages" class="anchor-link"></a><a href="#protocol_messages">The Messages</a></h4>
|
||||||
|
|
Loading…
Reference in New Issue