sijie commented on a change in pull request #4800: Add the schema admin api
URL: https://github.com/apache/pulsar/pull/4800#discussion_r307576789
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/SchemasResource.java
##########
@@ -183,6 +218,34 @@ private static void handleGetSchemaResponse(AsyncResponse
response,
}
+ private static void handleGetAllSchemasResponse(AsyncResponse response,
+ List<SchemaAndMetadata>
schemas, Throwable error) {
+ if (isNull(error)) {
+ if (isNull(schemas)) {
+
response.resume(Response.status(Response.Status.NOT_FOUND).build());
+ } else if (schemas.size() == 0) {
+
response.resume(Response.status(Response.Status.NOT_FOUND).build());
+ } else {
+ response.resume(
+ Response.ok()
+ .encoding(MediaType.APPLICATION_JSON)
+
.entity(GetAllVersionsSchemaResponse.builder().getSchemaResponses(
+ schemas.stream().map(schemaAndMetadata
-> GetSchemaResponse.builder()
Review comment:
Can you extract the `schemaAndMetadata` to `GetSchemaResponse`
transformation into a common method? I think it should be reused across this
class.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services