Index: third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs |
index 4bd62cf3d436bfa91dbeeb2485b15f6cbfd1a399..0685c21adfbda93ff34a5976cf97976bc36c97d8 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs |
+++ b/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs |
@@ -52,14 +52,19 @@ namespace Google.Protobuf.WellKnownTypes |
/// </remarks> |
/// <param name="paths">Paths in the field mask</param> |
/// <param name="diagnosticOnly">Determines the handling of non-normalized values</param> |
- /// <exception cref="InvalidOperationException">The represented duration is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception> |
+ /// <exception cref="InvalidOperationException">The represented field mask is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception> |
internal static string ToJson(IList<string> paths, bool diagnosticOnly) |
{ |
var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p)); |
if (firstInvalid == null) |
{ |
var writer = new StringWriter(); |
- JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase))); |
+#if DOTNET35 |
+ var query = paths.Select(JsonFormatter.ToJsonName); |
+ JsonFormatter.WriteString(writer, string.Join(",", query.ToArray())); |
+#else |
+ JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToJsonName))); |
+#endif |
return writer.ToString(); |
} |
else |
@@ -80,9 +85,9 @@ namespace Google.Protobuf.WellKnownTypes |
} |
/// <summary> |
- /// Camel-case converter with added strictness for field mask formatting. |
+ /// Checks whether the given path is valid for a field mask. |
/// </summary> |
- /// <exception cref="InvalidOperationException">The field mask is invalid for JSON representation</exception> |
+ /// <returns>true if the path is valid; false otherwise</returns> |
private static bool ValidatePath(string input) |
{ |
for (int i = 0; i < input.Length; i++) |