You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/12/04 14:42:47 UTC

[GitHub] [incubator-brpc] chenBright opened a new pull request, #2035: only allow to convert root array to single repeated pb

chenBright opened a new pull request, #2035:
URL: https://github.com/apache/incubator-brpc/pull/2035

   ### What problem does this PR solve?
   
   Issue Number:
   
   Problem Summary:
   目前打开single_repeated_to_array开关后,pb转json只支持root case,但是打开array_to_single_repeated开关,json转pb没有限制root case。这样会导致json转pb,pb再转回json,前后的json结构发生了变化,不符合预期。例如:
   
   ```
   # pb
   meesage Single {
       repeated int ids;
   }
   
   message Test {
       Single single;
   }
   
   # 打开array_to_single_repeated开关后,以下json可以转为Test
   {
       "ids": [1,2,3]
   }
   
   # 但是打开single_repeated_to_array开关后,Test转为json的格式为:
   {
       single: {
           "ids": [1,2,3]
       }
   }
   ```
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects(性能影响):
   
   - Breaking backward compatibility(向后兼容性):  如果旧代码希望array_to_single_repeated将非root array转成single  @repedted的话,使用此PR代码后,会导致json转pb失败。
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
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@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] wasphin commented on pull request #2035: only allow to convert root array to single repeated pb

Posted by GitBox <gi...@apache.org>.
wasphin commented on PR #2035:
URL: https://github.com/apache/incubator-brpc/pull/2035#issuecomment-1336434709

   > ### What problem does this PR solve?
   > Issue Number:
   > 
   > Problem Summary: 目前打开single_repeated_to_array开关后,pb转json只支持root case,但是打开array_to_single_repeated开关,json转pb没有限制root case。这样会导致json转pb,pb再转回json,前后的json结构发生了变化,不符合预期。例如:
   > 
   > ```
   > # pb
   > meesage Single {
   >     repeated int ids;
   > }
   > 
   > message Test {
   >     Single single;
   > }
   > 
   > # 打开array_to_single_repeated开关后,以下json可以转为Test
   > {
   >     "ids": [1,2,3]
   > }
   
   这个可以转为 Test? 感觉转换后应该是空 Test,看代码应该是从 json 中查找 field 进行转换,找不到 single 不应该进入到内层。


-- 
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@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] chenBright commented on pull request #2035: only allow to convert root array to single repeated pb

Posted by GitBox <gi...@apache.org>.
chenBright commented on PR #2035:
URL: https://github.com/apache/incubator-brpc/pull/2035#issuecomment-1336627772

   > > ### What problem does this PR solve?
   > > Issue Number:
   > > Problem Summary: 目前打开single_repeated_to_array开关后,pb转json只支持root case,但是打开array_to_single_repeated开关,json转pb没有限制root case。这样会导致json转pb,pb再转回json,前后的json结构发生了变化,不符合预期。例如:
   > > ```
   > > # pb
   > > meesage Single {
   > >     repeated int ids;
   > > }
   > > 
   > > message Test {
   > >     Single single;
   > > }
   > > 
   > > # 打开array_to_single_repeated开关后,以下json可以转为Test
   > > {
   > >     "ids": [1,2,3]
   > > }
   > > ```
   > 
   > 这个可以转为 Test? 感觉转换后应该是空 Test,看代码应该是从 json 中查找 field 进行转换,找不到 single 不应该进入到内层。 例子里 ids 是不是应该是 single?
   
   嗯嗯,确实写错了,应该是single。


-- 
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@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] wwbmmm merged pull request #2035: only allow to convert root array to single repeated pb

Posted by GitBox <gi...@apache.org>.
wwbmmm merged PR #2035:
URL: https://github.com/apache/incubator-brpc/pull/2035


-- 
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@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org