diff options
author | AlexSm <alex@ydb.tech> | 2023-12-27 23:31:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 23:31:58 +0100 |
commit | d67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch) | |
tree | 8674f2f1570877cb653e7ddcff37ba00288de15a /library/cpp/protobuf/json/json2proto.cpp | |
parent | 1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff) | |
download | ydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz |
Import libs 4 (#758)
Diffstat (limited to 'library/cpp/protobuf/json/json2proto.cpp')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 83b7891b9c..f0ca3adf42 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -367,7 +367,7 @@ Json2RepeatedFieldValue(const NJson::TJsonValue& jsonValue, const google::protobuf::FieldDescriptor& field, const NProtobufJson::TJson2ProtoConfig& config, const google::protobuf::Reflection* reflection, - const TMaybe<TString>& key = {}) { + const TString* key = nullptr) { using namespace google::protobuf; switch (field.cpp_type()) { @@ -392,12 +392,12 @@ Json2RepeatedFieldValue(const NJson::TJsonValue& jsonValue, case FieldDescriptor::CPPTYPE_MESSAGE: { Message* innerProto = reflection->AddMessage(&proto, &field); Y_ASSERT(!!innerProto); - if (key.Defined()) { - const FieldDescriptor* keyField = innerProto->GetDescriptor()->FindFieldByName("key"); + if (key) { + const FieldDescriptor* keyField = innerProto->GetDescriptor()->map_key(); Y_ENSURE(keyField, "Map entry key field not found: " << field.name()); SetKey(*innerProto, *keyField, *key); - const FieldDescriptor* valueField = innerProto->GetDescriptor()->FindFieldByName("value"); + const FieldDescriptor* valueField = innerProto->GetDescriptor()->map_value(); Y_ENSURE(valueField, "Map entry value field not found."); Json2SingleField(jsonValue, *innerProto, *valueField, config, /*isMapValue=*/true); } else { @@ -457,7 +457,7 @@ Json2RepeatedField(const NJson::TJsonValue& json, if (config.UnknownFieldsCollector) { config.UnknownFieldsCollector->OnEnterMapItem(key); } - Json2RepeatedFieldValue(jsonValue, proto, field, config, reflection, key); + Json2RepeatedFieldValue(jsonValue, proto, field, config, reflection, &key); if (config.UnknownFieldsCollector) { config.UnknownFieldsCollector->OnLeaveMapItem(); } |