danielgtaylor / danielgtaylor/python-betterproto
Missing betterproto_lib_google_protobuf import if only used as rpc call parameter.
- Langage dominant
- Python
- Étoiles
- 1.8k
- Forks
- 234
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I'm using 2.0.0b5.
The following file results in broken python:
```proto
syntax = "proto3";
package experiment;
import "google/protobuf/empty.proto";
message Reply {
bool happy = 1;
}
service Testcase {
rpc call(google.protobuf.Empty) returns (Reply);
}
```
Specifically, the import `import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf` is missing from the output file.
When any `google.protobuf` imported field is used anywhere else, it does work correctly, for example, the following files all work:
```proto
syntax = "proto3";
package experiment;
import "google/protobuf/empty.proto";
message Reply {
bool happy = 1;
}
service Testcase {
rpc call(Reply) returns (google.protobuf.Empty);
}
```
```proto
syntax = "proto3";
package experiment;
import "google/protobuf/empty.proto";
message Reply {
bool happy = 1;
google.protobuf.Empty e = 2;
}
service Testcase {
rpc call(google.protobuf.Empty) returns (Reply);
}
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez le problème avec l’entrée .proto fournie et examinez le fichier de sortie Python généré. Comparez l’import de dépendance manquant lorsque Empty est utilisé uniquement comme paramètre RPC avec les cas fonctionnels du retour et du champ ; c’est terminé lorsque le module généré inclut l’import requis et reste du Python valide.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100