Skip to content

Commit 1ecbf1a

Browse files
Merge pull request #90 from jameslan/fix/fixed-types
fixed field types should be int
2 parents a46979c + 04dce52 commit 1ecbf1a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

betterproto/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def py_type(
4141
message: DescriptorProto,
4242
descriptor: FieldDescriptorProto,
4343
) -> str:
44-
if descriptor.type in [1, 2, 6, 7, 15, 16]:
44+
if descriptor.type in [1, 2]:
4545
return "float"
46-
elif descriptor.type in [3, 4, 5, 13, 17, 18]:
46+
elif descriptor.type in [3, 4, 5, 6, 7, 13, 15, 16, 17, 18]:
4747
return "int"
4848
elif descriptor.type == 8:
4949
return "bool"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"foo": 4294967295,
3+
"bar": -2147483648,
4+
"baz": "18446744073709551615",
5+
"qux": "-9223372036854775808"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
syntax = "proto3";
2+
3+
message Test {
4+
fixed32 foo = 1;
5+
sfixed32 bar = 2;
6+
fixed64 baz = 3;
7+
sfixed64 qux = 4;
8+
}

0 commit comments

Comments
 (0)