From 4fed0b515fb18b0ffc6f5d382f38e2a1b39912dd Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Fri, 31 Jul 2015 10:33:31 +0100 Subject: Fix JSON formatting to always emit fields in field order, including oneofs --- csharp/protos/extest/unittest_issues.proto | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'csharp/protos') diff --git a/csharp/protos/extest/unittest_issues.proto b/csharp/protos/extest/unittest_issues.proto index b0c92fa2..b66da471 100644 --- a/csharp/protos/extest/unittest_issues.proto +++ b/csharp/protos/extest/unittest_issues.proto @@ -88,4 +88,29 @@ message ReservedNames { int32 types = 1; int32 descriptor = 2; +} + +message TestJsonFieldOrdering { + // These fields are deliberately not declared in numeric + // order, and the oneof fields aren't contiguous either. + // This allows for reasonably robust tests of JSON output + // ordering. + // TestFieldOrderings in unittest_proto3.proto is similar, + // but doesn't include oneofs. + // TODO: Consider adding + + int32 plain_int32 = 4; + + oneof o1 { + string o1_string = 2; + int32 o1_int32 = 5; + } + + string plain_string = 1; + + oneof o2 { + int32 o2_int32 = 6; + string o2_string = 3; + } + } \ No newline at end of file -- cgit v1.2.3