Skip to content

Commit b3b2245

Browse files
committed
Apply patch from PR #21
1 parent 5abfeb6 commit b3b2245

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

betterproto/plugin.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,19 @@ def get_py_zero(type_num: int) -> str:
122122

123123

124124
def traverse(proto_file):
125-
def _traverse(path, items):
125+
def _traverse(path, items, prefix = ''):
126126
for i, item in enumerate(items):
127+
# Adjust the name since we flatten the heirarchy.
128+
item.name = next_prefix = prefix + item.name
127129
yield item, path + [i]
128130

129131
if isinstance(item, DescriptorProto):
130132
for enum in item.enum_type:
131-
enum.name = item.name + enum.name
133+
enum.name = next_prefix + enum.name
132134
yield enum, path + [i, 4]
133135

134136
if item.nested_type:
135-
for n, p in _traverse(path + [i, 3], item.nested_type):
136-
# Adjust the name since we flatten the heirarchy.
137-
n.name = item.name + n.name
137+
for n, p in _traverse(path + [i, 3], item.nested_type, next_prefix):
138138
yield n, p
139139

140140
return itertools.chain(

0 commit comments

Comments
 (0)