You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/09/02 11:19:21 UTC

[GitHub] [rocketmq-schema-registry] humkum opened a new issue, #57: Storage should adapt all type schema idl

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: dev-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-schema-registry] RongtongJin closed issue #57: Storage should adapt to all schema idl types

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #57: Storage  should adapt to all schema idl types
URL: https://github.com/apache/rocketmq-schema-registry/issues/57


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org