Add OneOf support, rework field detection

This commit is contained in:
Daniel G. Taylor
2019-10-22 20:44:00 -07:00
parent 477e9cdae8
commit 5dae20970b
5 changed files with 253 additions and 88 deletions

View File

@@ -242,6 +242,10 @@ def generate_code(request, response):
if f.type in [1, 2, 3, 4, 5, 6, 7, 8, 13, 15, 16, 17, 18]:
packed = True
one_of = ""
if f.HasField("oneof_index"):
one_of = item.oneof_decl[f.oneof_index].name
data["properties"].append(
{
"name": f.name,
@@ -254,6 +258,7 @@ def generate_code(request, response):
"zero": zero,
"repeated": repeated,
"packed": packed,
"one_of": one_of,
}
)
# print(f, file=sys.stderr)