diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /library/cpp/protobuf | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 14 | ||||
-rw-r--r-- | library/cpp/protobuf/json/proto2json_printer.cpp | 14 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/json.h | 8 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/test.proto | 8 |
4 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 640c10f5a5..66a9ef115f 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -42,12 +42,12 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field, if (config.UseJsonName) { Y_ASSERT(!field.json_name().empty()); - TString name = field.json_name(); - if (!field.has_json_name() && !name.empty()) { - // FIXME: https://st.yandex-team.ru/CONTRIB-139 - name[0] = AsciiToLower(name[0]); - } - return name; + TString name = field.json_name(); + if (!field.has_json_name() && !name.empty()) { + // FIXME: https://st.yandex-team.ru/CONTRIB-139 + name[0] = AsciiToLower(name[0]); + } + return name; } TString name = field.name(); @@ -61,7 +61,7 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field, name.to_upper(); break; case NProtobufJson::TJson2ProtoConfig::FieldNameCamelCase: - if (!name.empty()) { + if (!name.empty()) { name[0] = AsciiToLower(name[0]); } break; diff --git a/library/cpp/protobuf/json/proto2json_printer.cpp b/library/cpp/protobuf/json/proto2json_printer.cpp index 6123eab0f2..ae5bdbcd29 100644 --- a/library/cpp/protobuf/json/proto2json_printer.cpp +++ b/library/cpp/protobuf/json/proto2json_printer.cpp @@ -22,12 +22,12 @@ namespace NProtobufJson { if (config.UseJsonName) { Y_ASSERT(!field.json_name().empty()); - NewKeyStr = field.json_name(); - if (!field.has_json_name() && !NewKeyStr.empty()) { - // FIXME: https://st.yandex-team.ru/CONTRIB-139 - NewKeyStr[0] = AsciiToLower(NewKeyStr[0]); - } - NewKeyBuf = NewKeyStr; + NewKeyStr = field.json_name(); + if (!field.has_json_name() && !NewKeyStr.empty()) { + // FIXME: https://st.yandex-team.ru/CONTRIB-139 + NewKeyStr[0] = AsciiToLower(NewKeyStr[0]); + } + NewKeyBuf = NewKeyStr; return; } @@ -53,7 +53,7 @@ namespace NProtobufJson { case TProto2JsonConfig::FieldNameCamelCase: { NewKeyStr = field.name(); - if (!NewKeyStr.empty()) { + if (!NewKeyStr.empty()) { NewKeyStr[0] = AsciiToLower(NewKeyStr[0]); } NewKeyBuf = NewKeyStr; diff --git a/library/cpp/protobuf/json/ut/json.h b/library/cpp/protobuf/json/ut/json.h index c1f108e6e4..3b3b27057b 100644 --- a/library/cpp/protobuf/json/ut/json.h +++ b/library/cpp/protobuf/json/ut/json.h @@ -61,9 +61,9 @@ namespace NProtobufJsonTest { #define UNIT_ASSERT_JSON_STRINGS_EQUAL(lhs, rhs) \ if (lhs != rhs) { \ NJson::TJsonValue _lhs_json, _rhs_json; \ - UNIT_ASSERT(NJson::ReadJsonTree(lhs, &_lhs_json)); \ - UNIT_ASSERT(NJson::ReadJsonTree(rhs, &_rhs_json)); \ + UNIT_ASSERT(NJson::ReadJsonTree(lhs, &_lhs_json)); \ + UNIT_ASSERT(NJson::ReadJsonTree(rhs, &_rhs_json)); \ UNIT_ASSERT_JSONS_EQUAL(_lhs_json, _rhs_json); \ - } - + } + } diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto index 0fa996fd41..41575daf9a 100644 --- a/library/cpp/protobuf/json/ut/test.proto +++ b/library/cpp/protobuf/json/ut/test.proto @@ -172,10 +172,10 @@ message TComplexMapType { }; message TWithJsonName { - optional int32 my_upper = 1 [json_name = "My-Upper"]; - optional int32 My_lower = 2 [json_name = "my-lower"]; - optional int32 Def_upper = 3; // json_name = "DefUpper" - optional int32 def_lower = 4; // json_name = "defLower" + optional int32 my_upper = 1 [json_name = "My-Upper"]; + optional int32 My_lower = 2 [json_name = "my-lower"]; + optional int32 Def_upper = 3; // json_name = "DefUpper" + optional int32 def_lower = 4; // json_name = "defLower" } message TSingleRequiredString { |