aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorxveduk <xveduk@yandex-team.ru>2022-02-10 16:50:36 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:36 +0300
commit22563fe74eba1fe25e7008e2ec5635bc276eede6 (patch)
treef78891aa61c538a8959df16263222c485ef07af6 /library
parent33c469601b3522a2fda377b9b30769b8229c4e18 (diff)
downloadydb-22563fe74eba1fe25e7008e2ec5635bc276eede6.tar.gz
Restoring authorship annotation for <xveduk@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 640c10f5a5..6b7185ab54 100644
--- a/library/cpp/protobuf/json/json2proto.cpp
+++ b/library/cpp/protobuf/json/json2proto.cpp
@@ -139,31 +139,31 @@ JsonEnum2Field(const NJson::TJsonValue& json,
const EnumValueDescriptor* enumFieldValue = nullptr;
if (json.IsInteger()) {
- const auto value = json.GetInteger();
- enumFieldValue = enumField->FindValueByNumber(value);
- if (!enumFieldValue) {
- ythrow yexception() << "Invalid integer value of JSON enum field: " << value << ".";
- }
+ const auto value = json.GetInteger();
+ enumFieldValue = enumField->FindValueByNumber(value);
+ if (!enumFieldValue) {
+ ythrow yexception() << "Invalid integer value of JSON enum field: " << value << ".";
+ }
} else if (json.IsString()) {
- const auto& value = json.GetString();
+ const auto& value = json.GetString();
if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) {
- enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase);
+ enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase);
} else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) {
- enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores);
+ enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores);
} else {
- enumFieldValue = enumField->FindValueByName(value);
- }
- if (!enumFieldValue) {
- ythrow yexception() << "Invalid string value of JSON enum field: " << TStringBuf(value).Head(100) << ".";
+ enumFieldValue = enumField->FindValueByName(value);
}
+ if (!enumFieldValue) {
+ ythrow yexception() << "Invalid string value of JSON enum field: " << TStringBuf(value).Head(100) << ".";
+ }
} else {
ythrow yexception() << "Invalid type of JSON enum field: not an integer/string.";
}
- if (field.is_repeated()) {
- reflection->AddEnum(&proto, &field, enumFieldValue);
+ if (field.is_repeated()) {
+ reflection->AddEnum(&proto, &field, enumFieldValue);
} else {
- reflection->SetEnum(&proto, &field, enumFieldValue);
+ reflection->SetEnum(&proto, &field, enumFieldValue);
}
}