Open s5364733 opened 6 months ago
嗯,#64 跟这个应该是一个事情。尽量基于 thrift 的 enum 去实现。
需要参照 thrift 的 enum,让它的生成内容向 dubbo-go-hessian2 已经支持的范围靠拢。并且我们最好不要修改 thriftgo,应该可以参照 https://github.com/cloudwego/kitex/pull/1076, 拿到 thriftgo 解析好的 AST 后,再生成 hessian2 独有的代码
1. 定义thrift 原语法如下:
enum Direction {
NORTH,
EAST,
SOUTH,
WEST
}
struct Location {
1: Direction direction,
2: i32 distance
}
**2. 使用kitex cmd thrfit go 插件解析到thrift ast
生成兼容代码之后 因为Codec-Dubbo使用hessian2编码枚举,所以编码层应该不需要改动
有几个问题还得确认
It seems that enumeration is not supported now, but Hessian-dubbo already has support for int enumeration.
The writing method when using the hessian2 protocol conversion type normally is as follows:
Because Codec-dubbo calls hessian-dubbo for serialization at the bottom level, the purpose can be achieved as long as the type can be guaranteed to be serialized by hessian-dubbo. For specific real-time solutions, you can refer to the implementation of extended thrift.
具体实现参考: dubbo-go-hessian2 IDL-REF