danielgtaylor / danielgtaylor/python-betterproto
Suggestion: give user an option not to change field name of the message.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Every prevailing project has its own name-style, forcing users to rename every name may be not a good idea.
To communicate with Java/C++/JavaScript, `mixedCase` (also known as `Lower CamelCase`) is accepted by every other language,
and it is much shorter than PEP8 suggested-style: `private_multicast_addr` .
In my case, the InitConfig is passed by an JSON-object from web client, changing the name back and forth is useless and boring.
```proto
message InitConfig{
string sendFileDir=1;
string publicMulitcastAddr=2;
uint32 linkID =3;
string privateMulticastAddr=4;
uint32 CIR=5;
repeated string channels=6;
repeated string waitingFiles=7;
}
```
the generated python file by betterproto:
```python
@dataclass(eq=False, repr=False)
class InitConfig(betterproto.Message):
send_file_dir: str = betterproto.string_field(1)
public_mulitcast_addr: str = betterproto.string_field(2)
link_id: int = betterproto.uint32_field(3)
private_multicast_addr: str = betterproto.string_field(4)
cir: int = betterproto.uint32_field(5)
channels: List[str] = betterproto.string_field(6)
waiting_files: List[str] = betterproto.string_field(7)
```
Contributor guide
Assessment
This issue has not been assessed yet.