aboutsummaryrefslogtreecommitdiff
path: root/csharp/protos
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-07-31 10:33:31 +0100
committerJon Skeet <jonskeet@google.com>2015-07-31 10:34:20 +0100
commit4fed0b515fb18b0ffc6f5d382f38e2a1b39912dd (patch)
treed70d4359c06388d56342fb2be2f0b84d75eda2aa /csharp/protos
parentfd02e45b2a2f38da25ee2d202ed911b684fe30ac (diff)
downloadprotobuf-4fed0b515fb18b0ffc6f5d382f38e2a1b39912dd.tar.gz
protobuf-4fed0b515fb18b0ffc6f5d382f38e2a1b39912dd.tar.bz2
protobuf-4fed0b515fb18b0ffc6f5d382f38e2a1b39912dd.zip
Fix JSON formatting to always emit fields in field order, including oneofs
Diffstat (limited to 'csharp/protos')
-rw-r--r--csharp/protos/extest/unittest_issues.proto25
1 files changed, 25 insertions, 0 deletions
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