danielgtaylor / danielgtaylor/python-betterproto
Import not generated for package/module if only referenced in service declaration.
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
As a basic example I have the below, the generated service will not import the `test` package, however if i reference any message in the return it imports it correctly.
```syntax = "proto3";
package test;
import "test2.proto";
message TestMessage {}
service Test {
rpc test(test2.DemoRequest) returns (TestMessage);
}
```
From a shallow look seems to stem from the `ServiceMethodCompiler.__post_init__` method. The return type is referenced using `py_output_message_type` which calls `get_type_reference` which adds it to imports, however nowhere in the `__post_init__` is the input type referenced for it to be added with `get_type_reference` to imports.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia ispezionando ServiceMethodCompiler.__post_init__, py_output_message_type e get_type_reference, quindi compila l’esempio proto dell’issue e ispeziona gli import del servizio generato. Il lavoro è completato quando il servizio generato include il package che contiene il tipo di input RPC, anche quando quel tipo viene usato solo nella dichiarazione del servizio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100