diff options
author | mikari <mikari@yandex-team.ru> | 2022-02-10 16:48:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:47 +0300 |
commit | 2e0ed5ad2d70bf924ccd3cbbfab508784ab36325 (patch) | |
tree | c407f44de8fd4579bf0ceffc822d243ff76cfd26 /library/cpp/protobuf/json | |
parent | ab32245a89d56835833808c7e644b3da277d7085 (diff) | |
download | ydb-2e0ed5ad2d70bf924ccd3cbbfab508784ab36325.tar.gz |
Restoring authorship annotation for <mikari@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 12 | ||||
-rw-r--r-- | library/cpp/protobuf/json/json2proto.h | 2 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/json2proto_ut.cpp | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 640c10f5a5..f3f642bf81 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -13,10 +13,10 @@ #define JSON_TO_FIELD(EProtoCppType, name, json, JsonCheckType, ProtoSet, JsonGet) \ case FieldDescriptor::EProtoCppType: { \ - if (config.CastRobust) { \ - reflection->ProtoSet(&proto, &field, json.JsonGet##Robust()); \ - break; \ - } \ + if (config.CastRobust) { \ + reflection->ProtoSet(&proto, &field, json.JsonGet##Robust()); \ + break; \ + } \ if (!json.JsonCheckType()) { \ if (config.CastFromString && json.IsString()) { \ if (config.DoNotCastEmptyStrings && json.GetString().empty()) { \ @@ -87,12 +87,12 @@ JsonString2Field(const NJson::TJsonValue& json, const Reflection* reflection = proto.GetReflection(); Y_ASSERT(!!reflection); - if (!json.IsString() && !config.CastRobust) { + if (!json.IsString() && !config.CastRobust) { ythrow yexception() << "Invalid type of JSON field '" << field.name() << "': " << "IsString() failed while " << "CPPTYPE_STRING is expected."; } - TString value = json.GetStringRobust(); + TString value = json.GetStringRobust(); for (size_t i = 0, endI = config.StringTransforms.size(); i < endI; ++i) { Y_ASSERT(!!config.StringTransforms[i]); if (!!config.StringTransforms[i]) { diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h index 4c33498dfa..a80cc0c378 100644 --- a/library/cpp/protobuf/json/json2proto.h +++ b/library/cpp/protobuf/json/json2proto.h @@ -82,7 +82,7 @@ namespace NProtobufJson { NameGenerator = callback; return *this; } - + TSelf& SetEnumValueMode(EnumValueMode enumValueMode) { EnumValueMode = enumValueMode; return *this; diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a..959631e7a5 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -659,11 +659,11 @@ Y_UNIT_TEST(TestCastRobust) { json["Double"] = 8; TFlatOptional proto; UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto), yexception, "Invalid type"); - + TJson2ProtoConfig config; config.SetCastRobust(true); Json2Proto(json, proto, config); - + TFlatOptional expected; expected.SetI32(5); expected.SetBool(true); @@ -671,7 +671,7 @@ Y_UNIT_TEST(TestCastRobust) { expected.SetDouble(8); UNIT_ASSERT_PROTOS_EQUAL(proto, expected); } - + Y_UNIT_TEST(TestVectorizeScalars) { NJson::TJsonValue json; #define DEFINE_FIELD(name, value) \ |