Skip to content

Commit 8a21536

Browse files
authored
Allow empty services (#222)
Fixes issue #220
1 parent 6c1c41e commit 8a21536

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/betterproto/templates/template.py.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub):
7373
{% if service.comment %}
7474
{{ service.comment }}
7575

76+
{% elif not service.methods %}
77+
pass
7678
{% endif %}
7779
{% for method in service.methods %}
7880
async def {{ method.py_name }}(self

tests/inputs/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
"googletypes_service_returns_empty",
1919
"googletypes_service_returns_googletype",
2020
"example_service",
21+
"empty_service",
2122
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* Empty service without comments */
2+
syntax = "proto3";
3+
4+
package empty_service;
5+
6+
service Test {
7+
}

0 commit comments

Comments
 (0)