aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf
diff options
context:
space:
mode:
authorevelkin <evelkin@yandex-team.ru>2022-02-10 16:49:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:25 +0300
commit7510cec1516d17cbc8d7749974e36aa45f547a26 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf
parentf9f914a9d510572fa0d68959aaea41be5839ff3d (diff)
downloadydb-7510cec1516d17cbc8d7749974e36aa45f547a26.tar.gz
Restoring authorship annotation for <evelkin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf')
-rw-r--r--library/cpp/protobuf/json/proto2json_printer.cpp28
-rw-r--r--library/cpp/protobuf/json/ut/proto2json_ut.cpp16
-rw-r--r--library/cpp/protobuf/json/ut/test.proto16
3 files changed, 30 insertions, 30 deletions
diff --git a/library/cpp/protobuf/json/proto2json_printer.cpp b/library/cpp/protobuf/json/proto2json_printer.cpp
index 26f29547fc..6123eab0f2 100644
--- a/library/cpp/protobuf/json/proto2json_printer.cpp
+++ b/library/cpp/protobuf/json/proto2json_printer.cpp
@@ -442,8 +442,8 @@ namespace NProtobufJson {
const FieldDescriptor& field,
IJsonOutput& json,
const TStringBuf key) {
-
-
+
+
if (field.is_repeated())
PrintRepeatedField(proto, field, json, key);
else
@@ -456,21 +456,21 @@ namespace NProtobufJson {
json.BeginObject();
- // Iterate over all non-extension fields
+ // Iterate over all non-extension fields
for (int f = 0, endF = descriptor->field_count(); f < endF; ++f) {
const FieldDescriptor* field = descriptor->field(f);
Y_ASSERT(field);
PrintField(proto, *field, json);
}
- // Check extensions via ListFields
- std::vector<const FieldDescriptor*> fields;
- auto* ref = proto.GetReflection();
- ref->ListFields(proto, &fields);
-
- for (const FieldDescriptor* field : fields) {
- Y_ASSERT(field);
- if (field->is_extension()) {
+ // Check extensions via ListFields
+ std::vector<const FieldDescriptor*> fields;
+ auto* ref = proto.GetReflection();
+ ref->ListFields(proto, &fields);
+
+ for (const FieldDescriptor* field : fields) {
+ Y_ASSERT(field);
+ if (field->is_extension()) {
switch (GetConfig().ExtensionFieldNameMode) {
case TProto2JsonConfig::ExtFldNameFull:
PrintField(proto, *field, json, field->full_name());
@@ -479,9 +479,9 @@ namespace NProtobufJson {
PrintField(proto, *field, json);
break;
}
- }
- }
-
+ }
+ }
+
if (closeMap) {
json.EndObject();
}
diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
index dc14531941..07e52d7f2f 100644
--- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp
+++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
@@ -1006,17 +1006,17 @@ Y_UNIT_TEST(TestStringifyLongNumbers) {
#undef TEST_SINGLE
} // TestStringifyLongNumbers
-Y_UNIT_TEST(TestExtension) {
- TExtensionField proto;
- proto.SetExtension(bar, 1);
-
- Y_ASSERT(proto.HasExtension(bar));
- UNIT_ASSERT_EQUAL(Proto2Json(proto, TProto2JsonConfig()), "{\"NProtobufJsonTest.bar\":1}");
+Y_UNIT_TEST(TestExtension) {
+ TExtensionField proto;
+ proto.SetExtension(bar, 1);
+
+ Y_ASSERT(proto.HasExtension(bar));
+ UNIT_ASSERT_EQUAL(Proto2Json(proto, TProto2JsonConfig()), "{\"NProtobufJsonTest.bar\":1}");
TProto2JsonConfig cfg;
cfg.SetExtensionFieldNameMode(TProto2JsonConfig::ExtFldNameShort);
UNIT_ASSERT_EQUAL(Proto2Json(proto, cfg), "{\"bar\":1}");
-} // TestExtension
-
+} // TestExtension
+
} // TProto2JsonTest
diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto
index 54253e4186..0fa996fd41 100644
--- a/library/cpp/protobuf/json/ut/test.proto
+++ b/library/cpp/protobuf/json/ut/test.proto
@@ -193,11 +193,11 @@ message TSingleRepeatedString {
message TSingleRepeatedInt {
repeated int32 RepeatedInt = 1;
}
-
-message TExtensionField {
- extensions 100 to 199;
-}
-
-extend TExtensionField {
- optional int32 bar = 123;
-} \ No newline at end of file
+
+message TExtensionField {
+ extensions 100 to 199;
+}
+
+extend TExtensionField {
+ optional int32 bar = 123;
+} \ No newline at end of file