danielgtaylor / danielgtaylor/python-betterproto

Generated class name change proto casing

未关闭
#263 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
compiler-bug
主要语言
Python
星标
1.8k
派生
234
PR 合并指标
30 天内没有已合并 PR

描述

Given the following protobuf:
```
message ABCAnswerDeleted {
uint64 test_id = 1;
}
```
Version: `betterproto[compiler]` -> `2.0.0b2` or `2.0.0b3` gives
```
@dataclass(eq=False, repr=False)
class AbcAnswerDeleted(betterproto.Message):
test_id: int = betterproto.uint64_field(1)

def __post_init__(self) -> None:
super().__post_init__()
```

Version: `betterproto[compiler]` -> `1.2.5` gives
```
@dataclass
class ABCAnswerDeleted(betterproto.Message):
test_id: int = betterproto.uint64_field(1)
```

In `2.0.0b2` classname `ABC` is turned into `Abc`. Is this something new to betterproto 2 ? Is there an option to specify to allow class-name conservation ?

Thanks for the lib and for the support :)

Seems to be coming from: https://github.com/danielgtaylor/python-betterproto/blob/v2.0.0b3/src/betterproto/compile/importing.py#L60

https://github.com/danielgtaylor/python-betterproto/blob/v2.0.0b3/src/betterproto/plugin/models.py#L302

贡献指南

打开贡献指南

调研方向

复现 protobuf 示例生成的输出,然后检查 src/betterproto/compile/importing.py 第 60 行附近以及 src/betterproto/plugin/models.py 第 302 行附近。将类名转换与版本 1.2.5 进行比较;当 ABC 的处理得到解决,或支持显式保留选项,并且生成的名称经过验证时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。