Skip to content

Commit

Permalink
pandaproxy/sr: protobuf rendering: add test for message oneofs normal…
Browse files Browse the repository at this point in the history
…ization ordering

(cherry picked from commit 3e4e26a)
  • Loading branch information
IoannisRP authored and BenPope committed Feb 21, 2025
1 parent bc1d6f9 commit 05c8444
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/v/pandaproxy/schema_registry/test/protobuf_rendering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,5 @@ INSTANTIATE_TEST_SUITE_P(
"repeated_custom_options",
"enum_ordering",
"message_ordering",
"service_ordering"));
"service_ordering",
"oneof_ordering"));
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

// Oneof fields should be ordered by their index, regardless
// of what field values they have internally. Fields internally
// are safe to reorder

message OneofsMessage {
oneof first_oneof {
float third_f = 7;
double third_d = 3;
}
double d = 6;
uint32 ui32 = 5;
int64 i64 = 4;
oneof second_oneof {
float second_f = 8;
double second_d = 2;
}
oneof third_oneof {
float first_f = 9;
double first_d = 1;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

message OneofsMessage {
int64 i64 = 4;
uint32 ui32 = 5;
double d = 6;
oneof first_oneof {
double third_d = 3;
float third_f = 7;
}
oneof second_oneof {
double second_d = 2;
float second_f = 8;
}
oneof third_oneof {
double first_d = 1;
float first_f = 9;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

message OneofsMessage {
oneof first_oneof {
float third_f = 7;
double third_d = 3;
}
double d = 6;
uint32 ui32 = 5;
int64 i64 = 4;
oneof second_oneof {
float second_f = 8;
double second_d = 2;
}
oneof third_oneof {
float first_f = 9;
double first_d = 1;
}
}

0 comments on commit 05c8444

Please sign in to comment.