private static string ToCamelCaseForFieldMask(string input) { for (int i = 0; i < input.Length; i++) { char c = input[i]; if (c >= 'A' && c <= 'Z') { throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); } if (c == '_' && i < input.Length - 1) { char next = input[i + 1]; if (next < 'a' || next > 'z') { throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); } } } return ToCamelCase(input); }