humkum opened a new issue, #57:
URL: https://github.com/apache/rocketmq-schema-registry/issues/57

   For example, in 
`org.apache.rocketmq.schema.registry.common.dto.GetSchemaResponse.java` , the 
method `parse(String schemaIdl)` use `Schema schema = new 
Schema.Parser().parse(schemaIdl);` to parse schemaIdl, it should adapt to all 
kind of schema.
   
   `private List<Field> parse(String schemaIdl) {
           Schema schema = new Schema.Parser().parse(schemaIdl);
           return schema.getFields().stream().map(field -> {
               String type = field.schema().getType().getName();
               // ["null", "double"] represent this field is nullable
               if (field.schema().isUnion() && field.schema().getTypes().size() 
== 2) {
                   type = field.schema().getTypes().get(1).getName();
               }
               String defaultVal = field.hasDefaultValue() ? 
field.defaultVal().toString() : "null";
               return Field.builder()
                       .pos(field.pos())
                       .name(field.name())
                       .type(type)
                       .comment(field.doc())
                       .isNullable(field.schema().isNullable())
                       .defaultValue(defaultVal)
                       .sortType(field.order().name())
                       .extra("")
                       .build();
           }).collect(Collectors.toList());
       }`


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