aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json
diff options
context:
space:
mode:
authorchegoryu <chegoryu@yandex-team.ru>2022-02-10 16:49:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:47 +0300
commite4b93027b4c6dbd741ebd637f0b5db1d583ee93f (patch)
tree8b70986cdec2c8b7996f47c0429a6ec5dcd09392 /library/cpp/protobuf/json
parent095c2e55a230f89487c2f2caace05e108742d72c (diff)
downloadydb-e4b93027b4c6dbd741ebd637f0b5db1d583ee93f.tar.gz
Restoring authorship annotation for <chegoryu@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json')
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp2
-rw-r--r--library/cpp/protobuf/json/json2proto.h16
-rw-r--r--library/cpp/protobuf/json/ut/json2proto_ut.cpp48
3 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 640c10f5a5..9a13f0abd0 100644
--- a/library/cpp/protobuf/json/json2proto.cpp
+++ b/library/cpp/protobuf/json/json2proto.cpp
@@ -408,7 +408,7 @@ namespace NProtobufJson {
void MergeJson2Proto(const TStringBuf& json, google::protobuf::Message& proto, const TJson2ProtoConfig& config) {
NJson::TJsonReaderConfig jsonCfg;
jsonCfg.DontValidateUtf8 = true;
- jsonCfg.AllowComments = config.AllowComments;
+ jsonCfg.AllowComments = config.AllowComments;
NJson::TJsonValue jsonValue;
ReadJsonTree(json, &jsonCfg, &jsonValue, /* throwOnError = */ true);
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h
index 4c33498dfa..84402245b0 100644
--- a/library/cpp/protobuf/json/json2proto.h
+++ b/library/cpp/protobuf/json/json2proto.h
@@ -93,11 +93,11 @@ namespace NProtobufJson {
return *this;
}
- TSelf& SetAllowComments(bool value) {
- AllowComments = value;
- return *this;
- }
-
+ TSelf& SetAllowComments(bool value) {
+ AllowComments = value;
+ return *this;
+ }
+
TSelf& SetAllowUnknownFields(bool value) {
AllowUnknownFields = value;
return *this;
@@ -141,9 +141,9 @@ namespace NProtobufJson {
/// Custom spliter non array value to repeated fields.
TValueVectorizer ValueVectorizer;
-
- /// Allow js-style comments (both // and /**/)
- bool AllowComments = false;
+
+ /// Allow js-style comments (both // and /**/)
+ bool AllowComments = false;
};
/// @throw yexception
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
index 0dfe57bc7a..24964ea652 100644
--- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp
+++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
@@ -1120,28 +1120,28 @@ Y_UNIT_TEST(TestEmptyStringForCastFromString) {
UNIT_ASSERT_EQUAL("", proto.GetOneString());
} // TestEmptyStringForCastFromString
-Y_UNIT_TEST(TestAllowComments) {
- constexpr TStringBuf json = R"(
-{
- "I32": 4, // comment1
-/*
- comment2
- {}
- qwer
-*/
- "I64": 3423
-}
-
-)";
-
- TJson2ProtoConfig config;
- TFlatOptional proto;
- UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto, config), yexception, "Error: Missing a name for object member");
-
- config.SetAllowComments(true);
- UNIT_ASSERT_NO_EXCEPTION(Json2Proto(json, proto, config));
- UNIT_ASSERT_VALUES_EQUAL(proto.GetI32(), 4);
- UNIT_ASSERT_VALUES_EQUAL(proto.GetI64(), 3423);
-} // TestAllowComments
-
+Y_UNIT_TEST(TestAllowComments) {
+ constexpr TStringBuf json = R"(
+{
+ "I32": 4, // comment1
+/*
+ comment2
+ {}
+ qwer
+*/
+ "I64": 3423
+}
+
+)";
+
+ TJson2ProtoConfig config;
+ TFlatOptional proto;
+ UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto, config), yexception, "Error: Missing a name for object member");
+
+ config.SetAllowComments(true);
+ UNIT_ASSERT_NO_EXCEPTION(Json2Proto(json, proto, config));
+ UNIT_ASSERT_VALUES_EQUAL(proto.GetI32(), 4);
+ UNIT_ASSERT_VALUES_EQUAL(proto.GetI64(), 3423);
+} // TestAllowComments
+
} // TJson2ProtoTest