poorbarcode commented on code in PR #24103:
URL: https://github.com/apache/pulsar/pull/24103#discussion_r2014197979


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java:
##########
@@ -123,8 +125,41 @@ public CompletableFuture<SchemaVersion> 
deleteSchemaAsync(boolean authoritative,
                 });
     }
 
+    protected CompletableFuture<Void> 
checkSchemaTypeSupported(PostSchemaPayload payload) {
+        switch (SchemaType.valueOf(payload.getType())) {
+            case AVRO : {
+                Schema schema = 
SchemaUtil.parseAvroSchema(payload.getSchema());
+                switch (schema.getType()) {
+                    case RECORD: {
+                        break;
+                    }
+                    case UNION: {
+                        return CompletableFuture.failedFuture(new 
RestException(
+                                Response.Status.BAD_REQUEST.getStatusCode(),
+                                "[" + String.valueOf(topicName) + "] Avro 
schema typed [UNION] is not supported"));
+                    }
+                    case INT:
+                    case LONG:
+                    case FLOAT:
+                    case DOUBLE:
+                    case BOOLEAN:
+                    case STRING:
+                    case BYTES: {

Review Comment:
   >  what I meant is using a default case for the switch, instead of listing 
all other cases. Does your comment apply to that?
   
   Sorry, I misunderstood you before.
   
   There are still 4 types of schema `ARRAY, MAP, FIXED, NULL`, which are 
supported. I added a `default-case` and printed a log(it is special, in 
expected the shcema should be `RECORD`)
   



-- 
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]

Reply via email to