Add warnings when calling deprecated method (#596)

* Add test

* To run the workflow

* Fix import

* Format

* Add warning

* Fix indentation

* Test deprecated method

* More test

* Format

* Add import if needed

---------

Co-authored-by: Adrien Vannson <adrien.vannson@gardacp.com>
This commit is contained in:
Adrien
2024-08-14 22:33:43 +02:00
committed by GitHub
parent f96f51650c
commit 4e9a17c227
4 changed files with 43 additions and 0 deletions

View File

@@ -84,6 +84,10 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub):
{% if method.comment %}
{{ method.comment }}
{% endif %}
{% if method.proto_obj.options.deprecated %}
warnings.warn("{{ service.py_name }}.{{ method.py_name }} is deprecated", DeprecationWarning)
{% endif %}
{% if method.server_streaming %}
{% if method.client_streaming %}