Properly serialize zero-value messages in a oneof group (#176)
Also improve test utils to make it easier to have multiple json examples. Co-authored-by: Christopher Chambers <chris@peanutcode.com>
This commit is contained in:
3
tests/inputs/oneof_empty/oneof_empty.json
Normal file
3
tests/inputs/oneof_empty/oneof_empty.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"nothing": {}
|
||||
}
|
||||
15
tests/inputs/oneof_empty/oneof_empty.proto
Normal file
15
tests/inputs/oneof_empty/oneof_empty.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message Nothing {}
|
||||
|
||||
message MaybeNothing {
|
||||
string sometimes = 42;
|
||||
}
|
||||
|
||||
message Test {
|
||||
oneof empty {
|
||||
Nothing nothing = 1;
|
||||
MaybeNothing maybe1 = 2;
|
||||
MaybeNothing maybe2 = 3;
|
||||
}
|
||||
}
|
||||
3
tests/inputs/oneof_empty/oneof_empty_maybe1.json
Normal file
3
tests/inputs/oneof_empty/oneof_empty_maybe1.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"maybe1": {}
|
||||
}
|
||||
5
tests/inputs/oneof_empty/oneof_empty_maybe2.json
Normal file
5
tests/inputs/oneof_empty/oneof_empty_maybe2.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"maybe2": {
|
||||
"sometimes": "now"
|
||||
}
|
||||
}
|
||||
0
tests/inputs/oneof_empty/test_oneof_empty.py
Normal file
0
tests/inputs/oneof_empty/test_oneof_empty.py
Normal file
Reference in New Issue
Block a user