You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/02/20 15:44:30 UTC

[GitHub] [servicecomb-java-chassis] aceElysion opened a new issue #1586: foundation-protobuf序列化问题

aceElysion opened a new issue #1586: foundation-protobuf序列化问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1586
 
 
   1. 继承,父类的属性 反序列化不出来,是空值
   2. 整形类型若值为0, 反序列化出来是 null

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1586: foundation-protobuf序列化问题

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1586: foundation-protobuf序列化问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1586#issuecomment-589457478
 
 
   你正在使用最新版本 `foundation-protobuf` 提供的 API 吗, 能否看下你的用法? ProtoBuffer 对于所有缺省值在序列化的时候,都是采用的不生成任何内容。 因此在反序列化的时候, 结果都是 null(包括基本类型,enum等)。 加上2.0.0是[弱类型契约](https://docs.servicecomb.io/java-chassis/zh_CN/featured-topics/features/weak-type-contrast/),因此中间可能是null,只有存在类型与契约对应的时候,才是缺省值.  2.0.0昨天刚刚发布,[这里](https://docs.servicecomb.io/java-chassis/zh_CN/upgrading/1_to_2/) 有一个对于缺省值的特殊说明 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] aceElysion commented on issue #1586: foundation-protobuf序列化问题

Posted by GitBox <gi...@apache.org>.
aceElysion commented on issue #1586: foundation-protobuf序列化问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1586#issuecomment-589563123
 
 
   使用的是2.0.0的版本:
   ![image](https://user-images.githubusercontent.com/1091804/75019587-1922e400-54cc-11ea-8415-6f37a13270d2.png)
   用法就是参考样例:
   ![image](https://user-images.githubusercontent.com/1091804/75019615-2a6bf080-54cc-11ea-82b6-5fe24a52a8c3.png)
   
   proto文件:
   syntax = "proto3";
   
   package serialization_pojo;
   
   option java_package = "serialization.pojo";
   option java_outer_classname = "TestProtocol";
   
   message Group {
       string name = 1;
       int32 id = 2;
       float gFloat = 3;
       double gDouble = 4;
       repeated User user = 5;
       bool isOK = 6;
       bytes data = 7;
   }
   
   message User {
       int32 id = 1;
       int64 sid = 2;
       string name = 6;
       string desc = 7;
       map<string, string> members = 8;
   }
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1586: foundation-protobuf序列化问题

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1586: foundation-protobuf序列化问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1586#issuecomment-589575887
 
 
   你的使用方法比较深入了,不太清楚你的使用场景,不知道是否方便告知。 不过目前这个模块在实现的时候,并没有考虑直接作为API使用,没有进行用户设计, 实际上 java-chassis 调用这些API 的时候,还会对一些情况进行处理,这里的 API 是为其他模块服务的(可以参考 common-protobuf 模块,大部分测试用例实际上在这里)。如果你在寻找一个protobuffer库,建议可以使用protostuff。 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] aceElysion commented on issue #1586: foundation-protobuf序列化问题

Posted by GitBox <gi...@apache.org>.
aceElysion commented on issue #1586: foundation-protobuf序列化问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1586#issuecomment-589147051
 
 
   还有个问题: 布尔类型,值为 false的话,反序列化出来也是null
   ![image](https://user-images.githubusercontent.com/1091804/74952492-4b383580-543b-11ea-9c33-3c3b4cae7da1.png)
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services