Fix JSON parsing and formatting of NullValue in C#
The NullValue enum is typically used as part of the Value well-known type, but can be used elsewhere. In previous code, a NullValue field (other than in Value) would result in a JSON value of the string "NULL_VALUE"; it should instead be the null literal.
When parsing, we still accept "NULL_VALUE" as a valid value for NullValue - this new code being unable to parse old data, and comes for free anyway.
diff --git a/csharp/protos/unittest_issues.proto b/csharp/protos/unittest_issues.proto
index b4a88d8..b602d77 100644
--- a/csharp/protos/unittest_issues.proto
+++ b/csharp/protos/unittest_issues.proto
@@ -8,6 +8,8 @@
package unittest_issues;
+import "google/protobuf/struct.proto";
+
// Issue 307: when generating doubly-nested types, any references
// should be of the form A.Types.B.Types.C.
message Issue307 {
@@ -137,4 +139,11 @@
string text = 1;
Nested nested = 2;
}
-}
\ No newline at end of file
+}
+
+message NullValueOutsideStruct {
+ oneof value {
+ string string_value = 1;
+ google.protobuf.NullValue null_value = 2;
+ }
+}