Merge pull request #90 from jameslan/fix/fixed-types
fixed field types should be int
This commit is contained in:
commit
1ecbf1a125
@ -41,9 +41,9 @@ def py_type(
|
|||||||
message: DescriptorProto,
|
message: DescriptorProto,
|
||||||
descriptor: FieldDescriptorProto,
|
descriptor: FieldDescriptorProto,
|
||||||
) -> str:
|
) -> str:
|
||||||
if descriptor.type in [1, 2, 6, 7, 15, 16]:
|
if descriptor.type in [1, 2]:
|
||||||
return "float"
|
return "float"
|
||||||
elif descriptor.type in [3, 4, 5, 13, 17, 18]:
|
elif descriptor.type in [3, 4, 5, 6, 7, 13, 15, 16, 17, 18]:
|
||||||
return "int"
|
return "int"
|
||||||
elif descriptor.type == 8:
|
elif descriptor.type == 8:
|
||||||
return "bool"
|
return "bool"
|
||||||
|
6
betterproto/tests/inputs/fixed/fixed.json
Normal file
6
betterproto/tests/inputs/fixed/fixed.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"foo": 4294967295,
|
||||||
|
"bar": -2147483648,
|
||||||
|
"baz": "18446744073709551615",
|
||||||
|
"qux": "-9223372036854775808"
|
||||||
|
}
|
8
betterproto/tests/inputs/fixed/fixed.proto
Normal file
8
betterproto/tests/inputs/fixed/fixed.proto
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
message Test {
|
||||||
|
fixed32 foo = 1;
|
||||||
|
sfixed32 bar = 2;
|
||||||
|
fixed64 baz = 3;
|
||||||
|
sfixed64 qux = 4;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user