danielgtaylor / danielgtaylor/python-betterproto

message names with mutliple constants don't generate correctly when used in grpc

Offen
#147 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
1.8k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Given a message such as this:
```proto
message IDMessage {
string id = 1;
}
```

When it is used in an rpc as th einput message, this is generated
```python
async def get_revision(self) -> "Revision":
"""GetRevision returns a revision"""

request = IdMessage()

return await self._unary_unary(
"/somerpc.Name/GetRevision", request, Revision
)
```
if changed to:
```proto
message IdMessage {
string id = 1;
}
```
The generated prototype is then fixed:
```python
async def get_revision(self, *, id: str = "") ->"Revision":
"""GetRevision returns a revision"""

request = IdMessage()
request.id = id

return await self._unary_unary(
"/somerpc.Name/GetRevision", request, Revision
)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.