Add a default values for rpc with empty message
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- grpc, python
- Ambito
- api, backend-api-design
Direzione di ricerca
Nell’issue non sono identificati file né test. Inizia individuando le firme dei metodi RPC Python generati e la gestione attuale di google.protobuf.Empty o dei messaggi privi di campi; il lavoro è concluso quando le RPC con messaggi vuoti possono essere chiamate senza un argomento, mentre le chiamate esistenti con messaggi espliciti continuano a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The Problem
Sometimes, it is needed to declare RPCs that take no parameter. However, it is not possible in gRPC. In such a situation, it is needed to either create an empty message type, or to use google.protobuf.Empty ( https://stackoverflow.com/questions/29687243/protobuf-rpc-service-method-without-parameters ).
However, this is not convenient for the final user: an empty message need to be created and passed to the method each time. It also makes it necessary to add potentially long imports.
The Ideal Solution
To make this easier, it would be better to add a default value for the parameter containing the request when it is possible. I see two possibilities:
- Add the default value only for
google.protobug.Empty - Add the default value for all the messages who have no field at all
I think the second solution would be better as it is common to define empty messages in such situations. I can make a PR if you agree, I already have a working version locally.
The Current Solution
Currently, it is necessary for the user to import by hand from betterproto.lib.std.google.protobuf import Empty or the custom message, which is not convenient.
The feature would turn:
from betterproto.lib.std.google.protobuf import Empty
answer = TestStub().call(Empty())
To something like:
answer = TestStub().call()
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 235
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di danielgtaylor/python-betterproto
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
bug investigation needed
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
bug investigation needed
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug investigation needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
danielgtaylor/python-betterproto#676 · 3 commenti ·
Tutte le issue di danielgtaylor/python-betterproto
Issue simili
-
[Resource]: LoreApertaresource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
hesreallyhim/awesome-claude-code#3234 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openminion/openminion#376 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: ☹︎ Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
posit-dev/great-tables#1028 ·
I maintainer di solito rispondono entro 1 giorno
-
integration: apple_tv
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
home-assistant/core#188282 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A "since" range is worded as a career: "the past two seasons" says "regular season career (2025 on)"ApertaP4: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
jeffknupp/association#538 ·