danielgtaylor / danielgtaylor/python-betterproto

nested empty types not in to_dict

Aperta
#199 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.8k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I am not sure if I am wrong here but when executing this:

```python
from dataclasses import dataclass

import betterproto

@dataclass
class Inner(betterproto.Message):
inner1: str = betterproto.string_field(1)
inner2: str = betterproto.string_field(2)

@dataclass
class Test(betterproto.Message):
name: str = betterproto.string_field(1)
inner: "Inner" = betterproto.message_field(2)

test = Test(name='123', inner=Inner())
print(test.to_json())
```

I receive the output `{"name": "123"}`. I would expect the output to be`{"name": "123", inner:{}}`.
Of course there is a similar issue with the `to_dict` function

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.