Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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++)

Powered by Google App Engine
This is Rietveld 408576698