diff options
author | Arslan Urtashev <urtashev@gmail.com> | 2022-02-10 16:48:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:55 +0300 |
commit | 1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/json/proto2json_printer.cpp | |
parent | b97740540e7302cec9efa181e106ae1990a0cc1c (diff) | |
download | ydb-1136f2ce7cce7bcc84e695272c0d92d4eb900c2b.tar.gz |
Restoring authorship annotation for Arslan Urtashev <urtashev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/proto2json_printer.cpp')
-rw-r--r-- | library/cpp/protobuf/json/proto2json_printer.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/protobuf/json/proto2json_printer.cpp b/library/cpp/protobuf/json/proto2json_printer.cpp index 31e7fe66d3..6123eab0f2 100644 --- a/library/cpp/protobuf/json/proto2json_printer.cpp +++ b/library/cpp/protobuf/json/proto2json_printer.cpp @@ -14,12 +14,12 @@ namespace NProtobufJson { TJsonKeyBuilder(const FieldDescriptor& field, const TProto2JsonConfig& config, TString& tmpBuf) : NewKeyStr(tmpBuf) { - if (config.NameGenerator) { - NewKeyStr = config.NameGenerator(field); - NewKeyBuf = NewKeyStr; - return; - } - + if (config.NameGenerator) { + NewKeyStr = config.NameGenerator(field); + NewKeyBuf = NewKeyStr; + return; + } + if (config.UseJsonName) { Y_ASSERT(!field.json_name().empty()); NewKeyStr = field.json_name(); @@ -136,11 +136,11 @@ namespace NProtobufJson { void TProto2JsonPrinter::PrintEnumValue(const TStringBuf& key, const EnumValueDescriptor* value, IJsonOutput& json) { - if (Config.EnumValueGenerator) { - WriteWithMaybeEmptyKey<InMapContext>(json, key, Config.EnumValueGenerator(*value)); - return; - } - + if (Config.EnumValueGenerator) { + WriteWithMaybeEmptyKey<InMapContext>(json, key, Config.EnumValueGenerator(*value)); + return; + } + switch (GetConfig().EnumMode) { case TProto2JsonConfig::EnumNumber: { WriteWithMaybeEmptyKey<InMapContext>(json, key, value->number()); @@ -333,7 +333,7 @@ namespace NProtobufJson { default: ythrow yexception() << "Unknown protobuf field type: " << static_cast<int>(field.cpp_type()) << "."; - } + } if (isMap) { json.EndObject(); @@ -462,7 +462,7 @@ namespace NProtobufJson { Y_ASSERT(field); PrintField(proto, *field, json); } - + // Check extensions via ListFields std::vector<const FieldDescriptor*> fields; auto* ref = proto.GetReflection(); |