danielgtaylor / danielgtaylor/python-betterproto

Suggestion: give user an option not to change field name of the message.

Aperta
#379 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.8k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L'issue non indica file, test o punti di ingresso; inizia individuando la logica del generatore che converte i nomi dei campi protobuf per l'output Python. Il lavoro è completo quando esiste un modo opt-in per mantenere i nomi dei campi sorgente, con il comportamento verificato per i campi mostrati in stile InitConfig.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.