danielgtaylor / danielgtaylor/python-betterproto
overriding files with incorrect content -> package name should not be file name
- Vorherrschende Sprache
- Python
- Sterne
- 1.8k
- Forks
- 234
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
```
Beitragsleitfaden
Rechercherichtung
Beginne beim Generatorcode, der über request.proto_file iteriert und Ausgabenamen ableitet, und reproduziere dann das Problem mit status.proto, servicesA.proto und service.B.proto in der gezeigten Reihenfolge. Als erledigt gilt, dass Dateien, die das svcs-Paket gemeinsam nutzen, nicht überschrieben werden und jede generierte Datei den passenden Inhalt behält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100