diff options
author | levanov <levanov@yandex-team.ru> | 2022-02-10 16:50:35 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:35 +0300 |
commit | e286bb0ae13ace8f8efe6aa628c5e1e67708e32e (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/json/json2proto.cpp | |
parent | 45c5374f026a836b0b16ea2d9246c8385d371ca7 (diff) | |
download | ydb-e286bb0ae13ace8f8efe6aa628c5e1e67708e32e.tar.gz |
Restoring authorship annotation for <levanov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/json2proto.cpp')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 572b14bbf0..640c10f5a5 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -125,8 +125,8 @@ FindEnumValue(const NProtoBuf::EnumDescriptor* enumField, static void JsonEnum2Field(const NJson::TJsonValue& json, google::protobuf::Message& proto, - const google::protobuf::FieldDescriptor& field, - const NProtobufJson::TJson2ProtoConfig& config) { + const google::protobuf::FieldDescriptor& field, + const NProtobufJson::TJson2ProtoConfig& config) { using namespace google::protobuf; const Reflection* reflection = proto.GetReflection(); @@ -146,13 +146,13 @@ JsonEnum2Field(const NJson::TJsonValue& json, } } else if (json.IsString()) { const auto& value = json.GetString(); - if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) { + if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) { enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase); } else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) { enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores); - } else { + } else { enumFieldValue = enumField->FindValueByName(value); - } + } if (!enumFieldValue) { ythrow yexception() << "Invalid string value of JSON enum field: " << TStringBuf(value).Head(100) << "."; } @@ -208,7 +208,7 @@ Json2SingleField(const NJson::TJsonValue& json, } case FieldDescriptor::CPPTYPE_ENUM: { - JsonEnum2Field(fieldJson, proto, field, config); + JsonEnum2Field(fieldJson, proto, field, config); break; } @@ -283,7 +283,7 @@ Json2RepeatedFieldValue(const NJson::TJsonValue& jsonValue, } case FieldDescriptor::CPPTYPE_ENUM: { - JsonEnum2Field(jsonValue, proto, field, config); + JsonEnum2Field(jsonValue, proto, field, config); break; } |