Replace extra decorator with property and lazy initialization so that it is backward compatible.

This commit is contained in:
James Lan
2020-05-21 17:03:05 -07:00
parent 1f7f39049e
commit 917de09bb6
3 changed files with 46 additions and 50 deletions

View File

@@ -1,6 +1,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: {{ ', '.join(description.files) }}
# plugin: python-betterproto
from dataclasses import dataclass
{% if description.datetime_imports %}
from datetime import {% for i in description.datetime_imports %}{{ i }}{% if not loop.last %}, {% endif %}{% endfor %}
@@ -37,7 +38,7 @@ class {{ enum.py_name }}(betterproto.Enum):
{% endfor %}
{% endif %}
{% for message in description.messages %}
@betterproto.protoclass
@dataclass
class {{ message.py_name }}(betterproto.Message):
{% if message.comment %}
{{ message.comment }}