kitex-contrib / codec-dubbo

支持 kitex <-> dubbo 互通的 dubbo 协议编解码器。
Apache License 2.0
16 stars 14 forks source link

ReflectResponse needs to support reflecting fields end with "_" #82

Closed DMwangnima closed 6 months ago

DMwangnima commented 6 months ago

To avoid naming conflicts, thriftgo would add underscore for the fields that start with "New" and end with "Result", "Args".(Refer to https://www.cloudwego.io/zh/docs/kitex/faq/).

ReflectResponse needs to check this feature and make two fields that are only distinguished by an underscore map successfully.

DMwangnima commented 6 months ago

After testing, I found that we could not solve this problem in ReflectResponse. As for Kitex -> Dubbo, If request struct contains NewXXX field, Dubbo side could not parse this field. If response struct contains NewXXX field, dubbo-go-hessian2 could not parse this field.

If we do not modify the generated contents(add a flag in thriftgo to control whether adding underscore or not / reg operation in kitex cmd tool), we should fork dubbo-go-hessian2 and modify the field mapping. cc @felix021

felix021 commented 6 months ago

Could be solved by running kitex tool with -thrift compatible_names=false