aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/WellKnownTypes
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2016-11-03 09:24:29 +0000
committerGravatar Jon Skeet <skeet@pobox.com>2016-11-03 18:05:59 +0000
commit50a37e0135c8dea723244b97b2fb76e56a5aece0 (patch)
treec9d0620d22ed0673be5cb272112d12f19a8dac66 /csharp/src/Google.Protobuf/WellKnownTypes
parent93a4fa23d0e6d5c04d4c03aa0002fb483d7a77ee (diff)
Change JSON field name formatting
This affects cases with leading capital letters. This breaks compatibility with previous C# releases, but fixes compatibility with other implementations. See #2278 for details.
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes')
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
index f9cdb8af..0685c21a 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
@@ -52,7 +52,7 @@ 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));
@@ -60,10 +60,10 @@ namespace Google.Protobuf.WellKnownTypes
{
var writer = new StringWriter();
#if DOTNET35
- var query = paths.Select(JsonFormatter.ToCamelCase);
+ var query = paths.Select(JsonFormatter.ToJsonName);
JsonFormatter.WriteString(writer, string.Join(",", query.ToArray()));
#else
- JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase)));
+ JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToJsonName)));
#endif
return writer.ToString();
}
@@ -85,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++)