danielgtaylor / danielgtaylor/python-betterproto

overriding files with incorrect content -> package name should not be file name

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

Descrizione

I feel that I use the plugin in a wrong way or there is something not designed correctly.

example:

I have directory with three files

status.proto

```
message Success {
}

```
and
package svcs
servicesA.proto

```
package svcs
import "status.proto"
service ServiceA {
... rpcs
}
```
service.B.proto

```
package svcs
import "status.proto"
service ServiceB {
... rpcs
}
```
running protoc 3 times (serviceA.proto, serviceB.proto status.proto) in that order:
1. svcs.py with content of A
2. svcs.py with content of B
3. svcs.py with content of status.proto

I have been using protobuf for more than 12 years, but this is not correct. It is normal to have one package with multiple file being included around and similar things. the generator must either append or somehow deal with it. It is not correct expectation that each file will have a different namespace

mine current workaround - still I need to test it
```
for proto_file in request.proto_file:
- out = proto_file.package
- if out == "google.protobuf":
+ out = proto_file.package + "." + proto_file.name.rsplit('.', 1)[0]
+ if out.startswith("google"):
continue
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal codice del generatore che itera su request.proto_file e ricava i nomi di output, quindi riproduci il problema con status.proto, servicesA.proto e service.B.proto nell’ordine mostrato. Il lavoro è completato quando i file che condividono il package svcs non vengono sovrascritti e ogni file generato conserva il contenuto appropriato.

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

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Bug
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.