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 | 45c5374f026a836b0b16ea2d9246c8385d371ca7 (patch) | |
tree | a28dfa0b5d33076405c0ab9f7ed9c95010b6d3c7 /library/cpp/protobuf/json/json2proto.cpp | |
parent | 1377125eb4f4636322403fcf4c5e197559a72c1a (diff) | |
download | ydb-45c5374f026a836b0b16ea2d9246c8385d371ca7.tar.gz |
Restoring authorship annotation for <levanov@yandex-team.ru>. Commit 1 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 640c10f5a5..572b14bbf0 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; } |