aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /library/cpp/protobuf/json
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json')
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp14
-rw-r--r--library/cpp/protobuf/json/proto2json_printer.cpp14
-rw-r--r--library/cpp/protobuf/json/ut/json.h8
-rw-r--r--library/cpp/protobuf/json/ut/test.proto8
4 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 66a9ef115f..640c10f5a5 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 ae5bdbcd29..6123eab0f2 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 3b3b27057b..c1f108e6e4 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 41575daf9a..0fa996fd41 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 {